diff --git a/package.json b/package.json index e4a923579..112e02e6c 100644 --- a/package.json +++ b/package.json @@ -2,40 +2,53 @@ "name": "square", "version": "43.0.1", "private": false, - "repository": "https://github.com/square/square-nodejs-sdk", + "repository": "github:square/square-nodejs-sdk", "license": "MIT", - "main": "./index.js", - "types": "./index.d.ts", + "type": "commonjs", + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.mjs", + "types": "./dist/cjs/index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json", + "./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" + } + } + }, + "files": [ + "dist", + "reference.md", + "README.md", + "LICENSE" + ], "scripts": { "format": "prettier . --write --ignore-unknown", - "build": "tsc", - "prepack": "cp -rv dist/. .", + "build": "yarn build:cjs && yarn build:esm", + "build:cjs": "tsc --project ./tsconfig.cjs.json", + "build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm", "test": "yarn test:unit", "test:unit": "jest --testPathPattern=tests/unit", + "test:browser": "jest --selectProjects browser", + "test:wire": "jest --selectProjects wire", "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", + "@jest/globals": "^29.7.0", "@types/jest": "^29.5.14", - "ts-jest": "^29.1.1", + "ts-jest": "^29.3.4", "jest-environment-jsdom": "^29.7.0", + "msw": "^2.8.4", "@types/node": "^18.19.70", "prettier": "^3.4.2", "typescript": "~5.7.2" @@ -43,8 +56,14 @@ "browser": { "fs": false, "os": false, - "path": false + "path": false, + "stream": false }, + "packageManager": "yarn@1.22.22", + "engines": { + "node": ">=18.0.0" + }, + "sideEffects": false, "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", "author": { "name": "Square Developer Platform", @@ -55,18 +74,7 @@ "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" - } - } + "dependencies": { + "square-legacy": "npm:square@^39.1.1" } } diff --git a/reference.md b/reference.md index d03ead60a..02b1184fa 100644 --- a/reference.md +++ b/reference.md @@ -45,7 +45,7 @@ Replace `ACCESS_TOKEN` with a ```typescript await client.mobile.authorizationCode({ - locationId: "YOUR_LOCATION_ID", + location_id: "YOUR_LOCATION_ID", }); ``` @@ -125,8 +125,8 @@ page for your application in the Developer Dashboard. ```typescript await client.oAuth.revokeToken({ - clientId: "CLIENT_ID", - accessToken: "ACCESS_TOKEN", + client_id: "CLIENT_ID", + access_token: "ACCESS_TOKEN", }); ``` @@ -213,10 +213,10 @@ Application clients should never interact directly with OAuth tokens. ```typescript await client.oAuth.obtainToken({ - clientId: "sq0idp-uaPHILoPzWZk3tlJqlML0g", - clientSecret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", + client_id: "sq0idp-uaPHILoPzWZk3tlJqlML0g", + client_secret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", code: "sq0cgb-l0SBqxs4uwxErTVyYOdemg", - grantType: "authorization_code", + grant_type: "authorization_code", }); ``` @@ -391,7 +391,7 @@ Provides summary information for a merchant's online store orders. ```typescript await client.v1Transactions.v1ListOrders({ - locationId: "location_id", + location_id: "location_id", }); ``` @@ -456,8 +456,8 @@ Provides comprehensive information for a single online store order, including th ```typescript await client.v1Transactions.v1RetrieveOrder({ - locationId: "location_id", - orderId: "order_id", + location_id: "location_id", + order_id: "order_id", }); ``` @@ -522,8 +522,8 @@ Updates the details of an online store order. Every update you perform on an ord ```typescript await client.v1Transactions.v1UpdateOrder({ - locationId: "location_id", - orderId: "order_id", + location_id: "location_id", + order_id: "order_id", action: "COMPLETE", }); ``` @@ -604,7 +604,7 @@ To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an ```typescript await client.applePay.registerDomain({ - domainName: "example.com", + domain_name: "example.com", }); ``` @@ -676,7 +676,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.bankAccounts.list(); +let page = await client.bankAccounts.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -743,7 +743,7 @@ Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank acc ```typescript await client.bankAccounts.getByV1Id({ - v1BankAccountId: "v1_bank_account_id", + v1_bank_account_id: "v1_bank_account_id", }); ``` @@ -809,7 +809,7 @@ linked to a Square account. ```typescript await client.bankAccounts.get({ - bankAccountId: "bank_account_id", + bank_account_id: "bank_account_id", }); ``` @@ -884,7 +884,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.bookings.list(); +let page = await client.bookings.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -1035,7 +1035,7 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` await client.bookings.searchAvailability({ query: { filter: { - startAtRange: {}, + start_at_range: {}, }, }, }); @@ -1105,7 +1105,7 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` ```typescript await client.bookings.bulkRetrieveBookings({ - bookingIds: ["booking_ids"], + booking_ids: ["booking_ids"], }); ``` @@ -1225,7 +1225,7 @@ Retrieves a seller's location booking profile. ```typescript await client.bookings.retrieveLocationBookingProfile({ - locationId: "location_id", + location_id: "location_id", }); ``` @@ -1290,7 +1290,7 @@ Retrieves one or more team members' booking profiles. ```typescript await client.bookings.bulkRetrieveTeamMemberBookingProfiles({ - teamMemberIds: ["team_member_ids"], + team_member_ids: ["team_member_ids"], }); ``` @@ -1358,7 +1358,7 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` ```typescript await client.bookings.get({ - bookingId: "booking_id", + booking_id: "booking_id", }); ``` @@ -1429,7 +1429,7 @@ or _Appointments Premium_. ```typescript await client.bookings.update({ - bookingId: "booking_id", + booking_id: "booking_id", booking: {}, }); ``` @@ -1501,7 +1501,7 @@ or _Appointments Premium_. ```typescript await client.bookings.cancel({ - bookingId: "booking_id", + booking_id: "booking_id", }); ``` @@ -1574,7 +1574,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.cards.list(); +let page = await client.cards.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -1641,20 +1641,20 @@ Adds a card on file to an existing merchant. ```typescript await client.cards.create({ - idempotencyKey: "4935a656-a929-4792-b97c-8848be85c27c", - sourceId: "cnon:uIbfJXhXETSP197M3GB", + idempotency_key: "4935a656-a929-4792-b97c-8848be85c27c", + source_id: "cnon:uIbfJXhXETSP197M3GB", card: { - cardholderName: "Amelia Earhart", - billingAddress: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 600", + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", + administrative_district_level_1: "NY", + postal_code: "10003", country: "US", }, - customerId: "VDKXEEKPJN48QDG3BGGFAK05P8", - referenceId: "user-id-1", + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + reference_id: "user-id-1", }, }); ``` @@ -1720,7 +1720,7 @@ Retrieves details for a specific Card. ```typescript await client.cards.get({ - cardId: "card_id", + card_id: "card_id", }); ``` @@ -1786,7 +1786,7 @@ Disabling an already disabled card is allowed but has no effect. ```typescript await client.cards.disable({ - cardId: "card_id", + card_id: "card_id", }); ``` @@ -1866,7 +1866,7 @@ delete requests are rejected with the `429` error code. ```typescript await client.catalog.batchDelete({ - objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], }); ``` @@ -1936,8 +1936,8 @@ any [CatalogTax](entity:CatalogTax) objects that apply to it. ```typescript await client.catalog.batchGet({ - objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], - includeRelatedObjects: true, + object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + include_related_objects: true, }); ``` @@ -2014,7 +2014,7 @@ update requests are rejected with the `429` error code. ```typescript await client.catalog.batchUpsert({ - idempotencyKey: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + idempotency_key: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", batches: [ { objects: [ @@ -2169,7 +2169,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.catalog.list(); +let page = await client.catalog.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -2244,11 +2244,11 @@ endpoint in the following aspects: ```typescript await client.catalog.search({ - objectTypes: ["ITEM"], + object_types: ["ITEM"], query: { - prefixQuery: { - attributeName: "name", - attributePrefix: "tea", + prefix_query: { + attribute_name: "name", + attribute_prefix: "tea", }, }, limit: 100, @@ -2324,31 +2324,31 @@ endpoint in the following aspects: ```typescript await client.catalog.searchItems({ - textFilter: "red", - categoryIds: ["WINE_CATEGORY_ID"], - stockLevels: ["OUT", "LOW"], - enabledLocationIds: ["ATL_LOCATION_ID"], + text_filter: "red", + category_ids: ["WINE_CATEGORY_ID"], + stock_levels: ["OUT", "LOW"], + enabled_location_ids: ["ATL_LOCATION_ID"], limit: 100, - sortOrder: "ASC", - productTypes: ["REGULAR"], - customAttributeFilters: [ + sort_order: "ASC", + product_types: ["REGULAR"], + custom_attribute_filters: [ { - customAttributeDefinitionId: "VEGAN_DEFINITION_ID", - boolFilter: true, + custom_attribute_definition_id: "VEGAN_DEFINITION_ID", + bool_filter: true, }, { - customAttributeDefinitionId: "BRAND_DEFINITION_ID", - stringFilter: "Dark Horse", + custom_attribute_definition_id: "BRAND_DEFINITION_ID", + string_filter: "Dark Horse", }, { key: "VINTAGE", - numberFilter: { + number_filter: { min: "min", max: "max", }, }, { - customAttributeDefinitionId: "VARIETAL_DEFINITION_ID", + custom_attribute_definition_id: "VARIETAL_DEFINITION_ID", }, ], }); @@ -2417,9 +2417,9 @@ to perform an upsert on the entire item. ```typescript await client.catalog.updateItemModifierLists({ - itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - modifierListsToEnable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - modifierListsToDisable: ["7WRC16CJZDVLSNDQ35PP6YAD"], + item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifier_lists_to_enable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifier_lists_to_disable: ["7WRC16CJZDVLSNDQ35PP6YAD"], }); ``` @@ -2486,9 +2486,9 @@ upsert on the entire item. ```typescript await client.catalog.updateItemTaxes({ - itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - taxesToEnable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], - taxesToDisable: ["AQCEGCEBBQONINDOHRGZISEX"], + item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + taxes_to_enable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + taxes_to_disable: ["AQCEGCEBBQONINDOHRGZISEX"], }); ``` @@ -2564,7 +2564,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.customers.list(); +let page = await client.customers.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -2639,19 +2639,19 @@ endpoint: ```typescript await client.customers.create({ - givenName: "Amelia", - familyName: "Earhart", - emailAddress: "Amelia.Earhart@example.com", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", address: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 600", + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", + administrative_district_level_1: "NY", + postal_code: "10003", country: "US", }, - phoneNumber: "+1-212-555-4240", - referenceId: "YOUR_REFERENCE_ID", + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", note: "a customer", }); ``` @@ -2728,35 +2728,35 @@ You must provide at least one of the following values in each create request: await client.customers.batchCreate({ customers: { "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { - givenName: "Amelia", - familyName: "Earhart", - emailAddress: "Amelia.Earhart@example.com", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", address: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 600", + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", + administrative_district_level_1: "NY", + postal_code: "10003", country: "US", }, - phoneNumber: "+1-212-555-4240", - referenceId: "YOUR_REFERENCE_ID", + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", note: "a customer", }, "d1689f23-b25d-4932-b2f0-aed00f5e2029": { - givenName: "Marie", - familyName: "Curie", - emailAddress: "Marie.Curie@example.com", + given_name: "Marie", + family_name: "Curie", + email_address: "Marie.Curie@example.com", address: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 601", + address_line_1: "500 Electric Ave", + address_line_2: "Suite 601", locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", + administrative_district_level_1: "NY", + postal_code: "10003", country: "US", }, - phoneNumber: "+1-212-444-4240", - referenceId: "YOUR_REFERENCE_ID", + phone_number: "+1-212-444-4240", + reference_id: "YOUR_REFERENCE_ID", note: "another customer", }, }, @@ -2826,7 +2826,7 @@ The endpoint takes a list of customer IDs and returns a map of responses. ```typescript await client.customers.bulkDeleteCustomers({ - customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], + customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], }); ``` @@ -2893,7 +2893,7 @@ This endpoint takes a list of customer IDs and returns a map of responses. ```typescript await client.customers.bulkRetrieveCustomers({ - customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], + customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], }); ``` @@ -2962,14 +2962,14 @@ This endpoint takes a map of individual update requests and returns a map of res await client.customers.bulkUpdateCustomers({ customers: { "8DDA5NZVBZFGAX0V3HPF81HHE0": { - emailAddress: "New.Amelia.Earhart@example.com", + email_address: "New.Amelia.Earhart@example.com", note: "updated customer note", - version: 2, + version: BigInt("2"), }, N18CPRVXR5214XPBBA6BZQWF3C: { - givenName: "Marie", - familyName: "Curie", - version: 0, + given_name: "Marie", + family_name: "Curie", + version: BigInt("0"), }, }, }); @@ -3044,21 +3044,21 @@ profiles can take closer to one minute or longer, especially during network inci ```typescript await client.customers.search({ - limit: 2, + limit: BigInt("2"), query: { filter: { - creationSource: { + creation_source: { values: ["THIRD_PARTY"], rule: "INCLUDE", }, - createdAt: { - startAt: "2018-01-01T00:00:00-00:00", - endAt: "2018-02-01T00:00:00-00:00", + created_at: { + start_at: "2018-01-01T00:00:00-00:00", + end_at: "2018-02-01T00:00:00-00:00", }, - emailAddress: { + email_address: { fuzzy: "example.com", }, - groupIds: { + group_ids: { all: ["545AXB44B4XXWMVQ4W8SBT3HHF"], }, }, @@ -3131,7 +3131,7 @@ Returns details for a single customer. ```typescript await client.customers.get({ - customerId: "customer_id", + customer_id: "customer_id", }); ``` @@ -3199,10 +3199,10 @@ To update a customer profile that was created by merging existing profiles, you ```typescript await client.customers.update({ - customerId: "customer_id", - emailAddress: "New.Amelia.Earhart@example.com", + customer_id: "customer_id", + email_address: "New.Amelia.Earhart@example.com", note: "updated customer note", - version: 2, + version: BigInt("2"), }); ``` @@ -3269,7 +3269,7 @@ To delete a customer profile that was created by merging existing profiles, you ```typescript await client.customers.delete({ - customerId: "customer_id", + customer_id: "customer_id", }); ``` @@ -3342,7 +3342,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.devices.list(); +let page = await client.devices.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -3409,7 +3409,7 @@ Retrieves Device with the associated `device_id`. ```typescript await client.devices.get({ - deviceId: "device_id", + device_id: "device_id", }); ``` @@ -3481,7 +3481,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.disputes.list(); +let page = await client.disputes.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -3548,7 +3548,7 @@ Returns details about a specific dispute. ```typescript await client.disputes.get({ - disputeId: "dispute_id", + dispute_id: "dispute_id", }); ``` @@ -3617,7 +3617,7 @@ does not have sufficient funds, Square debits the associated bank account. ```typescript await client.disputes.accept({ - disputeId: "dispute_id", + dispute_id: "dispute_id", }); ``` @@ -3683,7 +3683,7 @@ multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats ```typescript await client.disputes.createEvidenceFile({ - disputeId: "dispute_id", + dispute_id: "dispute_id", }); ``` @@ -3748,10 +3748,10 @@ Uploads text to use as evidence for a dispute challenge. ```typescript await client.disputes.createEvidenceText({ - disputeId: "dispute_id", - idempotencyKey: "ed3ee3933d946f1514d505d173c82648", - evidenceType: "TRACKING_NUMBER", - evidenceText: "1Z8888888888888888", + dispute_id: "dispute_id", + idempotency_key: "ed3ee3933d946f1514d505d173c82648", + evidence_type: "TRACKING_NUMBER", + evidence_text: "1Z8888888888888888", }); ``` @@ -3822,7 +3822,7 @@ a dispute after submission. ```typescript await client.disputes.submitEvidence({ - disputeId: "dispute_id", + dispute_id: "dispute_id", }); ``` @@ -3892,7 +3892,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.employees.list(); +let page = await client.employees.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -4270,7 +4270,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.giftCards.list(); +let page = await client.giftCards.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -4341,9 +4341,9 @@ to refund a payment to the new gift card. ```typescript await client.giftCards.create({ - idempotencyKey: "NC9Tm69EjbjtConu", - locationId: "81FN9BNFZTKS4", - giftCard: { + idempotency_key: "NC9Tm69EjbjtConu", + location_id: "81FN9BNFZTKS4", + gift_card: { type: "DIGITAL", }, }); @@ -4540,8 +4540,8 @@ Links a customer to a gift card, which is also referred to as adding a card on f ```typescript await client.giftCards.linkCustomer({ - giftCardId: "gift_card_id", - customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW", + gift_card_id: "gift_card_id", + customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW", }); ``` @@ -4606,8 +4606,8 @@ Unlinks a customer from a gift card, which is also referred to as removing a car ```typescript await client.giftCards.unlinkCustomer({ - giftCardId: "gift_card_id", - customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW", + gift_card_id: "gift_card_id", + customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW", }); ``` @@ -4740,7 +4740,7 @@ is updated to conform to the standard convention. ```typescript await client.inventory.deprecatedGetAdjustment({ - adjustmentId: "adjustment_id", + adjustment_id: "adjustment_id", }); ``` @@ -4806,7 +4806,7 @@ with the provided `adjustment_id`. ```typescript await client.inventory.getAdjustment({ - adjustmentId: "adjustment_id", + adjustment_id: "adjustment_id", }); ``` @@ -4872,22 +4872,22 @@ is updated to conform to the standard convention. ```typescript await client.inventory.deprecatedBatchChange({ - idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", changes: [ { type: "PHYSICAL_COUNT", - physicalCount: { - referenceId: "1536bfbf-efed-48bf-b17d-a197141b2a92", - catalogObjectId: "W62UWFY35CWMYGVWK6TWJDNI", + physical_count: { + reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", state: "IN_STOCK", - locationId: "C6W5YS5QM06F5", + location_id: "C6W5YS5QM06F5", quantity: "53", - teamMemberId: "LRK57NSQ5X7PUD05", - occurredAt: "2016-11-16T22:25:24.878Z", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", }, }, ], - ignoreUnchangedCounts: true, + ignore_unchanged_counts: true, }); ``` @@ -4953,12 +4953,12 @@ is updated to conform to the standard convention. ```typescript await client.inventory.deprecatedBatchGetChanges({ - catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - locationIds: ["C6W5YS5QM06F5"], + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["C6W5YS5QM06F5"], types: ["PHYSICAL_COUNT"], states: ["IN_STOCK"], - updatedAfter: "2016-11-01T00:00:00.000Z", - updatedBefore: "2016-12-01T00:00:00.000Z", + updated_after: "2016-11-01T00:00:00.000Z", + updated_before: "2016-12-01T00:00:00.000Z", }); ``` @@ -5024,9 +5024,9 @@ is updated to conform to the standard convention. ```typescript await client.inventory.deprecatedBatchGetCounts({ - catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - locationIds: ["59TNP9SA8VGDA"], - updatedAfter: "2016-11-16T00:00:00.000Z", + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["59TNP9SA8VGDA"], + updated_after: "2016-11-16T00:00:00.000Z", }); ``` @@ -5095,22 +5095,22 @@ On failure: returns a list of related errors. ```typescript await client.inventory.batchCreateChanges({ - idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", changes: [ { type: "PHYSICAL_COUNT", - physicalCount: { - referenceId: "1536bfbf-efed-48bf-b17d-a197141b2a92", - catalogObjectId: "W62UWFY35CWMYGVWK6TWJDNI", + physical_count: { + reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", state: "IN_STOCK", - locationId: "C6W5YS5QM06F5", + location_id: "C6W5YS5QM06F5", quantity: "53", - teamMemberId: "LRK57NSQ5X7PUD05", - occurredAt: "2016-11-16T22:25:24.878Z", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", }, }, ], - ignoreUnchangedCounts: true, + ignore_unchanged_counts: true, }); ``` @@ -5182,25 +5182,25 @@ that cannot be handled by other, simpler endpoints. ```typescript const response = await client.inventory.batchGetChanges({ - catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - locationIds: ["C6W5YS5QM06F5"], + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["C6W5YS5QM06F5"], types: ["PHYSICAL_COUNT"], states: ["IN_STOCK"], - updatedAfter: "2016-11-01T00:00:00.000Z", - updatedBefore: "2016-12-01T00:00:00.000Z", + updated_after: "2016-11-01T00:00:00.000Z", + updated_before: "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"], +let page = await client.inventory.batchGetChanges({ + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["C6W5YS5QM06F5"], types: ["PHYSICAL_COUNT"], states: ["IN_STOCK"], - updatedAfter: "2016-11-01T00:00:00.000Z", - updatedBefore: "2016-12-01T00:00:00.000Z", + updated_after: "2016-11-01T00:00:00.000Z", + updated_before: "2016-12-01T00:00:00.000Z", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5278,19 +5278,19 @@ in response to receiving a Webhook notification. ```typescript const response = await client.inventory.batchGetCounts({ - catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - locationIds: ["59TNP9SA8VGDA"], - updatedAfter: "2016-11-16T00:00:00.000Z", + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["59TNP9SA8VGDA"], + updated_after: "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", +let page = await client.inventory.batchGetCounts({ + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["59TNP9SA8VGDA"], + updated_after: "2016-11-16T00:00:00.000Z", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5359,7 +5359,7 @@ is updated to conform to the standard convention. ```typescript await client.inventory.deprecatedGetPhysicalCount({ - physicalCountId: "physical_count_id", + physical_count_id: "physical_count_id", }); ``` @@ -5425,7 +5425,7 @@ object with the provided `physical_count_id`. ```typescript await client.inventory.getPhysicalCount({ - physicalCountId: "physical_count_id", + physical_count_id: "physical_count_id", }); ``` @@ -5491,7 +5491,7 @@ with the provided `transfer_id`. ```typescript await client.inventory.getTransfer({ - transferId: "transfer_id", + transfer_id: "transfer_id", }); ``` @@ -5559,15 +5559,15 @@ For more sophisticated queries, use a batch endpoint. ```typescript const response = await client.inventory.get({ - catalogObjectId: "catalog_object_id", + catalog_object_id: "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", +let page = await client.inventory.get({ + catalog_object_id: "catalog_object_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5647,15 +5647,15 @@ sophisticated queries, use a batch endpoint. ```typescript const response = await client.inventory.changes({ - catalogObjectId: "catalog_object_id", + catalog_object_id: "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", +let page = await client.inventory.changes({ + catalog_object_id: "catalog_object_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5727,15 +5727,15 @@ use in a subsequent request to retrieve the next set of invoices. ```typescript const response = await client.invoices.list({ - locationId: "location_id", + location_id: "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", +let page = await client.invoices.list({ + location_id: "location_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5808,38 +5808,38 @@ You must publish the invoice before Square can process it (send it to the custom ```typescript await client.invoices.create({ invoice: { - locationId: "ES0RJRZYEC39A", - orderId: "CAISENgvlJ6jLWAzERDzjyHVybY", - primaryRecipient: { - customerId: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", }, - paymentRequests: [ + payment_requests: [ { - requestType: "BALANCE", - dueDate: "2030-01-24", - tippingEnabled: true, - automaticPaymentSource: "NONE", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", reminders: [ { - relativeScheduledDays: -1, + relative_scheduled_days: -1, message: "Your invoice is due tomorrow", }, ], }, ], - deliveryMethod: "EMAIL", - invoiceNumber: "inv-100", + delivery_method: "EMAIL", + invoice_number: "inv-100", title: "Event Planning Services", description: "We appreciate your business!", - scheduledAt: "2030-01-13T10:00:00Z", - acceptedPaymentMethods: { + scheduled_at: "2030-01-13T10:00:00Z", + accepted_payment_methods: { card: true, - squareGiftCard: false, - bankAccount: false, - buyNowPayLater: false, - cashAppPay: false, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, }, - customFields: [ + custom_fields: [ { label: "Event Reference Number", value: "Ref. #1234", @@ -5851,10 +5851,10 @@ await client.invoices.create({ placement: "BELOW_LINE_ITEMS", }, ], - saleOrServiceDate: "2030-01-24", - storePaymentMethodEnabled: false, + sale_or_service_date: "2030-01-24", + store_payment_method_enabled: false, }, - idempotencyKey: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4", + idempotency_key: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4", }); ``` @@ -5927,8 +5927,8 @@ that you use in a subsequent request to retrieve the next set of invoices. await client.invoices.search({ query: { filter: { - locationIds: ["ES0RJRZYEC39A"], - customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"], + location_ids: ["ES0RJRZYEC39A"], + customer_ids: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"], }, sort: { field: "INVOICE_SORT_DATE", @@ -6000,7 +6000,7 @@ Retrieves an invoice by invoice ID. ```typescript await client.invoices.get({ - invoiceId: "invoice_id", + invoice_id: "invoice_id", }); ``` @@ -6068,17 +6068,17 @@ Some restrictions apply to updating invoices. For example, you cannot change the ```typescript await client.invoices.update({ - invoiceId: "invoice_id", + invoice_id: "invoice_id", invoice: { version: 1, - paymentRequests: [ + payment_requests: [ { uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", - tippingEnabled: false, + tipping_enabled: false, }, ], }, - idempotencyKey: "4ee82288-0910-499e-ab4c-5d0071dad1be", + idempotency_key: "4ee82288-0910-499e-ab4c-5d0071dad1be", }); ``` @@ -6145,7 +6145,7 @@ invoice (you cannot delete a published invoice, including one that is scheduled ```typescript await client.invoices.delete({ - invoiceId: "invoice_id", + invoice_id: "invoice_id", }); ``` @@ -6217,7 +6217,7 @@ in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. ```typescript await client.invoices.createInvoiceAttachment({ - invoiceId: "invoice_id", + invoice_id: "invoice_id", }); ``` @@ -6283,8 +6283,8 @@ from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. ```typescript await client.invoices.deleteInvoiceAttachment({ - invoiceId: "invoice_id", - attachmentId: "attachment_id", + invoice_id: "invoice_id", + attachment_id: "attachment_id", }); ``` @@ -6352,7 +6352,7 @@ You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID` ```typescript await client.invoices.cancel({ - invoiceId: "invoice_id", + invoice_id: "invoice_id", version: 0, }); ``` @@ -6431,9 +6431,9 @@ and `PAYMENTS_WRITE` are required when publishing invoices configured for card-o ```typescript await client.invoices.publish({ - invoiceId: "invoice_id", + invoice_id: "invoice_id", version: 1, - idempotencyKey: "32da42d0-1997-41b0-826b-f09464fc2c2e", + idempotency_key: "32da42d0-1997-41b0-826b-f09464fc2c2e", }); ``` @@ -6507,16 +6507,16 @@ The following `draft_shift_details` fields are required: ```typescript await client.labor.createScheduledShift({ - idempotencyKey: "HIDSNG5KS478L", - scheduledShift: { - draftShiftDetails: { - teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - locationId: "PAA1RJZZKXBFG", - jobId: "FzbJAtt9qEWncK1BWgVCxQ6M", - startAt: "2019-01-25T03:11:00-05:00", - endAt: "2019-01-25T13:11:00-05:00", + idempotency_key: "HIDSNG5KS478L", + scheduled_shift: { + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", notes: "Dont forget to prep the vegetables", - isDeleted: false, + is_deleted: false, }, }, }); @@ -6588,10 +6588,10 @@ The minimum `start_at` and maximum `end_at` timestamps of all shifts in a ```typescript await client.labor.bulkPublishScheduledShifts({ - scheduledShifts: { + scheduled_shifts: { key: {}, }, - scheduledShiftNotificationAudience: "AFFECTED", + scheduled_shift_notification_audience: "AFFECTED", }); ``` @@ -6659,7 +6659,7 @@ By default, results are sorted by `start_at` in ascending order. await client.labor.searchScheduledShifts({ query: { filter: { - assignmentStatus: "ASSIGNED", + assignment_status: "ASSIGNED", }, sort: { field: "CREATED_AT", @@ -6807,15 +6807,15 @@ and then publish the shift. ```typescript await client.labor.updateScheduledShift({ id: "id", - scheduledShift: { - draftShiftDetails: { - teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - locationId: "PAA1RJZZKXBFG", - jobId: "FzbJAtt9qEWncK1BWgVCxQ6M", - startAt: "2019-03-25T03:11:00-05:00", - endAt: "2019-03-25T13:18:00-05:00", + scheduled_shift: { + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", notes: "Dont forget to prep the vegetables", - isDeleted: false, + is_deleted: false, }, version: 1, }, @@ -6885,9 +6885,9 @@ Publishes a scheduled shift. When a scheduled shift is published, Square keeps t ```typescript await client.labor.publishScheduledShift({ id: "id", - idempotencyKey: "HIDSNG5KS478L", + idempotency_key: "HIDSNG5KS478L", version: 2, - scheduledShiftNotificationAudience: "ALL", + scheduled_shift_notification_audience: "ALL", }); ``` @@ -6969,32 +6969,32 @@ the `Timecard.end_at`, or both. ```typescript await client.labor.createTimecard({ - idempotencyKey: "HIDSNG5KS478L", + idempotency_key: "HIDSNG5KS478L", timecard: { - locationId: "PAA1RJZZKXBFG", - startAt: "2019-01-25T03:11:00-05:00", - endAt: "2019-01-25T13:11:00-05:00", + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", wage: { title: "Barista", - hourlyRate: { - amount: 1100, + hourly_rate: { + amount: BigInt("1100"), currency: "USD", }, - tipEligible: true, + tip_eligible: true, }, breaks: [ { - startAt: "2019-01-25T06:11:00-05:00", - endAt: "2019-01-25T06:16:00-05:00", - breakTypeId: "REGS1EQR1TPZ5", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", name: "Tea Break", - expectedDuration: "PT5M", - isPaid: true, + expected_duration: "PT5M", + is_paid: true, }, ], - teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - declaredCashTipMoney: { - amount: 500, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), currency: "USD", }, }, @@ -7079,12 +7079,12 @@ await client.labor.searchTimecards({ query: { filter: { workday: { - dateRange: { - startDate: "2019-01-20", - endDate: "2019-02-03", + date_range: { + start_date: "2019-01-20", + end_date: "2019-02-03", }, - matchTimecardsBy: "START_AT", - defaultTimezone: "America/Los_Angeles", + match_timecards_by: "START_AT", + default_timezone: "America/Los_Angeles", }, }, }, @@ -7226,33 +7226,33 @@ set on each `Break`. await client.labor.updateTimecard({ id: "id", timecard: { - locationId: "PAA1RJZZKXBFG", - startAt: "2019-01-25T03:11:00-05:00", - endAt: "2019-01-25T13:11:00-05:00", + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", wage: { title: "Bartender", - hourlyRate: { - amount: 1500, + hourly_rate: { + amount: BigInt("1500"), currency: "USD", }, - tipEligible: true, + tip_eligible: true, }, breaks: [ { id: "X7GAQYVVRRG6P", - startAt: "2019-01-25T06:11:00-05:00", - endAt: "2019-01-25T06:16:00-05:00", - breakTypeId: "REGS1EQR1TPZ5", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", name: "Tea Break", - expectedDuration: "PT5M", - isPaid: true, + expected_duration: "PT5M", + is_paid: true, }, ], status: "CLOSED", version: 1, - teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - declaredCashTipMoney: { - amount: 500, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), currency: "USD", }, }, @@ -7452,10 +7452,10 @@ await client.locations.create({ location: { name: "Midtown", address: { - addressLine1: "1234 Peachtree St. NE", + address_line_1: "1234 Peachtree St. NE", locality: "Atlanta", - administrativeDistrictLevel1: "GA", - postalCode: "30309", + administrative_district_level_1: "GA", + postal_code: "30309", }, description: "Midtown Atlanta store", }, @@ -7524,7 +7524,7 @@ as the location ID to retrieve details of the [main location](https://developer. ```typescript await client.locations.get({ - locationId: "location_id", + location_id: "location_id", }); ``` @@ -7589,24 +7589,24 @@ Updates a [location](https://developer.squareup.com/docs/locations-api). ```typescript await client.locations.update({ - locationId: "location_id", + location_id: "location_id", location: { - businessHours: { + business_hours: { periods: [ { - dayOfWeek: "FRI", - startLocalTime: "07:00", - endLocalTime: "18:00", + day_of_week: "FRI", + start_local_time: "07:00", + end_local_time: "18:00", }, { - dayOfWeek: "SAT", - startLocalTime: "07:00", - endLocalTime: "18:00", + day_of_week: "SAT", + start_local_time: "07:00", + end_local_time: "18:00", }, { - dayOfWeek: "SUN", - startLocalTime: "09:00", - endLocalTime: "15:00", + day_of_week: "SUN", + start_local_time: "09:00", + end_local_time: "15:00", }, ], }, @@ -7681,45 +7681,45 @@ For more information, see [Checkout API highlights](https://developer.squareup.c ```typescript await client.locations.checkouts({ - locationId: "location_id", - idempotencyKey: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + location_id: "location_id", + idempotency_key: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", order: { order: { - locationId: "location_id", - referenceId: "reference_id", - customerId: "customer_id", - lineItems: [ + location_id: "location_id", + reference_id: "reference_id", + customer_id: "customer_id", + line_items: [ { name: "Printed T Shirt", quantity: "2", - appliedTaxes: [ + applied_taxes: [ { - taxUid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3", + tax_uid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3", }, ], - appliedDiscounts: [ + applied_discounts: [ { - discountUid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", + discount_uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", }, ], - basePriceMoney: { - amount: 1500, + base_price_money: { + amount: BigInt("1500"), currency: "USD", }, }, { name: "Slim Jeans", quantity: "1", - basePriceMoney: { - amount: 2500, + base_price_money: { + amount: BigInt("2500"), currency: "USD", }, }, { name: "Woven Sweater", quantity: "3", - basePriceMoney: { - amount: 3500, + base_price_money: { + amount: BigInt("3500"), currency: "USD", }, }, @@ -7736,36 +7736,36 @@ await client.locations.checkouts({ { uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", type: "FIXED_AMOUNT", - amountMoney: { - amount: 100, + amount_money: { + amount: BigInt("100"), currency: "USD", }, scope: "LINE_ITEM", }, ], }, - idempotencyKey: "12ae1696-z1e3-4328-af6d-f1e04d947gd4", + idempotency_key: "12ae1696-z1e3-4328-af6d-f1e04d947gd4", }, - askForShippingAddress: true, - merchantSupportEmail: "merchant+support@website.com", - prePopulateBuyerEmail: "example@email.com", - prePopulateShippingAddress: { - addressLine1: "1455 Market St.", - addressLine2: "Suite 600", + ask_for_shipping_address: true, + merchant_support_email: "merchant+support@website.com", + pre_populate_buyer_email: "example@email.com", + pre_populate_shipping_address: { + address_line_1: "1455 Market St.", + address_line_2: "Suite 600", locality: "San Francisco", - administrativeDistrictLevel1: "CA", - postalCode: "94103", + administrative_district_level_1: "CA", + postal_code: "94103", country: "US", - firstName: "Jane", - lastName: "Doe", + first_name: "Jane", + last_name: "Doe", }, - redirectUrl: "https://merchant.website.com/order-confirm", - additionalRecipients: [ + redirect_url: "https://merchant.website.com/order-confirm", + additional_recipients: [ { - locationId: "057P5VYJ4A5X1", + location_id: "057P5VYJ4A5X1", description: "Application fees", - amountMoney: { - amount: 60, + amount_money: { + amount: BigInt("60"), currency: "USD", }, }, @@ -7845,8 +7845,8 @@ Search results are sorted by `created_at` in descending order. await client.loyalty.searchEvents({ query: { filter: { - orderFilter: { - orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + order_filter: { + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", }, }, }, @@ -7931,7 +7931,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.merchants.list(); +let page = await client.merchants.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -7998,7 +7998,7 @@ Retrieves the `Merchant` object for the given `merchant_id`. ```typescript await client.merchants.get({ - merchantId: "merchant_id", + merchant_id: "merchant_id", }); ``` @@ -8065,7 +8065,7 @@ Retrieves the location-level settings for a Square-hosted checkout page. ```typescript await client.checkout.retrieveLocationSettings({ - locationId: "location_id", + location_id: "location_id", }); ``` @@ -8130,8 +8130,8 @@ Updates the location-level settings for a Square-hosted checkout page. ```typescript await client.checkout.updateLocationSettings({ - locationId: "location_id", - locationSettings: {}, + location_id: "location_id", + location_settings: {}, }); ``` @@ -8251,7 +8251,7 @@ Updates the merchant-level settings for a Square-hosted checkout page. ```typescript await client.checkout.updateMerchantSettings({ - merchantSettings: {}, + merchant_settings: {}, }); ``` @@ -8325,28 +8325,28 @@ You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrd ```typescript await client.orders.create({ order: { - locationId: "057P5VYJ4A5X1", - referenceId: "my-order-001", - lineItems: [ + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + line_items: [ { name: "New York Strip Steak", quantity: "1", - basePriceMoney: { - amount: 1599, + base_price_money: { + amount: BigInt("1599"), currency: "USD", }, }, { quantity: "2", - catalogObjectId: "BEMYCSMIJL46OCDV4KYIKXIB", + catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", modifiers: [ { - catalogObjectId: "CHQX7Y4KY6N5KINJKZCFURPZ", + catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ", }, ], - appliedDiscounts: [ + applied_discounts: [ { - discountUid: "one-dollar-off", + discount_uid: "one-dollar-off", }, ], }, @@ -8368,21 +8368,21 @@ await client.orders.create({ }, { uid: "membership-discount", - catalogObjectId: "DB7L55ZH2BGWI4H23ULIWOQ7", + catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", scope: "ORDER", }, { uid: "one-dollar-off", name: "Sale - $1.00 off", - amountMoney: { - amount: 100, + amount_money: { + amount: BigInt("100"), currency: "USD", }, scope: "LINE_ITEM", }, ], }, - idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", + idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", }); ``` @@ -8449,8 +8449,8 @@ If a given order ID does not exist, the ID is ignored instead of generating an e ```typescript await client.orders.batchGet({ - locationId: "057P5VYJ4A5X1", - orderIds: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"], + location_id: "057P5VYJ4A5X1", + order_ids: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"], }); ``` @@ -8516,21 +8516,21 @@ Enables applications to preview order pricing without creating an order. ```typescript await client.orders.calculate({ order: { - locationId: "D7AVYMEAPJ3A3", - lineItems: [ + location_id: "D7AVYMEAPJ3A3", + line_items: [ { name: "Item 1", quantity: "1", - basePriceMoney: { - amount: 500, + base_price_money: { + amount: BigInt("500"), currency: "USD", }, }, { name: "Item 2", quantity: "2", - basePriceMoney: { - amount: 300, + base_price_money: { + amount: BigInt("300"), currency: "USD", }, }, @@ -8608,9 +8608,9 @@ only the core fields (such as line items, taxes, and discounts) copied from the ```typescript await client.orders.clone({ - orderId: "ZAISEM52YcpmcWAzERDOyiWS123", + order_id: "ZAISEM52YcpmcWAzERDOyiWS123", version: 3, - idempotencyKey: "UNIQUE_STRING", + idempotency_key: "UNIQUE_STRING", }); ``` @@ -8691,26 +8691,26 @@ not the time it was subsequently transmitted to Square. ```typescript await client.orders.search({ - locationIds: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], + location_ids: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], query: { filter: { - stateFilter: { + state_filter: { states: ["COMPLETED"], }, - dateTimeFilter: { - closedAt: { - startAt: "2018-03-03T20:00:00+00:00", - endAt: "2019-03-04T21:54:45+00:00", + date_time_filter: { + closed_at: { + start_at: "2018-03-03T20:00:00+00:00", + end_at: "2019-03-04T21:54:45+00:00", }, }, }, sort: { - sortField: "CLOSED_AT", - sortOrder: "DESC", + sort_field: "CLOSED_AT", + sort_order: "DESC", }, }, limit: 3, - returnEntries: true, + return_entries: true, }); ``` @@ -8775,7 +8775,7 @@ Retrieves an [Order](entity:Order) by ID. ```typescript await client.orders.get({ - orderId: "order_id", + order_id: "order_id", }); ``` @@ -8854,24 +8854,24 @@ To pay for an order, see ```typescript await client.orders.update({ - orderId: "order_id", + order_id: "order_id", order: { - locationId: "location_id", - lineItems: [ + location_id: "location_id", + line_items: [ { uid: "cookie_uid", name: "COOKIE", quantity: "2", - basePriceMoney: { - amount: 200, + base_price_money: { + amount: BigInt("200"), currency: "USD", }, }, ], version: 1, }, - fieldsToClear: ["discounts"], - idempotencyKey: "UNIQUE_STRING", + fields_to_clear: ["discounts"], + idempotency_key: "UNIQUE_STRING", }); ``` @@ -8948,9 +8948,9 @@ Using a delayed capture payment with `PayOrder` completes the approved payment. ```typescript await client.orders.pay({ - orderId: "order_id", - idempotencyKey: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", - paymentIds: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"], + order_id: "order_id", + idempotency_key: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + payment_ids: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"], }); ``` @@ -9027,7 +9027,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.payments.list(); +let page = await client.payments.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -9101,20 +9101,20 @@ The endpoint creates a ```typescript await client.payments.create({ - sourceId: "ccof:GaJGNaZa8x4OgDJn4GB", - idempotencyKey: "7b0f3ec5-086a-4871-8f13-3c81b3875218", - amountMoney: { - amount: 1000, + source_id: "ccof:GaJGNaZa8x4OgDJn4GB", + idempotency_key: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + amount_money: { + amount: BigInt("1000"), currency: "USD", }, - appFeeMoney: { - amount: 10, + app_fee_money: { + amount: BigInt("10"), currency: "USD", }, autocomplete: true, - customerId: "W92WH6P11H4Z77CTET0RNTGFW8", - locationId: "L88917AVBK2S5", - referenceId: "123456", + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + location_id: "L88917AVBK2S5", + reference_id: "123456", note: "Brief description", }); ``` @@ -9190,7 +9190,7 @@ returns successfully. ```typescript await client.payments.cancelByIdempotencyKey({ - idempotencyKey: "a7e36d40-d24b-11e8-b568-0800200c9a66", + idempotency_key: "a7e36d40-d24b-11e8-b568-0800200c9a66", }); ``` @@ -9255,7 +9255,7 @@ Retrieves details for a specific payment. ```typescript await client.payments.get({ - paymentId: "payment_id", + payment_id: "payment_id", }); ``` @@ -9321,19 +9321,19 @@ You can update the `amount_money` and `tip_money` using this endpoint. ```typescript await client.payments.update({ - paymentId: "payment_id", + payment_id: "payment_id", payment: { - amountMoney: { - amount: 1000, + amount_money: { + amount: BigInt("1000"), currency: "USD", }, - tipMoney: { - amount: 100, + tip_money: { + amount: BigInt("100"), currency: "USD", }, - versionToken: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o", + version_token: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o", }, - idempotencyKey: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de", + idempotency_key: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de", }); ``` @@ -9399,7 +9399,7 @@ the APPROVED `status`. ```typescript await client.payments.cancel({ - paymentId: "payment_id", + payment_id: "payment_id", }); ``` @@ -9467,7 +9467,7 @@ You can use this endpoint to complete a payment with the APPROVED `status`. ```typescript await client.payments.complete({ - paymentId: "payment_id", + payment_id: "payment_id", }); ``` @@ -9541,7 +9541,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.payouts.list(); +let page = await client.payouts.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -9609,7 +9609,7 @@ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. ```typescript await client.payouts.get({ - payoutId: "payout_id", + payout_id: "payout_id", }); ``` @@ -9675,15 +9675,15 @@ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. ```typescript const response = await client.payouts.listEntries({ - payoutId: "payout_id", + payout_id: "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", +let page = await client.payouts.listEntries({ + payout_id: "payout_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -9763,7 +9763,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.refunds.list(); +let page = await client.refunds.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -9833,16 +9833,16 @@ refund of a cash or external payment. For more information, see ```typescript await client.refunds.refundPayment({ - idempotencyKey: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", - amountMoney: { - amount: 1000, + idempotency_key: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + amount_money: { + amount: BigInt("1000"), currency: "USD", }, - appFeeMoney: { - amount: 10, + app_fee_money: { + amount: BigInt("10"), currency: "USD", }, - paymentId: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + payment_id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", reason: "Example", }); ``` @@ -9908,7 +9908,7 @@ Retrieves a specific refund using the `refund_id`. ```typescript await client.refunds.get({ - refundId: "refund_id", + refund_id: "refund_id", }); ``` @@ -10038,7 +10038,7 @@ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sit ```typescript await client.snippets.get({ - siteId: "site_id", + site_id: "site_id", }); ``` @@ -10108,7 +10108,7 @@ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sit ```typescript await client.snippets.upsert({ - siteId: "site_id", + site_id: "site_id", snippet: { content: "", }, @@ -10180,7 +10180,7 @@ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sit ```typescript await client.snippets.delete({ - siteId: "site_id", + site_id: "site_id", }); ``` @@ -10254,20 +10254,20 @@ For more information, see [Create a subscription](https://developer.squareup.com ```typescript await client.subscriptions.create({ - idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", - locationId: "S8GWD5R9QB376", - planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", - startDate: "2023-06-20", - cardId: "ccof:qy5x8hHGYsgLrp4Q4GB", + idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", timezone: "America/Los_Angeles", source: { name: "My Application", }, phases: [ { - ordinal: 0, - orderTemplateId: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + ordinal: BigInt("0"), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", }, ], }); @@ -10335,9 +10335,9 @@ variation. For more information, see [Swap Subscription Plan Variations](https:/ ```typescript await client.subscriptions.bulkSwapPlan({ - newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", - oldPlanVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - locationId: "S8GWD5R9QB376", + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + old_plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + location_id: "S8GWD5R9QB376", }); ``` @@ -10417,9 +10417,9 @@ customer by subscription creation date. await client.subscriptions.search({ query: { filter: { - customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], - locationIds: ["S8GWD5R9QB376"], - sourceNames: ["My App"], + customer_ids: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + location_ids: ["S8GWD5R9QB376"], + source_names: ["My App"], }, }, }); @@ -10486,7 +10486,7 @@ Retrieves a specific subscription. ```typescript await client.subscriptions.get({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", }); ``` @@ -10552,9 +10552,9 @@ To clear a field, set its value to `null`. ```typescript await client.subscriptions.update({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", subscription: { - cardId: "{NEW CARD ID}", + card_id: "{NEW CARD ID}", }, }); ``` @@ -10620,8 +10620,8 @@ Deletes a scheduled action for a subscription. ```typescript await client.subscriptions.deleteAction({ - subscriptionId: "subscription_id", - actionId: "action_id", + subscription_id: "subscription_id", + action_id: "action_id", }); ``` @@ -10687,8 +10687,8 @@ for a subscription. ```typescript await client.subscriptions.changeBillingAnchorDate({ - subscriptionId: "subscription_id", - monthlyBillingAnchorDate: 1, + subscription_id: "subscription_id", + monthly_billing_anchor_date: 1, }); ``` @@ -10755,7 +10755,7 @@ the subscription status changes from ACTIVE to CANCELED. ```typescript await client.subscriptions.cancel({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", }); ``` @@ -10820,15 +10820,15 @@ Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions ```typescript const response = await client.subscriptions.listEvents({ - subscriptionId: "subscription_id", + subscription_id: "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", +let page = await client.subscriptions.listEvents({ + subscription_id: "subscription_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -10896,7 +10896,7 @@ Schedules a `PAUSE` action to pause an active subscription. ```typescript await client.subscriptions.pause({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", }); ``` @@ -10961,7 +10961,7 @@ Schedules a `RESUME` action to resume a paused or a deactivated subscription. ```typescript await client.subscriptions.resume({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", }); ``` @@ -11027,12 +11027,12 @@ For more information, see [Swap Subscription Plan Variations](https://developer. ```typescript await client.subscriptions.swapPlan({ - subscriptionId: "subscription_id", - newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + subscription_id: "subscription_id", + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", phases: [ { - ordinal: 0, - orderTemplateId: "uhhnjH9osVv3shUADwaC0b3hNxQZY", + ordinal: BigInt("0"), + order_template_id: "uhhnjH9osVv3shUADwaC0b3hNxQZY", }, ], }); @@ -11107,39 +11107,39 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t ```typescript await client.teamMembers.create({ - idempotencyKey: "idempotency-key-0", - teamMember: { - referenceId: "reference_id_1", + idempotency_key: "idempotency-key-0", + team_member: { + reference_id: "reference_id_1", status: "ACTIVE", - givenName: "Joe", - familyName: "Doe", - emailAddress: "joe_doe@gmail.com", - phoneNumber: "+14159283333", - assignedLocations: { - assignmentType: "EXPLICIT_LOCATIONS", - locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], }, - wageSetting: { - jobAssignments: [ + wage_setting: { + job_assignments: [ { - payType: "SALARY", - annualRate: { - amount: 3000000, + pay_type: "SALARY", + annual_rate: { + amount: BigInt("3000000"), currency: "USD", }, - weeklyHours: 40, - jobId: "FjS8x95cqHiMenw4f1NAUH4P", + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", }, { - payType: "HOURLY", - hourlyRate: { - amount: 2000, + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), currency: "USD", }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", + job_id: "VDNpRv8da51NU8qZFC5zDWpF", }, ], - isOvertimeExempt: true, + is_overtime_exempt: true, }, }, }); @@ -11211,29 +11211,29 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t ```typescript await client.teamMembers.batchCreate({ - teamMembers: { + team_members: { "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"], + team_member: { + reference_id: "reference_id_1", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["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", + team_member: { + reference_id: "reference_id_2", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", }, }, }, @@ -11306,33 +11306,33 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t ```typescript await client.teamMembers.batchUpdate({ - teamMembers: { + team_members: { "AFMwA08kR-MIF-3Vs0OE": { - teamMember: { - referenceId: "reference_id_2", - isOwner: false, + team_member: { + reference_id: "reference_id_2", + is_owner: false, status: "ACTIVE", - givenName: "Jane", - familyName: "Smith", - emailAddress: "jane_smith@gmail.com", - phoneNumber: "+14159223334", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", }, }, }, "fpgteZNMaf0qOK-a4t6P": { - teamMember: { - referenceId: "reference_id_1", - isOwner: false, + team_member: { + reference_id: "reference_id_1", + is_owner: false, status: "ACTIVE", - givenName: "Joe", - familyName: "Doe", - emailAddress: "joe_doe@gmail.com", - phoneNumber: "+14159283333", - assignedLocations: { - assignmentType: "EXPLICIT_LOCATIONS", - locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], }, }, }, @@ -11405,7 +11405,7 @@ the team member is the Square account owner. await client.teamMembers.search({ query: { filter: { - locationIds: ["0G5P3VGACMMQZ"], + location_ids: ["0G5P3VGACMMQZ"], status: "ACTIVE", }, }, @@ -11475,7 +11475,7 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t ```typescript await client.teamMembers.get({ - teamMemberId: "team_member_id", + team_member_id: "team_member_id", }); ``` @@ -11541,40 +11541,40 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t ```typescript await client.teamMembers.update({ - teamMemberId: "team_member_id", + team_member_id: "team_member_id", body: { - teamMember: { - referenceId: "reference_id_1", + team_member: { + reference_id: "reference_id_1", status: "ACTIVE", - givenName: "Joe", - familyName: "Doe", - emailAddress: "joe_doe@gmail.com", - phoneNumber: "+14159283333", - assignedLocations: { - assignmentType: "EXPLICIT_LOCATIONS", - locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], }, - wageSetting: { - jobAssignments: [ + wage_setting: { + job_assignments: [ { - payType: "SALARY", - annualRate: { - amount: 3000000, + pay_type: "SALARY", + annual_rate: { + amount: BigInt("3000000"), currency: "USD", }, - weeklyHours: 40, - jobId: "FjS8x95cqHiMenw4f1NAUH4P", + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", }, { - payType: "HOURLY", - hourlyRate: { - amount: 1200, + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("1200"), currency: "USD", }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", + job_id: "VDNpRv8da51NU8qZFC5zDWpF", }, ], - isOvertimeExempt: true, + is_overtime_exempt: true, }, }, }, @@ -11710,9 +11710,9 @@ compensation is defined in a [job assignment](entity:JobAssignment) in a team me await client.team.createJob({ job: { title: "Cashier", - isTipEligible: true, + is_tip_eligible: true, }, - idempotencyKey: "idempotency-key-0", + idempotency_key: "idempotency-key-0", }); ``` @@ -11777,7 +11777,7 @@ Retrieves a specified job. ```typescript await client.team.retrieveJob({ - jobId: "job_id", + job_id: "job_id", }); ``` @@ -11844,10 +11844,10 @@ tip eligibility propagate to all `TeamMemberWage` objects that reference the job ```typescript await client.team.updateJob({ - jobId: "job_id", + job_id: "job_id", job: { title: "Cashier 1", - isTipEligible: true, + is_tip_eligible: true, }, }); ``` @@ -11917,7 +11917,7 @@ See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/ ```typescript await client.terminal.dismissTerminalAction({ - actionId: "action_id", + action_id: "action_id", }); ``` @@ -11982,7 +11982,7 @@ Dismisses a Terminal checkout request if the status and type of the request perm ```typescript await client.terminal.dismissTerminalCheckout({ - checkoutId: "checkout_id", + checkout_id: "checkout_id", }); ``` @@ -12047,7 +12047,7 @@ Dismisses a Terminal refund request if the status and type of the request permit ```typescript await client.terminal.dismissTerminalRefund({ - terminalRefundId: "terminal_refund_id", + terminal_refund_id: "terminal_refund_id", }); ``` @@ -12118,22 +12118,22 @@ await client.vendors.batchCreate({ "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { name: "Joe's Fresh Seafood", address: { - addressLine1: "505 Electric Ave", - addressLine2: "Suite 600", + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", + administrative_district_level_1: "NY", + postal_code: "10003", country: "US", }, contacts: [ { name: "Joe Burrow", - emailAddress: "joe@joesfreshseafood.com", - phoneNumber: "1-212-555-4250", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", ordinal: 1, }, ], - accountNumber: "4025391", + account_number: "4025391", note: "a vendor", }, }, @@ -12201,7 +12201,7 @@ Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs. ```typescript await client.vendors.batchGet({ - vendorIds: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"], + vendor_ids: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"], }); ``` @@ -12338,26 +12338,26 @@ Creates a single [Vendor](entity:Vendor) object to represent a supplier to a sel ```typescript await client.vendors.create({ - idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", vendor: { name: "Joe's Fresh Seafood", address: { - addressLine1: "505 Electric Ave", - addressLine2: "Suite 600", + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", + administrative_district_level_1: "NY", + postal_code: "10003", country: "US", }, contacts: [ { name: "Joe Burrow", - emailAddress: "joe@joesfreshseafood.com", - phoneNumber: "1-212-555-4250", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", ordinal: 1, }, ], - accountNumber: "4025391", + account_number: "4025391", note: "a vendor", }, }); @@ -12487,7 +12487,7 @@ Retrieves the vendor of a specified [Vendor](entity:Vendor) ID. ```typescript await client.vendors.get({ - vendorId: "vendor_id", + vendor_id: "vendor_id", }); ``` @@ -12552,9 +12552,9 @@ Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller. ```typescript await client.vendors.update({ - vendorId: "vendor_id", + vendor_id: "vendor_id", body: { - idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", vendor: { id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", name: "Jack's Chicken Shack", @@ -12636,7 +12636,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.bookings.customAttributeDefinitions.list(); +let page = await client.bookings.customAttributeDefinitions.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -12709,7 +12709,7 @@ or _Appointments Premium_. ```typescript await client.bookings.customAttributeDefinitions.create({ - customAttributeDefinition: {}, + custom_attribute_definition: {}, }); ``` @@ -12849,7 +12849,7 @@ or _Appointments Premium_. ```typescript await client.bookings.customAttributeDefinitions.update({ key: "key", - customAttributeDefinition: {}, + custom_attribute_definition: {}, }); ``` @@ -12995,7 +12995,7 @@ or _Appointments Premium_. await client.bookings.customAttributes.batchDelete({ values: { key: { - bookingId: "booking_id", + booking_id: "booking_id", key: "key", }, }, @@ -13071,8 +13071,8 @@ or _Appointments Premium_. await client.bookings.customAttributes.batchUpsert({ values: { key: { - bookingId: "booking_id", - customAttribute: {}, + booking_id: "booking_id", + custom_attribute: {}, }, }, }); @@ -13142,15 +13142,15 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` ```typescript const response = await client.bookings.customAttributes.list({ - bookingId: "booking_id", + booking_id: "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", +let page = await client.bookings.customAttributes.list({ + booking_id: "booking_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -13221,7 +13221,7 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` ```typescript await client.bookings.customAttributes.get({ - bookingId: "booking_id", + booking_id: "booking_id", key: "key", }); ``` @@ -13293,9 +13293,9 @@ or _Appointments Premium_. ```typescript await client.bookings.customAttributes.upsert({ - bookingId: "booking_id", + booking_id: "booking_id", key: "key", - customAttribute: {}, + custom_attribute: {}, }); ``` @@ -13366,7 +13366,7 @@ or _Appointments Premium_. ```typescript await client.bookings.customAttributes.delete({ - bookingId: "booking_id", + booking_id: "booking_id", key: "key", }); ``` @@ -13439,7 +13439,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.bookings.locationProfiles.list(); +let page = await client.bookings.locationProfiles.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -13513,7 +13513,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.bookings.teamMemberProfiles.list(); +let page = await client.bookings.teamMemberProfiles.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -13580,7 +13580,7 @@ Retrieves a team member's booking profile. ```typescript await client.bookings.teamMemberProfiles.get({ - teamMemberId: "team_member_id", + team_member_id: "team_member_id", }); ``` @@ -13648,15 +13648,15 @@ in a date range. ```typescript const response = await client.cashDrawers.shifts.list({ - locationId: "location_id", + location_id: "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", +let page = await client.cashDrawers.shifts.list({ + location_id: "location_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -13725,8 +13725,8 @@ Provides the summary details for a single cash drawer shift. See ```typescript await client.cashDrawers.shifts.get({ - shiftId: "shift_id", - locationId: "location_id", + shift_id: "shift_id", + location_id: "location_id", }); ``` @@ -13791,17 +13791,17 @@ Provides a paginated list of events for a single cash drawer shift. ```typescript const response = await client.cashDrawers.shifts.listEvents({ - shiftId: "shift_id", - locationId: "location_id", + shift_id: "shift_id", + location_id: "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", +let page = await client.cashDrawers.shifts.listEvents({ + shift_id: "shift_id", + location_id: "location_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -13942,7 +13942,7 @@ JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. ```typescript await client.catalog.images.update({ - imageId: "image_id", + image_id: "image_id", }); ``` @@ -14013,7 +14013,7 @@ update requests are rejected with the `429` error code. ```typescript await client.catalog.object.upsert({ - idempotencyKey: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + idempotency_key: "af3d1afc-7212-4300-b463-0bfc5314a5ae", object: { type: "ITEM", id: "id", @@ -14088,7 +14088,7 @@ any [CatalogTax](entity:CatalogTax) objects that apply to it. ```typescript await client.catalog.object.get({ - objectId: "object_id", + object_id: "object_id", }); ``` @@ -14162,7 +14162,7 @@ delete requests are rejected with the `429` error code. ```typescript await client.catalog.object.delete({ - objectId: "object_id", + object_id: "object_id", }); ``` @@ -14234,7 +14234,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.checkout.paymentLinks.list(); +let page = await client.checkout.paymentLinks.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -14301,14 +14301,14 @@ Creates a Square-hosted checkout page. Applications can share the resulting paym ```typescript await client.checkout.paymentLinks.create({ - idempotencyKey: "cd9e25dc-d9f2-4430-aedb-61605070e95f", - quickPay: { + idempotency_key: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + quick_pay: { name: "Auto Detailing", - priceMoney: { - amount: 10000, + price_money: { + amount: BigInt("10000"), currency: "USD", }, - locationId: "A9Y43N9ABXZBP", + location_id: "A9Y43N9ABXZBP", }, }); ``` @@ -14442,10 +14442,10 @@ You cannot update other fields such as the `order_id`, `version`, `URL`, or `tim ```typescript await client.checkout.paymentLinks.update({ id: "id", - paymentLink: { + payment_link: { version: 1, - checkoutOptions: { - askForShippingAddress: true, + checkout_options: { + ask_for_shipping_address: true, }, }, }); @@ -14589,7 +14589,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.customers.customAttributeDefinitions.list(); +let page = await client.customers.customAttributeDefinitions.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -14666,7 +14666,7 @@ Sellers can view all custom attributes in exported customer data, including thos ```typescript await client.customers.customAttributeDefinitions.create({ - customAttributeDefinition: { + custom_attribute_definition: { key: "favoritemovie", schema: { ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", @@ -14815,7 +14815,7 @@ all custom attributes in exported customer data, including those set to `VISIBIL ```typescript await client.customers.customAttributeDefinitions.update({ key: "key", - customAttributeDefinition: { + custom_attribute_definition: { description: "Update the description as desired.", visibility: "VISIBILITY_READ_ONLY", }, @@ -14968,36 +14968,36 @@ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attribut await client.customers.customAttributeDefinitions.batchUpsert({ values: { id1: { - customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", - customAttribute: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { key: "favoritemovie", value: "Dune", }, }, id2: { - customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", - customAttribute: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { key: "ownsmovie", value: false, }, }, id3: { - customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", - customAttribute: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { key: "favoritemovie", value: "Star Wars", }, }, id4: { - customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", - customAttribute: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", value: "10.5", }, }, id5: { - customerId: "70548QG1HN43B05G0KCZ4MMC1G", - customAttribute: { + customer_id: "70548QG1HN43B05G0KCZ4MMC1G", + custom_attribute: { key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", value: "fake-email@squareup.com", }, @@ -15074,7 +15074,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.customers.groups.list(); +let page = await client.customers.groups.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -15210,7 +15210,7 @@ Retrieves a specific customer group as identified by the `group_id` value. ```typescript await client.customers.groups.get({ - groupId: "group_id", + group_id: "group_id", }); ``` @@ -15275,7 +15275,7 @@ Updates a customer group as identified by the `group_id` value. ```typescript await client.customers.groups.update({ - groupId: "group_id", + group_id: "group_id", group: { name: "Loyal Customers", }, @@ -15343,7 +15343,7 @@ Deletes a customer group as identified by the `group_id` value. ```typescript await client.customers.groups.delete({ - groupId: "group_id", + group_id: "group_id", }); ``` @@ -15411,8 +15411,8 @@ and the customer group is identified by the `group_id` value. ```typescript await client.customers.groups.add({ - customerId: "customer_id", - groupId: "group_id", + customer_id: "customer_id", + group_id: "group_id", }); ``` @@ -15480,8 +15480,8 @@ and the customer group is identified by the `group_id` value. ```typescript await client.customers.groups.remove({ - customerId: "customer_id", - groupId: "group_id", + customer_id: "customer_id", + group_id: "group_id", }); ``` @@ -15553,7 +15553,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.customers.segments.list(); +let page = await client.customers.segments.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -15620,7 +15620,7 @@ Retrieves a specific customer segment as identified by the `segment_id` value. ```typescript await client.customers.segments.get({ - segmentId: "segment_id", + segment_id: "segment_id", }); ``` @@ -15691,17 +15691,17 @@ with the provided nonce during the _first_ call. ```typescript await client.customers.cards.create({ - customerId: "customer_id", - cardNonce: "YOUR_CARD_NONCE", - billingAddress: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 600", + customer_id: "customer_id", + card_nonce: "YOUR_CARD_NONCE", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", + administrative_district_level_1: "NY", + postal_code: "10003", country: "US", }, - cardholderName: "Amelia Earhart", + cardholder_name: "Amelia Earhart", }); ``` @@ -15766,8 +15766,8 @@ Removes a card on file from a customer. ```typescript await client.customers.cards.delete({ - customerId: "customer_id", - cardId: "card_id", + customer_id: "customer_id", + card_id: "card_id", }); ``` @@ -15841,15 +15841,15 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.customers.customAttributes.list({ - customerId: "customer_id", + customer_id: "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", +let page = await client.customers.customAttributes.list({ + customer_id: "customer_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -15924,7 +15924,7 @@ To retrieve a custom attribute owned by another application, the `visibility` se ```typescript await client.customers.customAttributes.get({ - customerId: "customer_id", + customer_id: "customer_id", key: "key", }); ``` @@ -15998,9 +15998,9 @@ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attribut ```typescript await client.customers.customAttributes.upsert({ - customerId: "customer_id", + customer_id: "customer_id", key: "key", - customAttribute: { + custom_attribute: { value: "Dune", }, }); @@ -16071,7 +16071,7 @@ To delete a custom attribute owned by another application, the `visibility` sett ```typescript await client.customers.customAttributes.delete({ - customerId: "customer_id", + customer_id: "customer_id", key: "key", }); ``` @@ -16144,7 +16144,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.devices.codes.list(); +let page = await client.devices.codes.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -16212,11 +16212,11 @@ terminal mode. ```typescript await client.devices.codes.create({ - idempotencyKey: "01bb00a6-0c86-4770-94ed-f5fca973cd56", - deviceCode: { + idempotency_key: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + device_code: { name: "Counter 1", - productType: "TERMINAL_API", - locationId: "B5E4484SHHNYH", + product_type: "TERMINAL_API", + location_id: "B5E4484SHHNYH", }, }); ``` @@ -16349,15 +16349,15 @@ Returns a list of evidence associated with a dispute. ```typescript const response = await client.disputes.evidence.list({ - disputeId: "dispute_id", + dispute_id: "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", +let page = await client.disputes.evidence.list({ + dispute_id: "dispute_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -16427,8 +16427,8 @@ You must maintain a copy of any evidence uploaded if you want to reference it la ```typescript await client.disputes.evidence.get({ - disputeId: "dispute_id", - evidenceId: "evidence_id", + dispute_id: "dispute_id", + evidence_id: "evidence_id", }); ``` @@ -16494,8 +16494,8 @@ Square does not send the bank any evidence that is removed. ```typescript await client.disputes.evidence.delete({ - disputeId: "dispute_id", - evidenceId: "evidence_id", + dispute_id: "dispute_id", + evidence_id: "evidence_id", }); ``` @@ -16570,7 +16570,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.giftCards.activities.list(); +let page = await client.giftCards.activities.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -16638,14 +16638,14 @@ For example, create an `ACTIVATE` activity to activate a gift card with an initi ```typescript await client.giftCards.activities.create({ - idempotencyKey: "U16kfr-kA70er-q4Rsym-7U7NnY", - giftCardActivity: { + idempotency_key: "U16kfr-kA70er-q4Rsym-7U7NnY", + gift_card_activity: { type: "ACTIVATE", - locationId: "81FN9BNFZTKS4", - giftCardId: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", - activateActivityDetails: { - orderId: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", - lineItemUid: "eIWl7X0nMuO9Ewbh0ChIx", + location_id: "81FN9BNFZTKS4", + gift_card_id: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + activate_activity_details: { + order_id: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + line_item_uid: "eIWl7X0nMuO9Ewbh0ChIx", }, }, }); @@ -16719,7 +16719,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.labor.breakTypes.list(); +let page = await client.labor.breakTypes.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -16799,12 +16799,12 @@ is returned. ```typescript await client.labor.breakTypes.create({ - idempotencyKey: "PAD3NG5KSN2GL", - breakType: { - locationId: "CGJN03P1D08GF", - breakName: "Lunch Break", - expectedDuration: "PT30M", - isPaid: true, + idempotency_key: "PAD3NG5KSN2GL", + break_type: { + location_id: "CGJN03P1D08GF", + break_name: "Lunch Break", + expected_duration: "PT30M", + is_paid: true, }, }); ``` @@ -16936,11 +16936,11 @@ Updates an existing `BreakType`. ```typescript await client.labor.breakTypes.update({ id: "id", - breakType: { - locationId: "26M7H24AZ9N6R", - breakName: "Lunch", - expectedDuration: "PT50M", - isPaid: true, + break_type: { + location_id: "26M7H24AZ9N6R", + break_name: "Lunch", + expected_duration: "PT50M", + is_paid: true, version: 1, }, }); @@ -17081,7 +17081,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.labor.employeeWages.list(); +let page = await client.labor.employeeWages.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -17232,32 +17232,32 @@ the `Shift.end_at`, or both. ```typescript await client.labor.shifts.create({ - idempotencyKey: "HIDSNG5KS478L", + idempotency_key: "HIDSNG5KS478L", shift: { - locationId: "PAA1RJZZKXBFG", - startAt: "2019-01-25T03:11:00-05:00", - endAt: "2019-01-25T13:11:00-05:00", + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", wage: { title: "Barista", - hourlyRate: { - amount: 1100, + hourly_rate: { + amount: BigInt("1100"), currency: "USD", }, - tipEligible: true, + tip_eligible: true, }, breaks: [ { - startAt: "2019-01-25T06:11:00-05:00", - endAt: "2019-01-25T06:16:00-05:00", - breakTypeId: "REGS1EQR1TPZ5", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", name: "Tea Break", - expectedDuration: "PT5M", - isPaid: true, + expected_duration: "PT5M", + is_paid: true, }, ], - teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - declaredCashTipMoney: { - amount: 500, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), currency: "USD", }, }, @@ -17342,12 +17342,12 @@ await client.labor.shifts.search({ query: { filter: { workday: { - dateRange: { - startDate: "2019-01-20", - endDate: "2019-02-03", + date_range: { + start_date: "2019-01-20", + end_date: "2019-02-03", }, - matchShiftsBy: "START_AT", - defaultTimezone: "America/Los_Angeles", + match_shifts_by: "START_AT", + default_timezone: "America/Los_Angeles", }, }, }, @@ -17489,32 +17489,32 @@ set on each `Break`. 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", + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", wage: { title: "Bartender", - hourlyRate: { - amount: 1500, + hourly_rate: { + amount: BigInt("1500"), currency: "USD", }, - tipEligible: true, + tip_eligible: true, }, breaks: [ { id: "X7GAQYVVRRG6P", - startAt: "2019-01-25T06:11:00-05:00", - endAt: "2019-01-25T06:16:00-05:00", - breakTypeId: "REGS1EQR1TPZ5", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", name: "Tea Break", - expectedDuration: "PT5M", - isPaid: true, + expected_duration: "PT5M", + is_paid: true, }, ], version: 1, - teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - declaredCashTipMoney: { - amount: 500, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), currency: "USD", }, }, @@ -17654,7 +17654,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.labor.teamMemberWages.list(); +let page = await client.labor.teamMemberWages.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -17793,7 +17793,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.labor.workweekConfigs.list(); +let page = await client.labor.workweekConfigs.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -17861,9 +17861,9 @@ Updates a `WorkweekConfig`. ```typescript await client.labor.workweekConfigs.get({ id: "id", - workweekConfig: { - startOfWeek: "MON", - startOfDayLocalTime: "10:00", + workweek_config: { + start_of_week: "MON", + start_of_day_local_time: "10:00", version: 10, }, }); @@ -17940,7 +17940,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.locations.customAttributeDefinitions.list(); +let page = await client.locations.customAttributeDefinitions.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -18013,7 +18013,7 @@ to set the custom attribute for locations. ```typescript await client.locations.customAttributeDefinitions.create({ - customAttributeDefinition: { + custom_attribute_definition: { key: "bestseller", schema: { ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", @@ -18157,7 +18157,7 @@ Only the definition owner can update a custom attribute definition. ```typescript await client.locations.customAttributeDefinitions.update({ key: "key", - customAttributeDefinition: { + custom_attribute_definition: { description: "Update the description as desired.", visibility: "VISIBILITY_READ_ONLY", }, @@ -18383,22 +18383,22 @@ must be `VISIBILITY_READ_WRITE_VALUES`. await client.locations.customAttributes.batchUpsert({ values: { id1: { - locationId: "L0TBCBTB7P8RQ", - customAttribute: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { key: "bestseller", value: "hot cocoa", }, }, id2: { - locationId: "L9XMD04V3STJX", - customAttribute: { + location_id: "L9XMD04V3STJX", + custom_attribute: { key: "bestseller", value: "berry smoothie", }, }, id3: { - locationId: "L0TBCBTB7P8RQ", - customAttribute: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { key: "phone-number", value: "+12223334444", }, @@ -18473,15 +18473,15 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.locations.customAttributes.list({ - locationId: "location_id", + location_id: "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", +let page = await client.locations.customAttributes.list({ + location_id: "location_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -18553,7 +18553,7 @@ To retrieve a custom attribute owned by another application, the `visibility` se ```typescript await client.locations.customAttributes.get({ - locationId: "location_id", + location_id: "location_id", key: "key", }); ``` @@ -18624,9 +18624,9 @@ must be `VISIBILITY_READ_WRITE_VALUES`. ```typescript await client.locations.customAttributes.upsert({ - locationId: "location_id", + location_id: "location_id", key: "key", - customAttribute: { + custom_attribute: { value: "hot cocoa", }, }); @@ -18695,7 +18695,7 @@ To delete a custom attribute owned by another application, the `visibility` sett ```typescript await client.locations.customAttributes.delete({ - locationId: "location_id", + location_id: "location_id", key: "key", }); ``` @@ -18768,7 +18768,7 @@ Max results per [page](https://developer.squareup.com/docs/working-with-apis/pag ```typescript await client.locations.transactions.list({ - locationId: "location_id", + location_id: "location_id", }); ``` @@ -18833,8 +18833,8 @@ Retrieves details for a single transaction. ```typescript await client.locations.transactions.get({ - locationId: "location_id", - transactionId: "transaction_id", + location_id: "location_id", + transaction_id: "transaction_id", }); ``` @@ -18903,8 +18903,8 @@ for more information. ```typescript await client.locations.transactions.capture({ - locationId: "location_id", - transactionId: "transaction_id", + location_id: "location_id", + transaction_id: "transaction_id", }); ``` @@ -18973,8 +18973,8 @@ for more information. ```typescript await client.locations.transactions.void({ - locationId: "location_id", - transactionId: "transaction_id", + location_id: "location_id", + transaction_id: "transaction_id", }); ``` @@ -19041,13 +19041,13 @@ Creates a loyalty account. To create a loyalty account, you must provide the `pr ```typescript await client.loyalty.accounts.create({ - loyaltyAccount: { - programId: "d619f755-2d17-41f3-990d-c04ecedd64dd", + loyalty_account: { + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", mapping: { - phoneNumber: "+14155551234", + phone_number: "+14155551234", }, }, - idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996", + idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996", }); ``` @@ -19119,7 +19119,7 @@ await client.loyalty.accounts.search({ query: { mappings: [ { - phoneNumber: "+14155551234", + phone_number: "+14155551234", }, ], }, @@ -19188,7 +19188,7 @@ Retrieves a loyalty account. ```typescript await client.loyalty.accounts.get({ - accountId: "account_id", + account_id: "account_id", }); ``` @@ -19265,12 +19265,12 @@ to compute the points earned from the base loyalty program. For information abou ```typescript await client.loyalty.accounts.accumulatePoints({ - accountId: "account_id", - accumulatePoints: { - orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + account_id: "account_id", + accumulate_points: { + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", }, - idempotencyKey: "58b90739-c3e8-4b11-85f7-e636d48d72cb", - locationId: "P034NEENMD09F", + idempotency_key: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + location_id: "P034NEENMD09F", }); ``` @@ -19339,9 +19339,9 @@ to add points when a buyer pays for the purchase. ```typescript await client.loyalty.accounts.adjust({ - accountId: "account_id", - idempotencyKey: "bc29a517-3dc9-450e-aa76-fae39ee849d1", - adjustPoints: { + account_id: "account_id", + idempotency_key: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + adjust_points: { points: 10, reason: "Complimentary points", }, @@ -19471,7 +19471,7 @@ Loyalty programs define how buyers can earn points and redeem points for rewards ```typescript await client.loyalty.programs.get({ - programId: "program_id", + program_id: "program_id", }); ``` @@ -19549,9 +19549,9 @@ to calculate whether the purchase also qualifies for promotion points. For more ```typescript await client.loyalty.programs.calculate({ - programId: "program_id", - orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - loyaltyAccountId: "79b807d2-d786-46a9-933b-918028d7a8c5", + program_id: "program_id", + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + loyalty_account_id: "79b807d2-d786-46a9-933b-918028d7a8c5", }); ``` @@ -19626,11 +19626,11 @@ not available for the buyer to redeem another reward. ```typescript await client.loyalty.rewards.create({ reward: { - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", }, - idempotencyKey: "18c2e5ea-a620-4b1f-ad60-7b167285e451", + idempotency_key: "18c2e5ea-a620-4b1f-ad60-7b167285e451", }); ``` @@ -19702,7 +19702,7 @@ Search results are sorted by `updated_at` in descending order. ```typescript await client.loyalty.rewards.search({ query: { - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", }, limit: 10, }); @@ -19769,7 +19769,7 @@ Retrieves a loyalty reward. ```typescript await client.loyalty.rewards.get({ - rewardId: "reward_id", + reward_id: "reward_id", }); ``` @@ -19842,7 +19842,7 @@ You cannot delete a reward that has reached the terminal state (REDEEMED). ```typescript await client.loyalty.rewards.delete({ - rewardId: "reward_id", + reward_id: "reward_id", }); ``` @@ -19917,9 +19917,9 @@ to the account. ```typescript await client.loyalty.rewards.redeem({ - rewardId: "reward_id", - idempotencyKey: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", - locationId: "P034NEENMD09F", + reward_id: "reward_id", + idempotency_key: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + location_id: "P034NEENMD09F", }); ``` @@ -19987,15 +19987,15 @@ Results are sorted by the `created_at` date in descending order (newest to oldes ```typescript const response = await client.loyalty.programs.promotions.list({ - programId: "program_id", + program_id: "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", +let page = await client.loyalty.programs.promotions.list({ + program_id: "program_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -20068,31 +20068,31 @@ This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, ```typescript await client.loyalty.programs.promotions.create({ - programId: "program_id", - loyaltyPromotion: { + program_id: "program_id", + loyalty_promotion: { name: "Tuesday Happy Hour Promo", incentive: { type: "POINTS_MULTIPLIER", - pointsMultiplierData: { + points_multiplier_data: { multiplier: "3.0", }, }, - availableTime: { - timePeriods: [ + available_time: { + time_periods: [ "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", ], }, - triggerLimit: { + trigger_limit: { times: 1, interval: "DAY", }, - minimumSpendAmountMoney: { - amount: 2000, + minimum_spend_amount_money: { + amount: BigInt("2000"), currency: "USD", }, - qualifyingCategoryIds: ["XTQPYLR3IIU9C44VRCB3XD12"], + qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"], }, - idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996", + idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996", }); ``` @@ -20157,8 +20157,8 @@ Retrieves a loyalty promotion. ```typescript await client.loyalty.programs.promotions.get({ - promotionId: "promotion_id", - programId: "program_id", + promotion_id: "promotion_id", + program_id: "program_id", }); ``` @@ -20228,8 +20228,8 @@ This endpoint sets the loyalty promotion to the `CANCELED` state ```typescript await client.loyalty.programs.promotions.cancel({ - promotionId: "promotion_id", - programId: "program_id", + promotion_id: "promotion_id", + program_id: "program_id", }); ``` @@ -20304,7 +20304,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.merchants.customAttributeDefinitions.list(); +let page = await client.merchants.customAttributeDefinitions.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -20377,7 +20377,7 @@ to set the custom attribute for a merchant. ```typescript await client.merchants.customAttributeDefinitions.create({ - customAttributeDefinition: { + custom_attribute_definition: { key: "alternative_seller_name", schema: { ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", @@ -20521,7 +20521,7 @@ Only the definition owner can update a custom attribute definition. ```typescript await client.merchants.customAttributeDefinitions.update({ key: "key", - customAttributeDefinition: { + custom_attribute_definition: { description: "Update the description as desired.", visibility: "VISIBILITY_READ_ONLY", }, @@ -20744,15 +20744,15 @@ must be `VISIBILITY_READ_WRITE_VALUES`. await client.merchants.customAttributes.batchUpsert({ values: { id1: { - merchantId: "DM7VKY8Q63GNP", - customAttribute: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { key: "alternative_seller_name", value: "Ultimate Sneaker Store", }, }, id2: { - merchantId: "DM7VKY8Q63GNP", - customAttribute: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { key: "has_seen_tutorial", value: true, }, @@ -20827,15 +20827,15 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.merchants.customAttributes.list({ - merchantId: "merchant_id", + merchant_id: "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", +let page = await client.merchants.customAttributes.list({ + merchant_id: "merchant_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -20907,7 +20907,7 @@ To retrieve a custom attribute owned by another application, the `visibility` se ```typescript await client.merchants.customAttributes.get({ - merchantId: "merchant_id", + merchant_id: "merchant_id", key: "key", }); ``` @@ -20978,9 +20978,9 @@ must be `VISIBILITY_READ_WRITE_VALUES`. ```typescript await client.merchants.customAttributes.upsert({ - merchantId: "merchant_id", + merchant_id: "merchant_id", key: "key", - customAttribute: { + custom_attribute: { value: "Ultimate Sneaker Store", }, }); @@ -21049,7 +21049,7 @@ To delete a custom attribute owned by another application, the `visibility` sett ```typescript await client.merchants.customAttributes.delete({ - merchantId: "merchant_id", + merchant_id: "merchant_id", key: "key", }); ``` @@ -21127,7 +21127,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.orders.customAttributeDefinitions.list(); +let page = await client.orders.customAttributeDefinitions.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -21198,7 +21198,7 @@ in the Square seller account. ```typescript await client.orders.customAttributeDefinitions.create({ - customAttributeDefinition: { + custom_attribute_definition: { key: "cover-count", schema: { ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number", @@ -21207,7 +21207,7 @@ await client.orders.customAttributeDefinitions.create({ description: "The number of people seated at a table", visibility: "VISIBILITY_READ_WRITE_VALUES", }, - idempotencyKey: "IDEMPOTENCY_KEY", + idempotency_key: "IDEMPOTENCY_KEY", }); ``` @@ -21344,12 +21344,12 @@ Only the definition owner can update a custom attribute definition. Note that se ```typescript await client.orders.customAttributeDefinitions.update({ key: "key", - customAttributeDefinition: { + custom_attribute_definition: { key: "cover-count", visibility: "VISIBILITY_READ_ONLY", version: 1, }, - idempotencyKey: "IDEMPOTENCY_KEY", + idempotency_key: "IDEMPOTENCY_KEY", }); ``` @@ -21499,11 +21499,11 @@ await client.orders.customAttributes.batchDelete({ values: { "cover-count": { key: "cover-count", - orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", }, "table-number": { key: "table-number", - orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", }, }, }); @@ -21585,20 +21585,20 @@ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attribut await client.orders.customAttributes.batchUpsert({ values: { "cover-count": { - customAttribute: { + custom_attribute: { key: "cover-count", value: "6", version: 2, }, - orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", }, "table-number": { - customAttribute: { + custom_attribute: { key: "table-number", value: "11", version: 4, }, - orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", }, }, }); @@ -21672,15 +21672,15 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.orders.customAttributes.list({ - orderId: "order_id", + order_id: "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", +let page = await client.orders.customAttributes.list({ + order_id: "order_id", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -21755,8 +21755,8 @@ also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. ```typescript await client.orders.customAttributes.get({ - orderId: "order_id", - customAttributeKey: "custom_attribute_key", + order_id: "order_id", + custom_attribute_key: "custom_attribute_key", }); ``` @@ -21829,9 +21829,9 @@ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attribut ```typescript await client.orders.customAttributes.upsert({ - orderId: "order_id", - customAttributeKey: "custom_attribute_key", - customAttribute: { + order_id: "order_id", + custom_attribute_key: "custom_attribute_key", + custom_attribute: { key: "table-number", value: "42", version: 1, @@ -21904,8 +21904,8 @@ To delete a custom attribute owned by another application, the `visibility` sett ```typescript await client.orders.customAttributes.delete({ - orderId: "order_id", - customAttributeKey: "custom_attribute_key", + order_id: "order_id", + custom_attribute_key: "custom_attribute_key", }); ``` @@ -21977,7 +21977,7 @@ to get this information directly from the `TeamMember.wage_setting` field. ```typescript await client.teamMembers.wageSetting.get({ - teamMemberId: "team_member_id", + team_member_id: "team_member_id", }); ``` @@ -22049,28 +22049,28 @@ to manage the `TeamMember.wage_setting` field directly. ```typescript await client.teamMembers.wageSetting.update({ - teamMemberId: "team_member_id", - wageSetting: { - jobAssignments: [ + team_member_id: "team_member_id", + wage_setting: { + job_assignments: [ { - jobTitle: "Manager", - payType: "SALARY", - annualRate: { - amount: 3000000, + job_title: "Manager", + pay_type: "SALARY", + annual_rate: { + amount: BigInt("3000000"), currency: "USD", }, - weeklyHours: 40, + weekly_hours: 40, }, { - jobTitle: "Cashier", - payType: "HOURLY", - hourlyRate: { - amount: 2000, + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), currency: "USD", }, }, ], - isOvertimeExempt: true, + is_overtime_exempt: true, }, }); ``` @@ -22138,14 +22138,14 @@ Creates a Terminal action request and sends it to the specified device. ```typescript await client.terminal.actions.create({ - idempotencyKey: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + idempotency_key: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", action: { - deviceId: "{{DEVICE_ID}}", - deadlineDuration: "PT5M", + device_id: "{{DEVICE_ID}}", + deadline_duration: "PT5M", type: "SAVE_CARD", - saveCardOptions: { - customerId: "{{CUSTOMER_ID}}", - referenceId: "user-id-1", + save_card_options: { + customer_id: "{{CUSTOMER_ID}}", + reference_id: "user-id-1", }, }, }); @@ -22214,12 +22214,12 @@ Retrieves a filtered list of Terminal action requests created by the account mak await client.terminal.actions.search({ query: { filter: { - createdAt: { - startAt: "2022-04-01T00:00:00.000Z", + created_at: { + start_at: "2022-04-01T00:00:00.000Z", }, }, sort: { - sortOrder: "DESC", + sort_order: "DESC", }, }, limit: 2, @@ -22287,7 +22287,7 @@ Retrieves a Terminal action request by `action_id`. Terminal action requests are ```typescript await client.terminal.actions.get({ - actionId: "action_id", + action_id: "action_id", }); ``` @@ -22352,7 +22352,7 @@ Cancels a Terminal action request if the status of the request permits it. ```typescript await client.terminal.actions.cancel({ - actionId: "action_id", + action_id: "action_id", }); ``` @@ -22420,16 +22420,16 @@ for the requested amount. ```typescript await client.terminal.checkouts.create({ - idempotencyKey: "28a0c3bc-7839-11ea-bc55-0242ac130003", + idempotency_key: "28a0c3bc-7839-11ea-bc55-0242ac130003", checkout: { - amountMoney: { - amount: 2610, + amount_money: { + amount: BigInt("2610"), currency: "USD", }, - referenceId: "id11572", + reference_id: "id11572", note: "A brief note", - deviceOptions: { - deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003", + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", }, }, }); @@ -22566,7 +22566,7 @@ Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout reques ```typescript await client.terminal.checkouts.get({ - checkoutId: "checkout_id", + checkout_id: "checkout_id", }); ``` @@ -22631,7 +22631,7 @@ Cancels a Terminal checkout request if the status of the request permits it. ```typescript await client.terminal.checkouts.cancel({ - checkoutId: "checkout_id", + checkout_id: "checkout_id", }); ``` @@ -22698,15 +22698,15 @@ Creates a request to refund an Interac payment completed on a Square Terminal. R ```typescript await client.terminal.refunds.create({ - idempotencyKey: "402a640b-b26f-401f-b406-46f839590c04", + idempotency_key: "402a640b-b26f-401f-b406-46f839590c04", refund: { - paymentId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - amountMoney: { - amount: 111, + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + amount_money: { + amount: BigInt("111"), currency: "CAD", }, reason: "Returning items", - deviceId: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", }, }); ``` @@ -22842,7 +22842,7 @@ Retrieves an Interac Terminal refund object by ID. Terminal refund objects are a ```typescript await client.terminal.refunds.get({ - terminalRefundId: "terminal_refund_id", + terminal_refund_id: "terminal_refund_id", }); ``` @@ -22907,7 +22907,7 @@ Cancels an Interac Terminal refund request by refund request ID if the status of ```typescript await client.terminal.refunds.cancel({ - terminalRefundId: "terminal_refund_id", + terminal_refund_id: "terminal_refund_id", }); ``` @@ -23044,7 +23044,7 @@ for await (const item of response) { } // Or you can manually iterate page-by-page -const page = await client.webhooks.subscriptions.list(); +let page = await client.webhooks.subscriptions.list(); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -23111,12 +23111,12 @@ Creates a webhook subscription. ```typescript await client.webhooks.subscriptions.create({ - idempotencyKey: "63f84c6c-2200-4c99-846c-2670a1311fbf", + idempotency_key: "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", + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", }, }); ``` @@ -23182,7 +23182,7 @@ Retrieves a webhook subscription identified by its ID. ```typescript await client.webhooks.subscriptions.get({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", }); ``` @@ -23247,7 +23247,7 @@ Updates a webhook subscription. ```typescript await client.webhooks.subscriptions.update({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", subscription: { name: "Updated Example Webhook Subscription", enabled: false, @@ -23316,7 +23316,7 @@ Deletes a webhook subscription. ```typescript await client.webhooks.subscriptions.delete({ - subscriptionId: "subscription_id", + subscription_id: "subscription_id", }); ``` @@ -23381,8 +23381,8 @@ Updates a webhook subscription by replacing the existing signature key with a ne ```typescript await client.webhooks.subscriptions.updateSignatureKey({ - subscriptionId: "subscription_id", - idempotencyKey: "ed80ae6b-0654-473b-bbab-a39aee89a60d", + subscription_id: "subscription_id", + idempotency_key: "ed80ae6b-0654-473b-bbab-a39aee89a60d", }); ``` @@ -23447,8 +23447,8 @@ Tests a webhook subscription by sending a test event to the notification URL. ```typescript await client.webhooks.subscriptions.test({ - subscriptionId: "subscription_id", - eventType: "payment.created", + subscription_id: "subscription_id", + event_type: "payment.created", }); ``` diff --git a/scripts/rename-to-esm-files.js b/scripts/rename-to-esm-files.js index 81dac6a75..dc1df1cbb 100644 --- a/scripts/rename-to-esm-files.js +++ b/scripts/rename-to-esm-files.js @@ -50,8 +50,16 @@ async function updateFileContents(file) { 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`); + // Handle static imports/exports + const staticRegex = new RegExp(`(import|export)(.+from\\s+['"])(\\.\\.?\\/[^'"]+)(\\${oldExt})(['"])`, "g"); + newContent = newContent.replace(staticRegex, `$1$2$3${newExt}$5`); + + // Handle dynamic imports (yield import, await import, regular import()) + const dynamicRegex = new RegExp( + `(yield\\s+import|await\\s+import|import)\\s*\\(\\s*['"](\\.\\.\?\\/[^'"]+)(\\${oldExt})['"]\\s*\\)`, + "g", + ); + newContent = newContent.replace(dynamicRegex, `$1("$2${newExt}")`); } if (content !== newContent) { diff --git a/src/Client.ts b/src/Client.ts index ad3bfb92a..ffcb061b7 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -2,42 +2,43 @@ * 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 { Labor } from "./api/resources/labor/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 { Webhooks } from "./api/resources/webhooks/client/Client"; +import * as environments from "./environments.js"; +import * as core from "./core/index.js"; +import { mergeHeaders } from "./core/headers.js"; +import { Mobile } from "./api/resources/mobile/client/Client.js"; +import { OAuth } from "./api/resources/oAuth/client/Client.js"; +import { V1Transactions } from "./api/resources/v1Transactions/client/Client.js"; +import { ApplePay } from "./api/resources/applePay/client/Client.js"; +import { BankAccounts } from "./api/resources/bankAccounts/client/Client.js"; +import { Bookings } from "./api/resources/bookings/client/Client.js"; +import { Cards } from "./api/resources/cards/client/Client.js"; +import { Catalog } from "./api/resources/catalog/client/Client.js"; +import { Customers } from "./api/resources/customers/client/Client.js"; +import { Devices } from "./api/resources/devices/client/Client.js"; +import { Disputes } from "./api/resources/disputes/client/Client.js"; +import { Employees } from "./api/resources/employees/client/Client.js"; +import { Events } from "./api/resources/events/client/Client.js"; +import { GiftCards } from "./api/resources/giftCards/client/Client.js"; +import { Inventory } from "./api/resources/inventory/client/Client.js"; +import { Invoices } from "./api/resources/invoices/client/Client.js"; +import { Labor } from "./api/resources/labor/client/Client.js"; +import { Locations } from "./api/resources/locations/client/Client.js"; +import { Loyalty } from "./api/resources/loyalty/client/Client.js"; +import { Merchants } from "./api/resources/merchants/client/Client.js"; +import { Checkout } from "./api/resources/checkout/client/Client.js"; +import { Orders } from "./api/resources/orders/client/Client.js"; +import { Payments } from "./api/resources/payments/client/Client.js"; +import { Payouts } from "./api/resources/payouts/client/Client.js"; +import { Refunds } from "./api/resources/refunds/client/Client.js"; +import { Sites } from "./api/resources/sites/client/Client.js"; +import { Snippets } from "./api/resources/snippets/client/Client.js"; +import { Subscriptions } from "./api/resources/subscriptions/client/Client.js"; +import { TeamMembers } from "./api/resources/teamMembers/client/Client.js"; +import { Team } from "./api/resources/team/client/Client.js"; +import { Terminal } from "./api/resources/terminal/client/Client.js"; +import { Vendors } from "./api/resources/vendors/client/Client.js"; +import { CashDrawers } from "./api/resources/cashDrawers/client/Client.js"; +import { Webhooks } from "./api/resources/webhooks/client/Client.js"; export declare namespace SquareClient { export interface Options { @@ -47,6 +48,8 @@ export declare namespace SquareClient { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -60,11 +63,12 @@ export declare namespace SquareClient { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class SquareClient { + protected readonly _options: SquareClient.Options; protected _mobile: Mobile | undefined; protected _oAuth: OAuth | undefined; protected _v1Transactions: V1Transactions | undefined; @@ -100,7 +104,23 @@ export class SquareClient { protected _cashDrawers: CashDrawers | undefined; protected _webhooks: Webhooks | undefined; - constructor(protected readonly _options: SquareClient.Options = {}) {} + constructor(_options: SquareClient.Options = {}) { + this._options = { + ..._options, + headers: mergeHeaders( + { + "Square-Version": _options?.version ?? "2025-07-16", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "43.0.1", + "User-Agent": "square/43.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + _options?.headers, + ), + }; + } public get mobile(): Mobile { return (this._mobile ??= new Mobile(this._options)); diff --git a/src/api/index.ts b/src/api/index.ts index 3ce0a3e38..bab7cb3de 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,2 +1,2 @@ -export * from "./types"; -export * from "./resources"; +export * from "./types/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/applePay/client/Client.ts b/src/api/resources/applePay/client/Client.ts index 7fe8fc31a..3b9d3eeca 100644 --- a/src/api/resources/applePay/client/Client.ts +++ b/src/api/resources/applePay/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace ApplePay { export interface Options { @@ -17,6 +16,8 @@ export declare namespace ApplePay { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace ApplePay { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class ApplePay { - constructor(protected readonly _options: ApplePay.Options = {}) {} + protected readonly _options: ApplePay.Options; + + constructor(_options: ApplePay.Options = {}) { + this._options = _options; + } /** * Activates a domain for use with Apple Pay on the Web and Square. A validation @@ -58,56 +63,52 @@ export class ApplePay { * * @example * await client.applePay.registerDomain({ - * domainName: "example.com" + * domain_name: "example.com" * }) */ - public async registerDomain( + public registerDomain( + request: Square.RegisterDomainRequest, + requestOptions?: ApplePay.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__registerDomain(request, requestOptions)); + } + + private async __registerDomain( request: Square.RegisterDomainRequest, requestOptions?: ApplePay.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.RegisterDomainRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.RegisterDomainResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -116,12 +117,14 @@ export class ApplePay { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/applePay/client/index.ts b/src/api/resources/applePay/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/applePay/client/index.ts +++ b/src/api/resources/applePay/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/applePay/client/requests/RegisterDomainRequest.ts b/src/api/resources/applePay/client/requests/RegisterDomainRequest.ts index d2aa825f6..b266912de 100644 --- a/src/api/resources/applePay/client/requests/RegisterDomainRequest.ts +++ b/src/api/resources/applePay/client/requests/RegisterDomainRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * domainName: "example.com" + * domain_name: "example.com" * } */ export interface RegisterDomainRequest { /** A domain name as described in RFC-1034 that will be registered with ApplePay. */ - domainName: string; + domain_name: string; } diff --git a/src/api/resources/applePay/client/requests/index.ts b/src/api/resources/applePay/client/requests/index.ts index 11c98648b..4165a77a5 100644 --- a/src/api/resources/applePay/client/requests/index.ts +++ b/src/api/resources/applePay/client/requests/index.ts @@ -1 +1 @@ -export { type RegisterDomainRequest } from "./RegisterDomainRequest"; +export { type RegisterDomainRequest } from "./RegisterDomainRequest.js"; diff --git a/src/api/resources/applePay/index.ts b/src/api/resources/applePay/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/applePay/index.ts +++ b/src/api/resources/applePay/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/bankAccounts/client/Client.ts b/src/api/resources/bankAccounts/client/Client.ts index f1d305a72..b2bda8e37 100644 --- a/src/api/resources/bankAccounts/client/Client.ts +++ b/src/api/resources/bankAccounts/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace BankAccounts { export interface Options { @@ -17,6 +16,8 @@ export declare namespace BankAccounts { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace BankAccounts { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class BankAccounts { - constructor(protected readonly _options: BankAccounts.Options = {}) {} + protected readonly _options: BankAccounts.Options; + + constructor(_options: BankAccounts.Options = {}) { + this._options = _options; + } /** * Returns a list of [BankAccount](entity:BankAccount) objects linked to a Square account. @@ -50,77 +55,80 @@ export class BankAccounts { request: Square.ListBankAccountsRequest = {}, requestOptions?: BankAccounts.RequestOptions, ): Promise> { - const list = async (request: Square.ListBankAccountsRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListBankAccountsRequest, + ): Promise> => { + const { cursor, limit, location_id: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bank-accounts", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListBankAccountsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/bank-accounts."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/bank-accounts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.bankAccounts ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.bank_accounts ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -135,53 +143,50 @@ export class BankAccounts { * * @example * await client.bankAccounts.getByV1Id({ - * v1BankAccountId: "v1_bank_account_id" + * v1_bank_account_id: "v1_bank_account_id" * }) */ - public async getByV1Id( + public getByV1Id( + request: Square.GetByV1IdBankAccountsRequest, + requestOptions?: BankAccounts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getByV1Id(request, requestOptions)); + } + + private async __getByV1Id( request: Square.GetByV1IdBankAccountsRequest, requestOptions?: BankAccounts.RequestOptions, - ): Promise { - const { v1BankAccountId } = request; + ): Promise> { + const { v1_bank_account_id: v1BankAccountId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetBankAccountByV1IdResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -190,6 +195,7 @@ export class BankAccounts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -198,6 +204,7 @@ export class BankAccounts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -211,53 +218,50 @@ export class BankAccounts { * * @example * await client.bankAccounts.get({ - * bankAccountId: "bank_account_id" + * bank_account_id: "bank_account_id" * }) */ - public async get( + public get( request: Square.GetBankAccountsRequest, requestOptions?: BankAccounts.RequestOptions, - ): Promise { - const { bankAccountId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetBankAccountsRequest, + requestOptions?: BankAccounts.RequestOptions, + ): Promise> { + const { bank_account_id: bankAccountId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetBankAccountResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -266,6 +270,7 @@ export class BankAccounts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -274,6 +279,7 @@ export class BankAccounts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/bankAccounts/client/index.ts b/src/api/resources/bankAccounts/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/bankAccounts/client/index.ts +++ b/src/api/resources/bankAccounts/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/bankAccounts/client/requests/GetBankAccountsRequest.ts b/src/api/resources/bankAccounts/client/requests/GetBankAccountsRequest.ts index 2e0fe1f5c..99eacd42b 100644 --- a/src/api/resources/bankAccounts/client/requests/GetBankAccountsRequest.ts +++ b/src/api/resources/bankAccounts/client/requests/GetBankAccountsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * bankAccountId: "bank_account_id" + * bank_account_id: "bank_account_id" * } */ export interface GetBankAccountsRequest { /** * Square-issued ID of the desired `BankAccount`. */ - bankAccountId: string; + bank_account_id: string; } diff --git a/src/api/resources/bankAccounts/client/requests/GetByV1IdBankAccountsRequest.ts b/src/api/resources/bankAccounts/client/requests/GetByV1IdBankAccountsRequest.ts index f567ca2bf..65b811041 100644 --- a/src/api/resources/bankAccounts/client/requests/GetByV1IdBankAccountsRequest.ts +++ b/src/api/resources/bankAccounts/client/requests/GetByV1IdBankAccountsRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * v1BankAccountId: "v1_bank_account_id" + * v1_bank_account_id: "v1_bank_account_id" * } */ export interface GetByV1IdBankAccountsRequest { @@ -13,5 +13,5 @@ export interface GetByV1IdBankAccountsRequest { * 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; + v1_bank_account_id: string; } diff --git a/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts b/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts index b5ffadfe8..6de5eb28c 100644 --- a/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts +++ b/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts @@ -25,5 +25,5 @@ export interface ListBankAccountsRequest { * Location ID. You can specify this optional filter * to retrieve only the linked bank accounts belonging to a specific location. */ - locationId?: string | null; + location_id?: string | null; } diff --git a/src/api/resources/bankAccounts/client/requests/index.ts b/src/api/resources/bankAccounts/client/requests/index.ts index 15a87c836..12237b1bd 100644 --- a/src/api/resources/bankAccounts/client/requests/index.ts +++ b/src/api/resources/bankAccounts/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type ListBankAccountsRequest } from "./ListBankAccountsRequest"; -export { type GetByV1IdBankAccountsRequest } from "./GetByV1IdBankAccountsRequest"; -export { type GetBankAccountsRequest } from "./GetBankAccountsRequest"; +export { type ListBankAccountsRequest } from "./ListBankAccountsRequest.js"; +export { type GetByV1IdBankAccountsRequest } from "./GetByV1IdBankAccountsRequest.js"; +export { type GetBankAccountsRequest } from "./GetBankAccountsRequest.js"; diff --git a/src/api/resources/bankAccounts/index.ts b/src/api/resources/bankAccounts/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/bankAccounts/index.ts +++ b/src/api/resources/bankAccounts/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/bookings/client/Client.ts b/src/api/resources/bookings/client/Client.ts index 5e299eff9..2af421f41 100644 --- a/src/api/resources/bookings/client/Client.ts +++ b/src/api/resources/bookings/client/Client.ts @@ -2,16 +2,15 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client.js"; +import { CustomAttributes } from "../resources/customAttributes/client/Client.js"; +import { LocationProfiles } from "../resources/locationProfiles/client/Client.js"; +import { TeamMemberProfiles } from "../resources/teamMemberProfiles/client/Client.js"; export declare namespace Bookings { export interface Options { @@ -21,6 +20,8 @@ export declare namespace Bookings { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -34,17 +35,20 @@ export declare namespace Bookings { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Bookings { + protected readonly _options: Bookings.Options; protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; protected _customAttributes: CustomAttributes | undefined; protected _locationProfiles: LocationProfiles | undefined; protected _teamMemberProfiles: TeamMemberProfiles | undefined; - constructor(protected readonly _options: Bookings.Options = {}) {} + constructor(_options: Bookings.Options = {}) { + this._options = _options; + } public get customAttributeDefinitions(): CustomAttributeDefinitions { return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); @@ -78,88 +82,94 @@ export class Bookings { request: Square.ListBookingsRequest = {}, requestOptions?: Bookings.RequestOptions, ): Promise> { - const list = async (request: Square.ListBookingsRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListBookingsRequest): Promise> => { + const { + limit, + cursor, + customer_id: customerId, + team_member_id: teamMemberId, + location_id: locationId, + start_at_min: startAtMin, + start_at_max: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListBookingsResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/bookings."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/bookings."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.bookings ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -191,53 +201,49 @@ export class Bookings { * booking: {} * }) */ - public async create( + public create( + request: Square.CreateBookingRequest, + requestOptions?: Bookings.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.CreateBookingRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateBookingRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateBookingResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -246,12 +252,14 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/bookings."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -269,58 +277,54 @@ export class Bookings { * await client.bookings.searchAvailability({ * query: { * filter: { - * startAtRange: {} + * start_at_range: {} * } * } * }) */ - public async searchAvailability( + public searchAvailability( request: Square.SearchAvailabilityRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchAvailability(request, requestOptions)); + } + + private async __searchAvailability( + request: Square.SearchAvailabilityRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchAvailabilityRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchAvailabilityResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -329,6 +333,7 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -337,6 +342,7 @@ export class Bookings { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -352,56 +358,52 @@ export class Bookings { * * @example * await client.bookings.bulkRetrieveBookings({ - * bookingIds: ["booking_ids"] + * booking_ids: ["booking_ids"] * }) */ - public async bulkRetrieveBookings( + public bulkRetrieveBookings( request: Square.BulkRetrieveBookingsRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__bulkRetrieveBookings(request, requestOptions)); + } + + private async __bulkRetrieveBookings( + request: Square.BulkRetrieveBookingsRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkRetrieveBookingsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BulkRetrieveBookingsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -410,12 +412,14 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -428,48 +432,47 @@ export class Bookings { * @example * await client.bookings.getBusinessProfile() */ - public async getBusinessProfile( + public getBusinessProfile( requestOptions?: Bookings.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getBusinessProfile(requestOptions)); + } + + private async __getBusinessProfile( + requestOptions?: Bookings.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetBusinessBookingProfileResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -478,6 +481,7 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -486,6 +490,7 @@ export class Bookings { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -498,53 +503,53 @@ export class Bookings { * * @example * await client.bookings.retrieveLocationBookingProfile({ - * locationId: "location_id" + * location_id: "location_id" * }) */ - public async retrieveLocationBookingProfile( + public retrieveLocationBookingProfile( + request: Square.RetrieveLocationBookingProfileRequest, + requestOptions?: Bookings.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveLocationBookingProfile(request, requestOptions)); + } + + private async __retrieveLocationBookingProfile( request: Square.RetrieveLocationBookingProfileRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { - const { locationId } = request; + ): Promise> { + const { location_id: locationId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveLocationBookingProfileResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -553,6 +558,7 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -561,6 +567,7 @@ export class Bookings { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -573,56 +580,57 @@ export class Bookings { * * @example * await client.bookings.bulkRetrieveTeamMemberBookingProfiles({ - * teamMemberIds: ["team_member_ids"] + * team_member_ids: ["team_member_ids"] * }) */ - public async bulkRetrieveTeamMemberBookingProfiles( + public bulkRetrieveTeamMemberBookingProfiles( + request: Square.BulkRetrieveTeamMemberBookingProfilesRequest, + requestOptions?: Bookings.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise( + this.__bulkRetrieveTeamMemberBookingProfiles(request, requestOptions), + ); + } + + private async __bulkRetrieveTeamMemberBookingProfiles( request: Square.BulkRetrieveTeamMemberBookingProfilesRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkRetrieveTeamMemberBookingProfilesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkRetrieveTeamMemberBookingProfilesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -631,6 +639,7 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -639,6 +648,7 @@ export class Bookings { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -654,53 +664,50 @@ export class Bookings { * * @example * await client.bookings.get({ - * bookingId: "booking_id" + * booking_id: "booking_id" * }) */ - public async get( + public get( request: Square.GetBookingsRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { - const { bookingId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetBookingsRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise> { + const { booking_id: bookingId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetBookingResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -709,12 +716,14 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -733,58 +742,54 @@ export class Bookings { * * @example * await client.bookings.update({ - * bookingId: "booking_id", + * booking_id: "booking_id", * booking: {} * }) */ - public async update( + public update( request: Square.UpdateBookingRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { - const { bookingId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.UpdateBookingRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise> { + const { booking_id: bookingId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateBookingRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateBookingResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -793,12 +798,14 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -817,57 +824,53 @@ export class Bookings { * * @example * await client.bookings.cancel({ - * bookingId: "booking_id" + * booking_id: "booking_id" * }) */ - public async cancel( + public cancel( + request: Square.CancelBookingRequest, + requestOptions?: Bookings.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( request: Square.CancelBookingRequest, requestOptions?: Bookings.RequestOptions, - ): Promise { - const { bookingId, ..._body } = request; + ): Promise> { + const { booking_id: bookingId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CancelBookingRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.CancelBookingResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -876,6 +879,7 @@ export class Bookings { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -884,6 +888,7 @@ export class Bookings { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/bookings/client/index.ts b/src/api/resources/bookings/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/bookings/client/index.ts +++ b/src/api/resources/bookings/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts b/src/api/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts index fb06a42b6..780d6a3fe 100644 --- a/src/api/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts +++ b/src/api/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * bookingIds: ["booking_ids"] + * booking_ids: ["booking_ids"] * } */ export interface BulkRetrieveBookingsRequest { /** A non-empty list of [Booking](entity:Booking) IDs specifying bookings to retrieve. */ - bookingIds: string[]; + booking_ids: string[]; } diff --git a/src/api/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts b/src/api/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts index f0d8d22fe..4b4d275d7 100644 --- a/src/api/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts +++ b/src/api/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * teamMemberIds: ["team_member_ids"] + * team_member_ids: ["team_member_ids"] * } */ export interface BulkRetrieveTeamMemberBookingProfilesRequest { /** A non-empty list of IDs of team members whose booking profiles you want to retrieve. */ - teamMemberIds: string[]; + team_member_ids: string[]; } diff --git a/src/api/resources/bookings/client/requests/CancelBookingRequest.ts b/src/api/resources/bookings/client/requests/CancelBookingRequest.ts index df9e2f50c..bf576405e 100644 --- a/src/api/resources/bookings/client/requests/CancelBookingRequest.ts +++ b/src/api/resources/bookings/client/requests/CancelBookingRequest.ts @@ -5,16 +5,16 @@ /** * @example * { - * bookingId: "booking_id" + * booking_id: "booking_id" * } */ export interface CancelBookingRequest { /** * The ID of the [Booking](entity:Booking) object representing the to-be-cancelled booking. */ - bookingId: string; + booking_id: string; /** A unique key to make this request an idempotent operation. */ - idempotencyKey?: string | null; + idempotency_key?: string | null; /** The revision number for the booking used for optimistic concurrency. */ - bookingVersion?: number | null; + booking_version?: number | null; } diff --git a/src/api/resources/bookings/client/requests/CreateBookingRequest.ts b/src/api/resources/bookings/client/requests/CreateBookingRequest.ts index f02b87e0c..3b06fd4e4 100644 --- a/src/api/resources/bookings/client/requests/CreateBookingRequest.ts +++ b/src/api/resources/bookings/client/requests/CreateBookingRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -12,7 +12,7 @@ import * as Square from "../../../../index"; */ export interface CreateBookingRequest { /** A unique key to make this request an idempotent operation. */ - idempotencyKey?: string; + idempotency_key?: string; /** The details of the booking to be created. */ booking: Square.Booking; } diff --git a/src/api/resources/bookings/client/requests/GetBookingsRequest.ts b/src/api/resources/bookings/client/requests/GetBookingsRequest.ts index f30022de8..f66697652 100644 --- a/src/api/resources/bookings/client/requests/GetBookingsRequest.ts +++ b/src/api/resources/bookings/client/requests/GetBookingsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * bookingId: "booking_id" + * booking_id: "booking_id" * } */ export interface GetBookingsRequest { /** * The ID of the [Booking](entity:Booking) object representing the to-be-retrieved booking. */ - bookingId: string; + booking_id: string; } diff --git a/src/api/resources/bookings/client/requests/ListBookingsRequest.ts b/src/api/resources/bookings/client/requests/ListBookingsRequest.ts index e57f99b22..1bb5af0b6 100644 --- a/src/api/resources/bookings/client/requests/ListBookingsRequest.ts +++ b/src/api/resources/bookings/client/requests/ListBookingsRequest.ts @@ -18,21 +18,21 @@ export interface ListBookingsRequest { /** * The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved. */ - customerId?: string | null; + customer_id?: string | null; /** * The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved. */ - teamMemberId?: string | null; + team_member_id?: string | null; /** * The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved. */ - locationId?: string | null; + location_id?: 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; + start_at_min?: 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; + start_at_max?: string | null; } diff --git a/src/api/resources/bookings/client/requests/RetrieveLocationBookingProfileRequest.ts b/src/api/resources/bookings/client/requests/RetrieveLocationBookingProfileRequest.ts index c53c91d78..7e992b6fa 100644 --- a/src/api/resources/bookings/client/requests/RetrieveLocationBookingProfileRequest.ts +++ b/src/api/resources/bookings/client/requests/RetrieveLocationBookingProfileRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface RetrieveLocationBookingProfileRequest { /** * The ID of the location to retrieve the booking profile. */ - locationId: string; + location_id: string; } diff --git a/src/api/resources/bookings/client/requests/SearchAvailabilityRequest.ts b/src/api/resources/bookings/client/requests/SearchAvailabilityRequest.ts index 50bc2efd8..cae76174f 100644 --- a/src/api/resources/bookings/client/requests/SearchAvailabilityRequest.ts +++ b/src/api/resources/bookings/client/requests/SearchAvailabilityRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * query: { * filter: { - * startAtRange: {} + * start_at_range: {} * } * } * } diff --git a/src/api/resources/bookings/client/requests/UpdateBookingRequest.ts b/src/api/resources/bookings/client/requests/UpdateBookingRequest.ts index 3ed17fbab..95400b439 100644 --- a/src/api/resources/bookings/client/requests/UpdateBookingRequest.ts +++ b/src/api/resources/bookings/client/requests/UpdateBookingRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * bookingId: "booking_id", + * booking_id: "booking_id", * booking: {} * } */ @@ -15,9 +15,9 @@ export interface UpdateBookingRequest { /** * The ID of the [Booking](entity:Booking) object representing the to-be-updated booking. */ - bookingId: string; + booking_id: string; /** A unique key to make this request an idempotent operation. */ - idempotencyKey?: string | null; + idempotency_key?: 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 index 3c416a42f..61a3bbb3c 100644 --- a/src/api/resources/bookings/client/requests/index.ts +++ b/src/api/resources/bookings/client/requests/index.ts @@ -1,9 +1,9 @@ -export { type ListBookingsRequest } from "./ListBookingsRequest"; -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 GetBookingsRequest } from "./GetBookingsRequest"; -export { type UpdateBookingRequest } from "./UpdateBookingRequest"; -export { type CancelBookingRequest } from "./CancelBookingRequest"; +export { type ListBookingsRequest } from "./ListBookingsRequest.js"; +export { type CreateBookingRequest } from "./CreateBookingRequest.js"; +export { type SearchAvailabilityRequest } from "./SearchAvailabilityRequest.js"; +export { type BulkRetrieveBookingsRequest } from "./BulkRetrieveBookingsRequest.js"; +export { type RetrieveLocationBookingProfileRequest } from "./RetrieveLocationBookingProfileRequest.js"; +export { type BulkRetrieveTeamMemberBookingProfilesRequest } from "./BulkRetrieveTeamMemberBookingProfilesRequest.js"; +export { type GetBookingsRequest } from "./GetBookingsRequest.js"; +export { type UpdateBookingRequest } from "./UpdateBookingRequest.js"; +export { type CancelBookingRequest } from "./CancelBookingRequest.js"; diff --git a/src/api/resources/bookings/index.ts b/src/api/resources/bookings/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/bookings/index.ts +++ b/src/api/resources/bookings/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts index 46ac33927..688f366c2 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributeDefinitions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributeDefinitions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributeDefinitions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributeDefinitions { - constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + protected readonly _options: CustomAttributeDefinitions.Options; + + constructor(_options: CustomAttributeDefinitions.Options = {}) { + this._options = _options; + } /** * Get all bookings custom attribute definitions. @@ -53,81 +58,82 @@ export class CustomAttributeDefinitions { request: Square.bookings.ListCustomAttributeDefinitionsRequest = {}, requestOptions?: CustomAttributeDefinitions.RequestOptions, ): Promise> { - const list = async ( - request: Square.bookings.ListCustomAttributeDefinitionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.bookings.ListCustomAttributeDefinitionsRequest, + ): 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListBookingCustomAttributeDefinitionsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable< Square.ListBookingCustomAttributeDefinitionsResponse, Square.CustomAttributeDefinition >({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributeDefinitions ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attribute_definitions ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -148,56 +154,55 @@ export class CustomAttributeDefinitions { * * @example * await client.bookings.customAttributeDefinitions.create({ - * customAttributeDefinition: {} + * custom_attribute_definition: {} * }) */ - public async create( + public create( request: Square.bookings.CreateBookingCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.bookings.CreateBookingCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.bookings.CreateBookingCustomAttributeDefinitionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateBookingCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -206,6 +211,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -214,6 +220,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -232,10 +239,17 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async get( + public get( request: Square.bookings.GetCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.bookings.GetCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { const { key, version } = request; const _queryParams: Record = {}; if (version !== undefined) { @@ -243,45 +257,38 @@ export class CustomAttributeDefinitions { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveBookingCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -290,6 +297,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -298,6 +306,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -317,57 +326,56 @@ export class CustomAttributeDefinitions { * @example * await client.bookings.customAttributeDefinitions.update({ * key: "key", - * customAttributeDefinition: {} + * custom_attribute_definition: {} * }) */ - public async update( + public update( + request: Square.bookings.UpdateBookingCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.bookings.UpdateBookingCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.bookings.UpdateBookingCustomAttributeDefinitionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateBookingCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -376,6 +384,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -384,6 +393,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -405,50 +415,50 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async delete( + public delete( + request: Square.bookings.DeleteCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.bookings.DeleteCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteBookingCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -457,6 +467,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -465,6 +476,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/index.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts index 9ca4428e5..ddfad27fe 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * customAttributeDefinition: {} + * custom_attribute_definition: {} * } */ export interface CreateBookingCustomAttributeDefinitionRequest { @@ -28,10 +28,10 @@ export interface CreateBookingCustomAttributeDefinitionRequest { * 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; + custom_attribute_definition: 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; + idempotency_key?: string; } diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts index ec3f3cb5a..9ddd73482 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * key: "key", - * customAttributeDefinition: {} + * custom_attribute_definition: {} * } */ export interface UpdateBookingCustomAttributeDefinitionRequest { @@ -30,10 +30,10 @@ export interface UpdateBookingCustomAttributeDefinitionRequest { * 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; + custom_attribute_definition: 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; + idempotency_key?: 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 index 0dd526820..4c0fd5bc1 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest"; -export { type CreateBookingCustomAttributeDefinitionRequest } from "./CreateBookingCustomAttributeDefinitionRequest"; -export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest"; -export { type UpdateBookingCustomAttributeDefinitionRequest } from "./UpdateBookingCustomAttributeDefinitionRequest"; -export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest"; +export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest.js"; +export { type CreateBookingCustomAttributeDefinitionRequest } from "./CreateBookingCustomAttributeDefinitionRequest.js"; +export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest.js"; +export { type UpdateBookingCustomAttributeDefinitionRequest } from "./UpdateBookingCustomAttributeDefinitionRequest.js"; +export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest.js"; diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/index.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/index.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/bookings/resources/customAttributes/client/Client.ts b/src/api/resources/bookings/resources/customAttributes/client/Client.ts index 2bdad8288..ece21735c 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/Client.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributes { - constructor(protected readonly _options: CustomAttributes.Options = {}) {} + protected readonly _options: CustomAttributes.Options; + + constructor(_options: CustomAttributes.Options = {}) { + this._options = _options; + } /** * Bulk deletes bookings custom attributes. @@ -53,59 +58,58 @@ export class CustomAttributes { * await client.bookings.customAttributes.batchDelete({ * values: { * "key": { - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key" * } * } * }) */ - public async batchDelete( + public batchDelete( request: Square.bookings.BulkDeleteBookingCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchDelete(request, requestOptions)); + } + + private async __batchDelete( + request: Square.bookings.BulkDeleteBookingCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.bookings.BulkDeleteBookingCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkDeleteBookingCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -114,6 +118,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -122,6 +127,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -142,59 +148,58 @@ export class CustomAttributes { * await client.bookings.customAttributes.batchUpsert({ * values: { * "key": { - * bookingId: "booking_id", - * customAttribute: {} + * booking_id: "booking_id", + * custom_attribute: {} * } * } * }) */ - public async batchUpsert( + public batchUpsert( + request: Square.bookings.BulkUpsertBookingCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpsert(request, requestOptions)); + } + + private async __batchUpsert( request: Square.bookings.BulkUpsertBookingCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.bookings.BulkUpsertBookingCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkUpsertBookingCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -203,6 +208,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -211,6 +217,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -226,88 +233,89 @@ export class CustomAttributes { * * @example * await client.bookings.customAttributes.list({ - * bookingId: "booking_id" + * booking_id: "booking_id" * }) */ public async list( request: Square.bookings.ListCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, ): Promise> { - const list = async ( - request: Square.bookings.ListCustomAttributesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.bookings.ListCustomAttributesRequest, + ): Promise> => { + const { booking_id: bookingId, limit, cursor, with_definitions: 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListBookingCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributes ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attributes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -325,15 +333,22 @@ export class CustomAttributes { * * @example * await client.bookings.customAttributes.get({ - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key" * }) */ - public async get( + public get( + request: Square.bookings.GetCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.bookings.GetCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { bookingId, key, withDefinition, version } = request; + ): Promise> { + const { booking_id: bookingId, key, with_definition: withDefinition, version } = request; const _queryParams: Record = {}; if (withDefinition !== undefined) { _queryParams["with_definition"] = withDefinition?.toString() ?? null; @@ -344,45 +359,38 @@ export class CustomAttributes { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveBookingCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -391,6 +399,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -399,6 +408,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -417,59 +427,58 @@ export class CustomAttributes { * * @example * await client.bookings.customAttributes.upsert({ - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key", - * customAttribute: {} + * custom_attribute: {} * }) */ - public async upsert( + public upsert( request: Square.bookings.UpsertBookingCustomAttributeRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { bookingId, key, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions)); + } + + private async __upsert( + request: Square.bookings.UpsertBookingCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { booking_id: bookingId, key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.bookings.UpsertBookingCustomAttributeRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpsertBookingCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -478,6 +487,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -486,6 +496,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -504,54 +515,54 @@ export class CustomAttributes { * * @example * await client.bookings.customAttributes.delete({ - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key" * }) */ - public async delete( + public delete( + request: Square.bookings.DeleteCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.bookings.DeleteCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { bookingId, key } = request; + ): Promise> { + const { booking_id: bookingId, key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteBookingCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -560,6 +571,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -568,6 +580,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/bookings/resources/customAttributes/client/index.ts b/src/api/resources/bookings/resources/customAttributes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/index.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts index dd626b7a9..14a2c1b41 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * values: { * "key": { - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key" * } * } diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts index fca36bbb3..e47cf3566 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * values: { * "key": { - * bookingId: "booking_id", - * customAttribute: {} + * booking_id: "booking_id", + * custom_attribute: {} * } * } * } diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts index 1e6be8d91..cd4907f04 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface DeleteCustomAttributesRequest { /** * The ID of the target [booking](entity:Booking). */ - bookingId: string; + booking_id: 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 diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts index 540eb8c10..f458ee7a0 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface GetCustomAttributesRequest { /** * The ID of the target [booking](entity:Booking). */ - bookingId: string; + booking_id: 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 @@ -25,7 +25,7 @@ export interface GetCustomAttributesRequest { * 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; + with_definition?: 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 diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts index ec23db686..3096631d6 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * bookingId: "booking_id" + * booking_id: "booking_id" * } */ export interface ListCustomAttributesRequest { /** * The ID of the target [booking](entity:Booking). */ - bookingId: string; + booking_id: 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. @@ -30,5 +30,5 @@ export interface ListCustomAttributesRequest { * 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; + with_definitions?: 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 index b65cfb25c..d42b642ec 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * bookingId: "booking_id", + * booking_id: "booking_id", * key: "key", - * customAttribute: {} + * custom_attribute: {} * } */ export interface UpsertBookingCustomAttributeRequest { /** * The ID of the target [booking](entity:Booking). */ - bookingId: string; + booking_id: 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 @@ -33,10 +33,10 @@ export interface UpsertBookingCustomAttributeRequest { * control for an update operation, include this optional field and specify the current version * of the custom attribute. */ - customAttribute: Square.CustomAttribute; + custom_attribute: 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; + idempotency_key?: 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 index 3e49e8cbc..20483005e 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/index.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type BulkDeleteBookingCustomAttributesRequest } from "./BulkDeleteBookingCustomAttributesRequest"; -export { type BulkUpsertBookingCustomAttributesRequest } from "./BulkUpsertBookingCustomAttributesRequest"; -export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest"; -export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest"; -export { type UpsertBookingCustomAttributeRequest } from "./UpsertBookingCustomAttributeRequest"; -export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest"; +export { type BulkDeleteBookingCustomAttributesRequest } from "./BulkDeleteBookingCustomAttributesRequest.js"; +export { type BulkUpsertBookingCustomAttributesRequest } from "./BulkUpsertBookingCustomAttributesRequest.js"; +export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest.js"; +export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest.js"; +export { type UpsertBookingCustomAttributeRequest } from "./UpsertBookingCustomAttributeRequest.js"; +export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest.js"; diff --git a/src/api/resources/bookings/resources/customAttributes/index.ts b/src/api/resources/bookings/resources/customAttributes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/bookings/resources/customAttributes/index.ts +++ b/src/api/resources/bookings/resources/customAttributes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/bookings/resources/index.ts b/src/api/resources/bookings/resources/index.ts index f4f82dee8..e3b708588 100644 --- a/src/api/resources/bookings/resources/index.ts +++ b/src/api/resources/bookings/resources/index.ts @@ -1,8 +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"; +export * as customAttributeDefinitions from "./customAttributeDefinitions/index.js"; +export * as customAttributes from "./customAttributes/index.js"; +export * as locationProfiles from "./locationProfiles/index.js"; +export * as teamMemberProfiles from "./teamMemberProfiles/index.js"; +export * from "./customAttributeDefinitions/client/requests/index.js"; +export * from "./customAttributes/client/requests/index.js"; +export * from "./locationProfiles/client/requests/index.js"; +export * from "./teamMemberProfiles/client/requests/index.js"; diff --git a/src/api/resources/bookings/resources/locationProfiles/client/Client.ts b/src/api/resources/bookings/resources/locationProfiles/client/Client.ts index 4ec1fc95d..94ec90f40 100644 --- a/src/api/resources/bookings/resources/locationProfiles/client/Client.ts +++ b/src/api/resources/bookings/resources/locationProfiles/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace LocationProfiles { export interface Options { @@ -17,6 +16,8 @@ export declare namespace LocationProfiles { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace LocationProfiles { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class LocationProfiles { - constructor(protected readonly _options: LocationProfiles.Options = {}) {} + protected readonly _options: LocationProfiles.Options; + + constructor(_options: LocationProfiles.Options = {}) { + this._options = _options; + } /** * Lists location booking profiles of a seller. @@ -50,78 +55,79 @@ export class LocationProfiles { request: Square.bookings.ListLocationProfilesRequest = {}, requestOptions?: LocationProfiles.RequestOptions, ): Promise> { - const list = async ( - request: Square.bookings.ListLocationProfilesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.bookings.ListLocationProfilesRequest, + ): 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListLocationBookingProfilesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.locationBookingProfiles ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.location_booking_profiles ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, diff --git a/src/api/resources/bookings/resources/locationProfiles/client/index.ts b/src/api/resources/bookings/resources/locationProfiles/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/bookings/resources/locationProfiles/client/index.ts +++ b/src/api/resources/bookings/resources/locationProfiles/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/bookings/resources/locationProfiles/client/requests/index.ts b/src/api/resources/bookings/resources/locationProfiles/client/requests/index.ts index f3f432a40..09a22ccc8 100644 --- a/src/api/resources/bookings/resources/locationProfiles/client/requests/index.ts +++ b/src/api/resources/bookings/resources/locationProfiles/client/requests/index.ts @@ -1 +1 @@ -export { type ListLocationProfilesRequest } from "./ListLocationProfilesRequest"; +export { type ListLocationProfilesRequest } from "./ListLocationProfilesRequest.js"; diff --git a/src/api/resources/bookings/resources/locationProfiles/index.ts b/src/api/resources/bookings/resources/locationProfiles/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/bookings/resources/locationProfiles/index.ts +++ b/src/api/resources/bookings/resources/locationProfiles/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts index b3dcd8fc4..2cc26de37 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace TeamMemberProfiles { export interface Options { @@ -17,6 +16,8 @@ export declare namespace TeamMemberProfiles { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace TeamMemberProfiles { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class TeamMemberProfiles { - constructor(protected readonly _options: TeamMemberProfiles.Options = {}) {} + protected readonly _options: TeamMemberProfiles.Options; + + constructor(_options: TeamMemberProfiles.Options = {}) { + this._options = _options; + } /** * Lists booking profiles for team members. @@ -50,84 +55,85 @@ export class TeamMemberProfiles { request: Square.bookings.ListTeamMemberProfilesRequest = {}, requestOptions?: TeamMemberProfiles.RequestOptions, ): Promise> { - const list = async ( - request: Square.bookings.ListTeamMemberProfilesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.bookings.ListTeamMemberProfilesRequest, + ): Promise> => { + const { bookable_only: bookableOnly, limit, cursor, location_id: 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListTeamMemberBookingProfilesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.teamMemberBookingProfiles ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.team_member_booking_profiles ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -142,53 +148,53 @@ export class TeamMemberProfiles { * * @example * await client.bookings.teamMemberProfiles.get({ - * teamMemberId: "team_member_id" + * team_member_id: "team_member_id" * }) */ - public async get( + public get( + request: Square.bookings.GetTeamMemberProfilesRequest, + requestOptions?: TeamMemberProfiles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.bookings.GetTeamMemberProfilesRequest, requestOptions?: TeamMemberProfiles.RequestOptions, - ): Promise { - const { teamMemberId } = request; + ): Promise> { + const { team_member_id: teamMemberId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetTeamMemberBookingProfileResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -197,6 +203,7 @@ export class TeamMemberProfiles { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -205,6 +212,7 @@ export class TeamMemberProfiles { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/index.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/client/index.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/GetTeamMemberProfilesRequest.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/GetTeamMemberProfilesRequest.ts index 8c0e22128..827207556 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/GetTeamMemberProfilesRequest.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/GetTeamMemberProfilesRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * teamMemberId: "team_member_id" + * team_member_id: "team_member_id" * } */ export interface GetTeamMemberProfilesRequest { /** * The ID of the team member to retrieve. */ - teamMemberId: string; + team_member_id: string; } diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/ListTeamMemberProfilesRequest.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/ListTeamMemberProfilesRequest.ts index 126643f74..381143564 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/ListTeamMemberProfilesRequest.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/ListTeamMemberProfilesRequest.ts @@ -10,7 +10,7 @@ export interface ListTeamMemberProfilesRequest { /** * Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). */ - bookableOnly?: boolean | null; + bookable_only?: boolean | null; /** * The maximum number of results to return in a paged response. */ @@ -22,5 +22,5 @@ export interface ListTeamMemberProfilesRequest { /** * Indicates whether to include only team members enabled at the given location in the returned result. */ - locationId?: string | null; + location_id?: 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 index 4a2788242..4be4475da 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/index.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListTeamMemberProfilesRequest } from "./ListTeamMemberProfilesRequest"; -export { type GetTeamMemberProfilesRequest } from "./GetTeamMemberProfilesRequest"; +export { type ListTeamMemberProfilesRequest } from "./ListTeamMemberProfilesRequest.js"; +export { type GetTeamMemberProfilesRequest } from "./GetTeamMemberProfilesRequest.js"; diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/index.ts b/src/api/resources/bookings/resources/teamMemberProfiles/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/index.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/cards/client/Client.ts b/src/api/resources/cards/client/Client.ts index f9f7ac900..85495185f 100644 --- a/src/api/resources/cards/client/Client.ts +++ b/src/api/resources/cards/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Cards { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Cards { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Cards { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Cards { - constructor(protected readonly _options: Cards.Options = {}) {} + protected readonly _options: Cards.Options; + + constructor(_options: Cards.Options = {}) { + this._options = _options; + } /** * Retrieves a list of cards owned by the account making the request. @@ -51,85 +56,86 @@ export class Cards { request: Square.ListCardsRequest = {}, requestOptions?: Cards.RequestOptions, ): Promise> { - const list = async (request: Square.ListCardsRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListCardsRequest): Promise> => { + const { + cursor, + customer_id: customerId, + include_disabled: includeDisabled, + reference_id: referenceId, + sort_order: 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"] = sortOrder; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/cards", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListCardsResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/cards."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.cards ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -145,70 +151,66 @@ export class Cards { * * @example * await client.cards.create({ - * idempotencyKey: "4935a656-a929-4792-b97c-8848be85c27c", - * sourceId: "cnon:uIbfJXhXETSP197M3GB", + * idempotency_key: "4935a656-a929-4792-b97c-8848be85c27c", + * source_id: "cnon:uIbfJXhXETSP197M3GB", * card: { - * cardholderName: "Amelia Earhart", - * billingAddress: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * cardholder_name: "Amelia Earhart", + * billing_address: { + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * customerId: "VDKXEEKPJN48QDG3BGGFAK05P8", - * referenceId: "user-id-1" + * customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + * reference_id: "user-id-1" * } * }) */ - public async create( + public create( + request: Square.CreateCardRequest, + requestOptions?: Cards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.CreateCardRequest, requestOptions?: Cards.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateCardRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateCardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -217,12 +219,14 @@ export class Cards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/cards."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -235,53 +239,50 @@ export class Cards { * * @example * await client.cards.get({ - * cardId: "card_id" + * card_id: "card_id" * }) */ - public async get( + public get( request: Square.GetCardsRequest, requestOptions?: Cards.RequestOptions, - ): Promise { - const { cardId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetCardsRequest, + requestOptions?: Cards.RequestOptions, + ): Promise> { + const { card_id: cardId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetCardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -290,12 +291,14 @@ export class Cards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -309,53 +312,50 @@ export class Cards { * * @example * await client.cards.disable({ - * cardId: "card_id" + * card_id: "card_id" * }) */ - public async disable( + public disable( request: Square.DisableCardsRequest, requestOptions?: Cards.RequestOptions, - ): Promise { - const { cardId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__disable(request, requestOptions)); + } + + private async __disable( + request: Square.DisableCardsRequest, + requestOptions?: Cards.RequestOptions, + ): Promise> { + const { card_id: cardId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DisableCardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -364,12 +364,14 @@ export class Cards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/cards/client/index.ts b/src/api/resources/cards/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/cards/client/index.ts +++ b/src/api/resources/cards/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/cards/client/requests/CreateCardRequest.ts b/src/api/resources/cards/client/requests/CreateCardRequest.ts index 54ac6b9bf..81b326622 100644 --- a/src/api/resources/cards/client/requests/CreateCardRequest.ts +++ b/src/api/resources/cards/client/requests/CreateCardRequest.ts @@ -2,25 +2,25 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "4935a656-a929-4792-b97c-8848be85c27c", - * sourceId: "cnon:uIbfJXhXETSP197M3GB", + * idempotency_key: "4935a656-a929-4792-b97c-8848be85c27c", + * source_id: "cnon:uIbfJXhXETSP197M3GB", * card: { - * cardholderName: "Amelia Earhart", - * billingAddress: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * cardholder_name: "Amelia Earhart", + * billing_address: { + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * customerId: "VDKXEEKPJN48QDG3BGGFAK05P8", - * referenceId: "user-id-1" + * customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + * reference_id: "user-id-1" * } * } */ @@ -33,9 +33,9 @@ export interface CreateCardRequest { * * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: 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; + source_id: 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 @@ -43,7 +43,7 @@ export interface CreateCardRequest { * * See the [SCA Overview](https://developer.squareup.com/docs/sca-overview). */ - verificationToken?: string; + verification_token?: string; /** Payment details associated with the card to be stored. */ card: Square.Card; } diff --git a/src/api/resources/cards/client/requests/DisableCardsRequest.ts b/src/api/resources/cards/client/requests/DisableCardsRequest.ts index 7a96d92d9..17b7cde26 100644 --- a/src/api/resources/cards/client/requests/DisableCardsRequest.ts +++ b/src/api/resources/cards/client/requests/DisableCardsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * cardId: "card_id" + * card_id: "card_id" * } */ export interface DisableCardsRequest { /** * Unique ID for the desired Card. */ - cardId: string; + card_id: string; } diff --git a/src/api/resources/cards/client/requests/GetCardsRequest.ts b/src/api/resources/cards/client/requests/GetCardsRequest.ts index c5d067993..c2cfb0e49 100644 --- a/src/api/resources/cards/client/requests/GetCardsRequest.ts +++ b/src/api/resources/cards/client/requests/GetCardsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * cardId: "card_id" + * card_id: "card_id" * } */ export interface GetCardsRequest { /** * Unique ID for the desired Card. */ - cardId: string; + card_id: string; } diff --git a/src/api/resources/cards/client/requests/ListCardsRequest.ts b/src/api/resources/cards/client/requests/ListCardsRequest.ts index 44df40e49..e2328ad16 100644 --- a/src/api/resources/cards/client/requests/ListCardsRequest.ts +++ b/src/api/resources/cards/client/requests/ListCardsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -20,19 +20,19 @@ export interface ListCardsRequest { * Limit results to cards associated with the customer supplied. * By default, all cards owned by the merchant are returned. */ - customerId?: string | null; + customer_id?: string | null; /** * Includes disabled cards. * By default, all enabled cards owned by the merchant are returned. */ - includeDisabled?: boolean | null; + include_disabled?: boolean | null; /** * Limit results to cards associated with the reference_id supplied. */ - referenceId?: string | null; + reference_id?: 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; + sort_order?: Square.SortOrder | null; } diff --git a/src/api/resources/cards/client/requests/index.ts b/src/api/resources/cards/client/requests/index.ts index 5fb9592cd..bc18d5392 100644 --- a/src/api/resources/cards/client/requests/index.ts +++ b/src/api/resources/cards/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type ListCardsRequest } from "./ListCardsRequest"; -export { type CreateCardRequest } from "./CreateCardRequest"; -export { type GetCardsRequest } from "./GetCardsRequest"; -export { type DisableCardsRequest } from "./DisableCardsRequest"; +export { type ListCardsRequest } from "./ListCardsRequest.js"; +export { type CreateCardRequest } from "./CreateCardRequest.js"; +export { type GetCardsRequest } from "./GetCardsRequest.js"; +export { type DisableCardsRequest } from "./DisableCardsRequest.js"; diff --git a/src/api/resources/cards/index.ts b/src/api/resources/cards/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/cards/index.ts +++ b/src/api/resources/cards/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/cashDrawers/client/Client.ts b/src/api/resources/cashDrawers/client/Client.ts index a549c4509..e3a992fee 100644 --- a/src/api/resources/cashDrawers/client/Client.ts +++ b/src/api/resources/cashDrawers/client/Client.ts @@ -2,9 +2,9 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import { Shifts } from "../resources/shifts/client/Client.js"; export declare namespace CashDrawers { export interface Options { @@ -14,27 +14,19 @@ export declare namespace CashDrawers { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; 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-07-16"; - /** Additional headers to include in the request. */ - headers?: Record; - } } export class CashDrawers { + protected readonly _options: CashDrawers.Options; protected _shifts: Shifts | undefined; - constructor(protected readonly _options: CashDrawers.Options = {}) {} + constructor(_options: CashDrawers.Options = {}) { + this._options = _options; + } public get shifts(): Shifts { return (this._shifts ??= new Shifts(this._options)); diff --git a/src/api/resources/cashDrawers/index.ts b/src/api/resources/cashDrawers/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/cashDrawers/index.ts +++ b/src/api/resources/cashDrawers/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/cashDrawers/resources/index.ts b/src/api/resources/cashDrawers/resources/index.ts index 1e7da9b44..b25892811 100644 --- a/src/api/resources/cashDrawers/resources/index.ts +++ b/src/api/resources/cashDrawers/resources/index.ts @@ -1,2 +1,2 @@ -export * as shifts from "./shifts"; -export * from "./shifts/client/requests"; +export * as shifts from "./shifts/index.js"; +export * from "./shifts/client/requests/index.js"; diff --git a/src/api/resources/cashDrawers/resources/shifts/client/Client.ts b/src/api/resources/cashDrawers/resources/shifts/client/Client.ts index af2d438b4..404bff47c 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/Client.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Shifts { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Shifts { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Shifts { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Shifts { - constructor(protected readonly _options: Shifts.Options = {}) {} + protected readonly _options: Shifts.Options; + + constructor(_options: Shifts.Options = {}) { + this._options = _options; + } /** * Provides the details for all of the cash drawer shifts for a location @@ -46,96 +51,103 @@ export class Shifts { * * @example * await client.cashDrawers.shifts.list({ - * locationId: "location_id" + * location_id: "location_id" * }) */ public async list( request: Square.cashDrawers.ListShiftsRequest, requestOptions?: Shifts.RequestOptions, ): Promise> { - const list = async ( - request: Square.cashDrawers.ListShiftsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.cashDrawers.ListShiftsRequest, + ): Promise> => { + const { + location_id: locationId, + sort_order: sortOrder, + begin_time: beginTime, + end_time: endTime, + limit, + cursor, + } = request; + const _queryParams: Record = {}; + _queryParams["location_id"] = locationId; + if (sortOrder !== undefined) { + _queryParams["sort_order"] = sortOrder; + } + 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/cash-drawers/shifts", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListCashDrawerShiftsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.cashDrawerShifts ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.cash_drawer_shifts ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -151,57 +163,54 @@ export class Shifts { * * @example * await client.cashDrawers.shifts.get({ - * shiftId: "shift_id", - * locationId: "location_id" + * shift_id: "shift_id", + * location_id: "location_id" * }) */ - public async get( + public get( request: Square.cashDrawers.GetShiftsRequest, requestOptions?: Shifts.RequestOptions, - ): Promise { - const { shiftId, locationId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.cashDrawers.GetShiftsRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise> { + const { shift_id: shiftId, location_id: locationId } = request; const _queryParams: Record = {}; _queryParams["location_id"] = locationId; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetCashDrawerShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -210,6 +219,7 @@ export class Shifts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -218,6 +228,7 @@ export class Shifts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -230,87 +241,88 @@ export class Shifts { * * @example * await client.cashDrawers.shifts.listEvents({ - * shiftId: "shift_id", - * locationId: "location_id" + * shift_id: "shift_id", + * location_id: "location_id" * }) */ public async listEvents( request: Square.cashDrawers.ListEventsShiftsRequest, requestOptions?: Shifts.RequestOptions, ): Promise> { - const list = async ( - request: Square.cashDrawers.ListEventsShiftsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.cashDrawers.ListEventsShiftsRequest, + ): Promise> => { + const { shift_id: shiftId, location_id: 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListCashDrawerShiftEventsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.cashDrawerShiftEvents ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.cash_drawer_shift_events ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, diff --git a/src/api/resources/cashDrawers/resources/shifts/client/index.ts b/src/api/resources/cashDrawers/resources/shifts/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/index.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/GetShiftsRequest.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/GetShiftsRequest.ts index 3f84d4aac..8e194555e 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/requests/GetShiftsRequest.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/GetShiftsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * shiftId: "shift_id", - * locationId: "location_id" + * shift_id: "shift_id", + * location_id: "location_id" * } */ export interface GetShiftsRequest { /** * The shift ID. */ - shiftId: string; + shift_id: string; /** * The ID of the location to retrieve cash drawer shifts from. */ - locationId: string; + location_id: string; } diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/ListEventsShiftsRequest.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/ListEventsShiftsRequest.ts index 33d092715..04767719f 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/requests/ListEventsShiftsRequest.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/ListEventsShiftsRequest.ts @@ -5,19 +5,19 @@ /** * @example * { - * shiftId: "shift_id", - * locationId: "location_id" + * shift_id: "shift_id", + * location_id: "location_id" * } */ export interface ListEventsShiftsRequest { /** * The shift ID. */ - shiftId: string; + shift_id: string; /** * The ID of the location to list cash drawer shifts for. */ - locationId: string; + location_id: string; /** * Number of resources to be returned in a page of results (200 by * default, 1000 max). diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/ListShiftsRequest.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/ListShiftsRequest.ts index a7ef994f1..f4d219867 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/requests/ListShiftsRequest.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/ListShiftsRequest.ts @@ -2,32 +2,32 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface ListShiftsRequest { /** * The ID of the location to query for a list of cash drawer shifts. */ - locationId: string; + location_id: 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; + sort_order?: Square.SortOrder | null; /** * The inclusive start time of the query on opened_at, in ISO 8601 format. */ - beginTime?: string | null; + begin_time?: string | null; /** * The exclusive end date of the query on opened_at, in ISO 8601 format. */ - endTime?: string | null; + end_time?: string | null; /** * Number of cash drawer shift events in a page of results (200 by * default, 1000 max). diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/index.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/index.ts index c69b4133d..97ce5aedb 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/requests/index.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type ListShiftsRequest } from "./ListShiftsRequest"; -export { type GetShiftsRequest } from "./GetShiftsRequest"; -export { type ListEventsShiftsRequest } from "./ListEventsShiftsRequest"; +export { type ListShiftsRequest } from "./ListShiftsRequest.js"; +export { type GetShiftsRequest } from "./GetShiftsRequest.js"; +export { type ListEventsShiftsRequest } from "./ListEventsShiftsRequest.js"; diff --git a/src/api/resources/cashDrawers/resources/shifts/index.ts b/src/api/resources/cashDrawers/resources/shifts/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/cashDrawers/resources/shifts/index.ts +++ b/src/api/resources/cashDrawers/resources/shifts/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/catalog/client/Client.ts b/src/api/resources/catalog/client/Client.ts index 986b1e086..2c13d3e9f 100644 --- a/src/api/resources/catalog/client/Client.ts +++ b/src/api/resources/catalog/client/Client.ts @@ -2,14 +2,13 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { Images } from "../resources/images/client/Client.js"; +import { Object_ } from "../resources/object/client/Client.js"; export declare namespace Catalog { export interface Options { @@ -19,6 +18,8 @@ export declare namespace Catalog { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -32,15 +33,18 @@ export declare namespace Catalog { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Catalog { + protected readonly _options: Catalog.Options; protected _images: Images | undefined; protected _object: Object_ | undefined; - constructor(protected readonly _options: Catalog.Options = {}) {} + constructor(_options: Catalog.Options = {}) { + this._options = _options; + } public get images(): Images { return (this._images ??= new Images(this._options)); @@ -71,56 +75,55 @@ export class Catalog { * * @example * await client.catalog.batchDelete({ - * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"] + * object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"] * }) */ - public async batchDelete( + public batchDelete( + request: Square.BatchDeleteCatalogObjectsRequest, + requestOptions?: Catalog.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchDelete(request, requestOptions)); + } + + private async __batchDelete( request: Square.BatchDeleteCatalogObjectsRequest, requestOptions?: Catalog.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchDeleteCatalogObjectsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchDeleteCatalogObjectsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -129,12 +132,14 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -152,57 +157,56 @@ export class Catalog { * * @example * await client.catalog.batchGet({ - * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], - * includeRelatedObjects: true + * object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + * include_related_objects: true * }) */ - public async batchGet( + public batchGet( request: Square.BatchGetCatalogObjectsRequest, requestOptions?: Catalog.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchGet(request, requestOptions)); + } + + private async __batchGet( + request: Square.BatchGetCatalogObjectsRequest, + requestOptions?: Catalog.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchGetCatalogObjectsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchGetCatalogObjectsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -211,12 +215,14 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -241,7 +247,7 @@ export class Catalog { * * @example * await client.catalog.batchUpsert({ - * idempotencyKey: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + * idempotency_key: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", * batches: [{ * objects: [{ * type: "ITEM", @@ -259,53 +265,52 @@ export class Catalog { * }] * }) */ - public async batchUpsert( + public batchUpsert( request: Square.BatchUpsertCatalogObjectsRequest, requestOptions?: Catalog.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpsert(request, requestOptions)); + } + + private async __batchUpsert( + request: Square.BatchUpsertCatalogObjectsRequest, + requestOptions?: Catalog.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchUpsertCatalogObjectsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchUpsertCatalogObjectsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -314,12 +319,14 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -333,46 +340,42 @@ export class Catalog { * @example * await client.catalog.info() */ - public async info(requestOptions?: Catalog.RequestOptions): Promise { + public info(requestOptions?: Catalog.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__info(requestOptions)); + } + + private async __info( + requestOptions?: Catalog.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.CatalogInfoResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -381,12 +384,14 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/catalog/info."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -411,76 +416,74 @@ export class Catalog { request: Square.ListCatalogRequest = {}, requestOptions?: Catalog.RequestOptions, ): Promise> { - const list = async (request: Square.ListCatalogRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListCatalogRequest): Promise> => { + const { cursor, types, catalog_version: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/list", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListCatalogResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/catalog/list."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/catalog/list."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.objects ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -505,63 +508,59 @@ export class Catalog { * * @example * await client.catalog.search({ - * objectTypes: ["ITEM"], + * object_types: ["ITEM"], * query: { - * prefixQuery: { - * attributeName: "name", - * attributePrefix: "tea" + * prefix_query: { + * attribute_name: "name", + * attribute_prefix: "tea" * } * }, * limit: 100 * }) */ - public async search( + public search( request: Square.SearchCatalogObjectsRequest = {}, requestOptions?: Catalog.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.SearchCatalogObjectsRequest = {}, + requestOptions?: Catalog.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchCatalogObjectsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchCatalogObjectsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -570,12 +569,14 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/search."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -597,77 +598,73 @@ export class Catalog { * * @example * await client.catalog.searchItems({ - * textFilter: "red", - * categoryIds: ["WINE_CATEGORY_ID"], - * stockLevels: ["OUT", "LOW"], - * enabledLocationIds: ["ATL_LOCATION_ID"], + * text_filter: "red", + * category_ids: ["WINE_CATEGORY_ID"], + * stock_levels: ["OUT", "LOW"], + * enabled_location_ids: ["ATL_LOCATION_ID"], * limit: 100, - * sortOrder: "ASC", - * productTypes: ["REGULAR"], - * customAttributeFilters: [{ - * customAttributeDefinitionId: "VEGAN_DEFINITION_ID", - * boolFilter: true + * sort_order: "ASC", + * product_types: ["REGULAR"], + * custom_attribute_filters: [{ + * custom_attribute_definition_id: "VEGAN_DEFINITION_ID", + * bool_filter: true * }, { - * customAttributeDefinitionId: "BRAND_DEFINITION_ID", - * stringFilter: "Dark Horse" + * custom_attribute_definition_id: "BRAND_DEFINITION_ID", + * string_filter: "Dark Horse" * }, { * key: "VINTAGE", - * numberFilter: { + * number_filter: { * min: "min", * max: "max" * } * }, { - * customAttributeDefinitionId: "VARIETAL_DEFINITION_ID" + * custom_attribute_definition_id: "VARIETAL_DEFINITION_ID" * }] * }) */ - public async searchItems( + public searchItems( request: Square.SearchCatalogItemsRequest = {}, requestOptions?: Catalog.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchItems(request, requestOptions)); + } + + private async __searchItems( + request: Square.SearchCatalogItemsRequest = {}, + requestOptions?: Catalog.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchCatalogItemsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchCatalogItemsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -676,6 +673,7 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -684,6 +682,7 @@ export class Catalog { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -698,58 +697,57 @@ export class Catalog { * * @example * await client.catalog.updateItemModifierLists({ - * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - * modifierListsToEnable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - * modifierListsToDisable: ["7WRC16CJZDVLSNDQ35PP6YAD"] + * item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifier_lists_to_enable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifier_lists_to_disable: ["7WRC16CJZDVLSNDQ35PP6YAD"] * }) */ - public async updateItemModifierLists( + public updateItemModifierLists( request: Square.UpdateItemModifierListsRequest, requestOptions?: Catalog.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateItemModifierLists(request, requestOptions)); + } + + private async __updateItemModifierLists( + request: Square.UpdateItemModifierListsRequest, + requestOptions?: Catalog.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateItemModifierListsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.UpdateItemModifierListsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -758,6 +756,7 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -766,6 +765,7 @@ export class Catalog { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -780,58 +780,54 @@ export class Catalog { * * @example * await client.catalog.updateItemTaxes({ - * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - * taxesToEnable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], - * taxesToDisable: ["AQCEGCEBBQONINDOHRGZISEX"] + * item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * taxes_to_enable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + * taxes_to_disable: ["AQCEGCEBBQONINDOHRGZISEX"] * }) */ - public async updateItemTaxes( + public updateItemTaxes( + request: Square.UpdateItemTaxesRequest, + requestOptions?: Catalog.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateItemTaxes(request, requestOptions)); + } + + private async __updateItemTaxes( request: Square.UpdateItemTaxesRequest, requestOptions?: Catalog.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateItemTaxesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.UpdateItemTaxesResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -840,6 +836,7 @@ export class Catalog { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -848,6 +845,7 @@ export class Catalog { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/catalog/client/index.ts b/src/api/resources/catalog/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/catalog/client/index.ts +++ b/src/api/resources/catalog/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts index 5928375f6..5ddbec808 100644 --- a/src/api/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts +++ b/src/api/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"] + * object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"] * } */ export interface BatchDeleteCatalogObjectsRequest { @@ -14,5 +14,5 @@ export interface BatchDeleteCatalogObjectsRequest { * in the graph that depend on that object will be deleted as well (for example, deleting a * CatalogItem will delete its CatalogItemVariation. */ - objectIds: string[]; + object_ids: string[]; } diff --git a/src/api/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts index be6a46943..768c28253 100644 --- a/src/api/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts +++ b/src/api/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts @@ -5,13 +5,13 @@ /** * @example * { - * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], - * includeRelatedObjects: true + * object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + * include_related_objects: true * } */ export interface BatchGetCatalogObjectsRequest { /** The IDs of the CatalogObjects to be retrieved. */ - objectIds: string[]; + object_ids: 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 @@ -28,21 +28,21 @@ export interface BatchGetCatalogObjectsRequest { * * Default value: `false` */ - includeRelatedObjects?: boolean | null; + include_related_objects?: 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; + catalog_version?: (number | 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; + include_deleted_objects?: 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; + include_category_path_to_root?: boolean | null; } diff --git a/src/api/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts index 07bb27415..c25ac8606 100644 --- a/src/api/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts +++ b/src/api/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + * idempotency_key: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", * batches: [{ * objects: [{ * type: "ITEM", @@ -38,7 +38,7 @@ export interface BatchUpsertCatalogObjectsRequest { * * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: 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 diff --git a/src/api/resources/catalog/client/requests/ListCatalogRequest.ts b/src/api/resources/catalog/client/requests/ListCatalogRequest.ts index 5a2363cda..e01dbf3e1 100644 --- a/src/api/resources/catalog/client/requests/ListCatalogRequest.ts +++ b/src/api/resources/catalog/client/requests/ListCatalogRequest.ts @@ -36,5 +36,5 @@ export interface ListCatalogRequest { * the [CatalogObject](entity:CatalogObject)s' `version` attribute. If not included, results will be from the * current version of the catalog. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; } diff --git a/src/api/resources/catalog/client/requests/SearchCatalogItemsRequest.ts b/src/api/resources/catalog/client/requests/SearchCatalogItemsRequest.ts index 040e6a65f..09d32095e 100644 --- a/src/api/resources/catalog/client/requests/SearchCatalogItemsRequest.ts +++ b/src/api/resources/catalog/client/requests/SearchCatalogItemsRequest.ts @@ -2,32 +2,32 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * textFilter: "red", - * categoryIds: ["WINE_CATEGORY_ID"], - * stockLevels: ["OUT", "LOW"], - * enabledLocationIds: ["ATL_LOCATION_ID"], + * text_filter: "red", + * category_ids: ["WINE_CATEGORY_ID"], + * stock_levels: ["OUT", "LOW"], + * enabled_location_ids: ["ATL_LOCATION_ID"], * limit: 100, - * sortOrder: "ASC", - * productTypes: ["REGULAR"], - * customAttributeFilters: [{ - * customAttributeDefinitionId: "VEGAN_DEFINITION_ID", - * boolFilter: true + * sort_order: "ASC", + * product_types: ["REGULAR"], + * custom_attribute_filters: [{ + * custom_attribute_definition_id: "VEGAN_DEFINITION_ID", + * bool_filter: true * }, { - * customAttributeDefinitionId: "BRAND_DEFINITION_ID", - * stringFilter: "Dark Horse" + * custom_attribute_definition_id: "BRAND_DEFINITION_ID", + * string_filter: "Dark Horse" * }, { * key: "VINTAGE", - * numberFilter: { + * number_filter: { * min: "min", * max: "max" * } * }, { - * customAttributeDefinitionId: "VARIETAL_DEFINITION_ID" + * custom_attribute_definition_id: "VARIETAL_DEFINITION_ID" * }] * } */ @@ -37,16 +37,16 @@ export interface SearchCatalogItemsRequest { * 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; + text_filter?: string; /** The category id query expression to return items containing the specified category IDs. */ - categoryIds?: string[]; + category_ids?: 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[]; + stock_levels?: Square.SearchCatalogItemsRequestStockLevel[]; /** The enabled-location query expression to return items and item variations having specified enabled locations. */ - enabledLocationIds?: string[]; + enabled_location_ids?: 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. */ @@ -55,15 +55,15 @@ export interface SearchCatalogItemsRequest { * 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; + sort_order?: Square.SortOrder; /** The product types query expression to return items or item variations having the specified product types. */ - productTypes?: Square.CatalogItemProductType[]; + product_types?: 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[]; + custom_attribute_filters?: 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; + archived_state?: Square.ArchivedState; } diff --git a/src/api/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts index 93c4054a5..bc40e2bc5 100644 --- a/src/api/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts +++ b/src/api/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * objectTypes: ["ITEM"], + * object_types: ["ITEM"], * query: { - * prefixQuery: { - * attributeName: "name", - * attributePrefix: "tea" + * prefix_query: { + * attribute_name: "name", + * attribute_prefix: "tea" * } * }, * limit: 100 @@ -39,9 +39,9 @@ export interface SearchCatalogObjectsRequest { * ITEM_OPTION_VAL, ITEM_VARIATION, or MODIFIER), you must explicitly include all the types of interest * in this field. */ - objectTypes?: Square.CatalogObjectType[]; + object_types?: 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; + include_deleted_objects?: 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 @@ -58,13 +58,13 @@ export interface SearchCatalogObjectsRequest { * * Default value: `false` */ - includeRelatedObjects?: boolean; + include_related_objects?: 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; + begin_time?: 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; /** @@ -74,5 +74,5 @@ export interface SearchCatalogObjectsRequest { */ 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; + include_category_path_to_root?: boolean; } diff --git a/src/api/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts b/src/api/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts index 993504615..2ace2816f 100644 --- a/src/api/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts +++ b/src/api/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts @@ -5,22 +5,22 @@ /** * @example * { - * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - * modifierListsToEnable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - * modifierListsToDisable: ["7WRC16CJZDVLSNDQ35PP6YAD"] + * item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifier_lists_to_enable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifier_lists_to_disable: ["7WRC16CJZDVLSNDQ35PP6YAD"] * } */ export interface UpdateItemModifierListsRequest { /** The IDs of the catalog items associated with the CatalogModifierList objects being updated. */ - itemIds: string[]; + item_ids: 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; + modifier_lists_to_enable?: 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; + modifier_lists_to_disable?: string[] | null; } diff --git a/src/api/resources/catalog/client/requests/UpdateItemTaxesRequest.ts b/src/api/resources/catalog/client/requests/UpdateItemTaxesRequest.ts index 45b6420c6..6c3e3d378 100644 --- a/src/api/resources/catalog/client/requests/UpdateItemTaxesRequest.ts +++ b/src/api/resources/catalog/client/requests/UpdateItemTaxesRequest.ts @@ -5,9 +5,9 @@ /** * @example * { - * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], - * taxesToEnable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], - * taxesToDisable: ["AQCEGCEBBQONINDOHRGZISEX"] + * item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * taxes_to_enable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + * taxes_to_disable: ["AQCEGCEBBQONINDOHRGZISEX"] * } */ export interface UpdateItemTaxesRequest { @@ -15,15 +15,15 @@ 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[]; + item_ids: 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; + taxes_to_enable?: 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; + taxes_to_disable?: string[] | null; } diff --git a/src/api/resources/catalog/client/requests/index.ts b/src/api/resources/catalog/client/requests/index.ts index 14d4621a0..8c050113c 100644 --- a/src/api/resources/catalog/client/requests/index.ts +++ b/src/api/resources/catalog/client/requests/index.ts @@ -1,8 +1,8 @@ -export { type BatchDeleteCatalogObjectsRequest } from "./BatchDeleteCatalogObjectsRequest"; -export { type BatchGetCatalogObjectsRequest } from "./BatchGetCatalogObjectsRequest"; -export { type BatchUpsertCatalogObjectsRequest } from "./BatchUpsertCatalogObjectsRequest"; -export { type ListCatalogRequest } from "./ListCatalogRequest"; -export { type SearchCatalogObjectsRequest } from "./SearchCatalogObjectsRequest"; -export { type SearchCatalogItemsRequest } from "./SearchCatalogItemsRequest"; -export { type UpdateItemModifierListsRequest } from "./UpdateItemModifierListsRequest"; -export { type UpdateItemTaxesRequest } from "./UpdateItemTaxesRequest"; +export { type BatchDeleteCatalogObjectsRequest } from "./BatchDeleteCatalogObjectsRequest.js"; +export { type BatchGetCatalogObjectsRequest } from "./BatchGetCatalogObjectsRequest.js"; +export { type BatchUpsertCatalogObjectsRequest } from "./BatchUpsertCatalogObjectsRequest.js"; +export { type ListCatalogRequest } from "./ListCatalogRequest.js"; +export { type SearchCatalogObjectsRequest } from "./SearchCatalogObjectsRequest.js"; +export { type SearchCatalogItemsRequest } from "./SearchCatalogItemsRequest.js"; +export { type UpdateItemModifierListsRequest } from "./UpdateItemModifierListsRequest.js"; +export { type UpdateItemTaxesRequest } from "./UpdateItemTaxesRequest.js"; diff --git a/src/api/resources/catalog/index.ts b/src/api/resources/catalog/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/catalog/index.ts +++ b/src/api/resources/catalog/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/catalog/resources/images/client/Client.ts b/src/api/resources/catalog/resources/images/client/Client.ts index a27a056eb..3c762eb33 100644 --- a/src/api/resources/catalog/resources/images/client/Client.ts +++ b/src/api/resources/catalog/resources/images/client/Client.ts @@ -2,13 +2,12 @@ * 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"; +import * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { toJson } from "../../../../../../core/json.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Images { export interface Options { @@ -18,6 +17,8 @@ export declare namespace Images { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -31,12 +32,16 @@ export declare namespace Images { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Images { - constructor(protected readonly _options: Images.Options = {}) {} + protected readonly _options: Images.Options; + + constructor(_options: Images.Options = {}) { + this._options = _options; + } /** * Uploads an image file to be represented by a [CatalogImage](entity:CatalogImage) object that can be linked to an existing @@ -52,48 +57,44 @@ export class Images { * @example * await client.catalog.images.create({}) */ - public async create( + public create( request: Square.catalog.CreateImagesRequest, requestOptions?: Images.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.catalog.CreateImagesRequest, + 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, - }), - ), - ); + _request.append("request", toJson(request.request)); } - if (request.imageFile != null) { - await _request.appendFile("image_file", request.imageFile); + if (request.image_file != null) { + await _request.appendFile("image_file", request.image_file); } const _maybeEncodedRequest = await _request.getRequest(); const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ..._maybeEncodedRequest.headers, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + ..._maybeEncodedRequest.headers, + }), + requestOptions?.headers, + ), requestType: "file", duplex: _maybeEncodedRequest.duplex, body: _maybeEncodedRequest.body, @@ -102,19 +103,14 @@ export class Images { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateCatalogImageResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.CreateCatalogImageResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -123,12 +119,14 @@ export class Images { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/images."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -144,51 +142,47 @@ export class Images { * * @example * await client.catalog.images.update({ - * imageId: "image_id" + * image_id: "image_id" * }) */ - public async update( + public update( request: Square.catalog.UpdateImagesRequest, requestOptions?: Images.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.catalog.UpdateImagesRequest, + 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, - }), - ), - ); + _request.append("request", toJson(request.request)); } - if (request.imageFile != null) { - await _request.appendFile("image_file", request.imageFile); + if (request.image_file != null) { + await _request.appendFile("image_file", request.image_file); } const _maybeEncodedRequest = await _request.getRequest(); const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, - `v2/catalog/images/${encodeURIComponent(request.imageId)}`, + `v2/catalog/images/${encodeURIComponent(request.image_id)}`, ), method: "PUT", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ..._maybeEncodedRequest.headers, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + ..._maybeEncodedRequest.headers, + }), + requestOptions?.headers, + ), requestType: "file", duplex: _maybeEncodedRequest.duplex, body: _maybeEncodedRequest.body, @@ -197,19 +191,14 @@ export class Images { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.UpdateCatalogImageResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.UpdateCatalogImageResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -218,12 +207,14 @@ export class Images { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/catalog/resources/images/client/index.ts b/src/api/resources/catalog/resources/images/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/catalog/resources/images/client/index.ts +++ b/src/api/resources/catalog/resources/images/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/catalog/resources/images/client/requests/CreateImagesRequest.ts b/src/api/resources/catalog/resources/images/client/requests/CreateImagesRequest.ts index 50d490319..cd0d4feea 100644 --- a/src/api/resources/catalog/resources/images/client/requests/CreateImagesRequest.ts +++ b/src/api/resources/catalog/resources/images/client/requests/CreateImagesRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; -import * as fs from "fs"; +import * as Square from "../../../../../../index.js"; +import * as core from "../../../../../../../core/index.js"; /** * @example @@ -11,5 +11,5 @@ import * as fs from "fs"; */ export interface CreateImagesRequest { request?: Square.CreateCatalogImageRequest; - imageFile?: File | fs.ReadStream | Blob | undefined; + image_file?: core.FileLike | undefined; } diff --git a/src/api/resources/catalog/resources/images/client/requests/UpdateImagesRequest.ts b/src/api/resources/catalog/resources/images/client/requests/UpdateImagesRequest.ts index ad56e6e59..46442d80b 100644 --- a/src/api/resources/catalog/resources/images/client/requests/UpdateImagesRequest.ts +++ b/src/api/resources/catalog/resources/images/client/requests/UpdateImagesRequest.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; -import * as fs from "fs"; +import * as Square from "../../../../../../index.js"; +import * as core from "../../../../../../../core/index.js"; /** * @example * { - * imageId: "image_id" + * image_id: "image_id" * } */ export interface UpdateImagesRequest { /** * The ID of the `CatalogImage` object to update the encapsulated image file. */ - imageId: string; + image_id: string; request?: Square.UpdateCatalogImageRequest; - imageFile?: File | fs.ReadStream | Blob | undefined; + image_file?: core.FileLike | 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 index ebbd407bb..e3a2f79d5 100644 --- a/src/api/resources/catalog/resources/images/client/requests/index.ts +++ b/src/api/resources/catalog/resources/images/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type CreateImagesRequest } from "./CreateImagesRequest"; -export { type UpdateImagesRequest } from "./UpdateImagesRequest"; +export { type CreateImagesRequest } from "./CreateImagesRequest.js"; +export { type UpdateImagesRequest } from "./UpdateImagesRequest.js"; diff --git a/src/api/resources/catalog/resources/images/index.ts b/src/api/resources/catalog/resources/images/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/catalog/resources/images/index.ts +++ b/src/api/resources/catalog/resources/images/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/catalog/resources/index.ts b/src/api/resources/catalog/resources/index.ts index cbcd61155..c2a292860 100644 --- a/src/api/resources/catalog/resources/index.ts +++ b/src/api/resources/catalog/resources/index.ts @@ -1,4 +1,4 @@ -export * as images from "./images"; -export * as object from "./object"; -export * from "./images/client/requests"; -export * from "./object/client/requests"; +export * as images from "./images/index.js"; +export * as object from "./object/index.js"; +export * from "./images/client/requests/index.js"; +export * from "./object/client/requests/index.js"; diff --git a/src/api/resources/catalog/resources/object/client/Client.ts b/src/api/resources/catalog/resources/object/client/Client.ts index 8b793b5b3..6fe55c90c 100644 --- a/src/api/resources/catalog/resources/object/client/Client.ts +++ b/src/api/resources/catalog/resources/object/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Object_ { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Object_ { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Object_ { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Object_ { - constructor(protected readonly _options: Object_.Options = {}) {} + protected readonly _options: Object_.Options; + + constructor(_options: Object_.Options = {}) { + this._options = _options; + } /** * Creates a new or updates the specified [CatalogObject](entity:CatalogObject). @@ -49,60 +54,56 @@ export class Object_ { * * @example * await client.catalog.object.upsert({ - * idempotencyKey: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + * idempotency_key: "af3d1afc-7212-4300-b463-0bfc5314a5ae", * object: { * type: "ITEM", * id: "id" * } * }) */ - public async upsert( + public upsert( + request: Square.catalog.UpsertCatalogObjectRequest, + requestOptions?: Object_.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions)); + } + + private async __upsert( request: Square.catalog.UpsertCatalogObjectRequest, requestOptions?: Object_.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.catalog.UpsertCatalogObjectRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.UpsertCatalogObjectResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -111,12 +112,14 @@ export class Object_ { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/object."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -135,14 +138,26 @@ export class Object_ { * * @example * await client.catalog.object.get({ - * objectId: "object_id" + * object_id: "object_id" * }) */ - public async get( + public get( + request: Square.catalog.GetObjectRequest, + requestOptions?: Object_.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.catalog.GetObjectRequest, requestOptions?: Object_.RequestOptions, - ): Promise { - const { objectId, includeRelatedObjects, catalogVersion, includeCategoryPathToRoot } = request; + ): Promise> { + const { + object_id: objectId, + include_related_objects: includeRelatedObjects, + catalog_version: catalogVersion, + include_category_path_to_root: includeCategoryPathToRoot, + } = request; const _queryParams: Record = {}; if (includeRelatedObjects !== undefined) { _queryParams["include_related_objects"] = includeRelatedObjects?.toString() ?? null; @@ -157,45 +172,35 @@ export class Object_ { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetCatalogObjectResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -204,6 +209,7 @@ export class Object_ { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -212,6 +218,7 @@ export class Object_ { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -233,53 +240,50 @@ export class Object_ { * * @example * await client.catalog.object.delete({ - * objectId: "object_id" + * object_id: "object_id" * }) */ - public async delete( + public delete( + request: Square.catalog.DeleteObjectRequest, + requestOptions?: Object_.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.catalog.DeleteObjectRequest, requestOptions?: Object_.RequestOptions, - ): Promise { - const { objectId } = request; + ): Promise> { + const { object_id: objectId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteCatalogObjectResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -288,6 +292,7 @@ export class Object_ { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -296,6 +301,7 @@ export class Object_ { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/catalog/resources/object/client/index.ts b/src/api/resources/catalog/resources/object/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/catalog/resources/object/client/index.ts +++ b/src/api/resources/catalog/resources/object/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/catalog/resources/object/client/requests/DeleteObjectRequest.ts b/src/api/resources/catalog/resources/object/client/requests/DeleteObjectRequest.ts index 5553a8a35..d71ccb4ae 100644 --- a/src/api/resources/catalog/resources/object/client/requests/DeleteObjectRequest.ts +++ b/src/api/resources/catalog/resources/object/client/requests/DeleteObjectRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * objectId: "object_id" + * object_id: "object_id" * } */ export interface DeleteObjectRequest { @@ -14,5 +14,5 @@ export interface DeleteObjectRequest { * 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; + object_id: string; } diff --git a/src/api/resources/catalog/resources/object/client/requests/GetObjectRequest.ts b/src/api/resources/catalog/resources/object/client/requests/GetObjectRequest.ts index 0a008fb87..f01afff42 100644 --- a/src/api/resources/catalog/resources/object/client/requests/GetObjectRequest.ts +++ b/src/api/resources/catalog/resources/object/client/requests/GetObjectRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * objectId: "object_id" + * object_id: "object_id" * } */ export interface GetObjectRequest { /** * The object ID of any type of catalog objects to be retrieved. */ - objectId: string; + object_id: 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 @@ -29,19 +29,19 @@ export interface GetObjectRequest { * * Default value: `false` */ - includeRelatedObjects?: boolean | null; + include_related_objects?: 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; + catalog_version?: (number | 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; + include_category_path_to_root?: 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 index 071efb170..109517a60 100644 --- a/src/api/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts +++ b/src/api/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + * idempotency_key: "af3d1afc-7212-4300-b463-0bfc5314a5ae", * object: { * type: "ITEM", * id: "id" @@ -27,7 +27,7 @@ export interface UpsertCatalogObjectRequest { * * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: string; /** * A CatalogObject to be created or updated. * diff --git a/src/api/resources/catalog/resources/object/client/requests/index.ts b/src/api/resources/catalog/resources/object/client/requests/index.ts index a974f1464..602348e3f 100644 --- a/src/api/resources/catalog/resources/object/client/requests/index.ts +++ b/src/api/resources/catalog/resources/object/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type UpsertCatalogObjectRequest } from "./UpsertCatalogObjectRequest"; -export { type GetObjectRequest } from "./GetObjectRequest"; -export { type DeleteObjectRequest } from "./DeleteObjectRequest"; +export { type UpsertCatalogObjectRequest } from "./UpsertCatalogObjectRequest.js"; +export { type GetObjectRequest } from "./GetObjectRequest.js"; +export { type DeleteObjectRequest } from "./DeleteObjectRequest.js"; diff --git a/src/api/resources/catalog/resources/object/index.ts b/src/api/resources/catalog/resources/object/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/catalog/resources/object/index.ts +++ b/src/api/resources/catalog/resources/object/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/checkout/client/Client.ts b/src/api/resources/checkout/client/Client.ts index a086a1357..efa15be93 100644 --- a/src/api/resources/checkout/client/Client.ts +++ b/src/api/resources/checkout/client/Client.ts @@ -2,13 +2,12 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { PaymentLinks } from "../resources/paymentLinks/client/Client.js"; export declare namespace Checkout { export interface Options { @@ -18,6 +17,8 @@ export declare namespace Checkout { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -31,14 +32,17 @@ export declare namespace Checkout { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Checkout { + protected readonly _options: Checkout.Options; protected _paymentLinks: PaymentLinks | undefined; - constructor(protected readonly _options: Checkout.Options = {}) {} + constructor(_options: Checkout.Options = {}) { + this._options = _options; + } public get paymentLinks(): PaymentLinks { return (this._paymentLinks ??= new PaymentLinks(this._options)); @@ -52,53 +56,53 @@ export class Checkout { * * @example * await client.checkout.retrieveLocationSettings({ - * locationId: "location_id" + * location_id: "location_id" * }) */ - public async retrieveLocationSettings( + public retrieveLocationSettings( request: Square.RetrieveLocationSettingsRequest, requestOptions?: Checkout.RequestOptions, - ): Promise { - const { locationId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveLocationSettings(request, requestOptions)); + } + + private async __retrieveLocationSettings( + request: Square.RetrieveLocationSettingsRequest, + requestOptions?: Checkout.RequestOptions, + ): Promise> { + const { location_id: locationId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveLocationSettingsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -107,6 +111,7 @@ export class Checkout { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -115,6 +120,7 @@ export class Checkout { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -127,58 +133,57 @@ export class Checkout { * * @example * await client.checkout.updateLocationSettings({ - * locationId: "location_id", - * locationSettings: {} + * location_id: "location_id", + * location_settings: {} * }) */ - public async updateLocationSettings( + public updateLocationSettings( request: Square.UpdateLocationSettingsRequest, requestOptions?: Checkout.RequestOptions, - ): Promise { - const { locationId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateLocationSettings(request, requestOptions)); + } + + private async __updateLocationSettings( + request: Square.UpdateLocationSettingsRequest, + requestOptions?: Checkout.RequestOptions, + ): Promise> { + const { location_id: locationId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateLocationSettingsRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateLocationSettingsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -187,6 +192,7 @@ export class Checkout { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -195,6 +201,7 @@ export class Checkout { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -207,48 +214,47 @@ export class Checkout { * @example * await client.checkout.retrieveMerchantSettings() */ - public async retrieveMerchantSettings( + public retrieveMerchantSettings( + requestOptions?: Checkout.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveMerchantSettings(requestOptions)); + } + + private async __retrieveMerchantSettings( requestOptions?: Checkout.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveMerchantSettingsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -257,6 +263,7 @@ export class Checkout { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -265,6 +272,7 @@ export class Checkout { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -277,56 +285,55 @@ export class Checkout { * * @example * await client.checkout.updateMerchantSettings({ - * merchantSettings: {} + * merchant_settings: {} * }) */ - public async updateMerchantSettings( + public updateMerchantSettings( request: Square.UpdateMerchantSettingsRequest, requestOptions?: Checkout.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateMerchantSettings(request, requestOptions)); + } + + private async __updateMerchantSettings( + request: Square.UpdateMerchantSettingsRequest, + requestOptions?: Checkout.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateMerchantSettingsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.UpdateMerchantSettingsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -335,6 +342,7 @@ export class Checkout { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -343,6 +351,7 @@ export class Checkout { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/checkout/client/index.ts b/src/api/resources/checkout/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/checkout/client/index.ts +++ b/src/api/resources/checkout/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/checkout/client/requests/RetrieveLocationSettingsRequest.ts b/src/api/resources/checkout/client/requests/RetrieveLocationSettingsRequest.ts index 71ce84a90..71d9cec1b 100644 --- a/src/api/resources/checkout/client/requests/RetrieveLocationSettingsRequest.ts +++ b/src/api/resources/checkout/client/requests/RetrieveLocationSettingsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface RetrieveLocationSettingsRequest { /** * The ID of the location for which to retrieve settings. */ - locationId: string; + location_id: string; } diff --git a/src/api/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts b/src/api/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts index e94cf5f0c..9e34e2906 100644 --- a/src/api/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts +++ b/src/api/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * locationId: "location_id", - * locationSettings: {} + * location_id: "location_id", + * location_settings: {} * } */ export interface UpdateLocationSettingsRequest { /** * The ID of the location for which to retrieve settings. */ - locationId: string; + location_id: string; /** Describe your updates using the `location_settings` object. Make sure it contains only the fields that have changed. */ - locationSettings: Square.CheckoutLocationSettings; + location_settings: Square.CheckoutLocationSettings; } diff --git a/src/api/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts b/src/api/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts index d46b43bda..ef9fd8211 100644 --- a/src/api/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts +++ b/src/api/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * merchantSettings: {} + * merchant_settings: {} * } */ export interface UpdateMerchantSettingsRequest { /** Describe your updates using the `merchant_settings` object. Make sure it contains only the fields that have changed. */ - merchantSettings: Square.CheckoutMerchantSettings; + merchant_settings: Square.CheckoutMerchantSettings; } diff --git a/src/api/resources/checkout/client/requests/index.ts b/src/api/resources/checkout/client/requests/index.ts index ff86d69a5..e97196d8b 100644 --- a/src/api/resources/checkout/client/requests/index.ts +++ b/src/api/resources/checkout/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type RetrieveLocationSettingsRequest } from "./RetrieveLocationSettingsRequest"; -export { type UpdateLocationSettingsRequest } from "./UpdateLocationSettingsRequest"; -export { type UpdateMerchantSettingsRequest } from "./UpdateMerchantSettingsRequest"; +export { type RetrieveLocationSettingsRequest } from "./RetrieveLocationSettingsRequest.js"; +export { type UpdateLocationSettingsRequest } from "./UpdateLocationSettingsRequest.js"; +export { type UpdateMerchantSettingsRequest } from "./UpdateMerchantSettingsRequest.js"; diff --git a/src/api/resources/checkout/index.ts b/src/api/resources/checkout/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/checkout/index.ts +++ b/src/api/resources/checkout/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/checkout/resources/index.ts b/src/api/resources/checkout/resources/index.ts index 5f3efa0d0..3784c0dd1 100644 --- a/src/api/resources/checkout/resources/index.ts +++ b/src/api/resources/checkout/resources/index.ts @@ -1,2 +1,2 @@ -export * as paymentLinks from "./paymentLinks"; -export * from "./paymentLinks/client/requests"; +export * as paymentLinks from "./paymentLinks/index.js"; +export * from "./paymentLinks/client/requests/index.js"; diff --git a/src/api/resources/checkout/resources/paymentLinks/client/Client.ts b/src/api/resources/checkout/resources/paymentLinks/client/Client.ts index 8d018551b..6918d26ed 100644 --- a/src/api/resources/checkout/resources/paymentLinks/client/Client.ts +++ b/src/api/resources/checkout/resources/paymentLinks/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace PaymentLinks { export interface Options { @@ -17,6 +16,8 @@ export declare namespace PaymentLinks { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace PaymentLinks { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class PaymentLinks { - constructor(protected readonly _options: PaymentLinks.Options = {}) {} + protected readonly _options: PaymentLinks.Options; + + constructor(_options: PaymentLinks.Options = {}) { + this._options = _options; + } /** * Lists all payment links. @@ -50,78 +55,79 @@ export class PaymentLinks { request: Square.checkout.ListPaymentLinksRequest = {}, requestOptions?: PaymentLinks.RequestOptions, ): Promise> { - const list = async ( - request: Square.checkout.ListPaymentLinksRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.checkout.ListPaymentLinksRequest, + ): 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListPaymentLinksResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.paymentLinks ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.payment_links ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -136,64 +142,60 @@ export class PaymentLinks { * * @example * await client.checkout.paymentLinks.create({ - * idempotencyKey: "cd9e25dc-d9f2-4430-aedb-61605070e95f", - * quickPay: { + * idempotency_key: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + * quick_pay: { * name: "Auto Detailing", - * priceMoney: { - * amount: 10000, + * price_money: { + * amount: BigInt("10000"), * currency: "USD" * }, - * locationId: "A9Y43N9ABXZBP" + * location_id: "A9Y43N9ABXZBP" * } * }) */ - public async create( + public create( request: Square.checkout.CreatePaymentLinkRequest = {}, requestOptions?: PaymentLinks.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.checkout.CreatePaymentLinkRequest = {}, + requestOptions?: PaymentLinks.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.checkout.CreatePaymentLinkRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreatePaymentLinkResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -202,6 +204,7 @@ export class PaymentLinks { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -210,6 +213,7 @@ export class PaymentLinks { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -225,50 +229,47 @@ export class PaymentLinks { * id: "id" * }) */ - public async get( + public get( request: Square.checkout.GetPaymentLinksRequest, requestOptions?: PaymentLinks.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.checkout.GetPaymentLinksRequest, + requestOptions?: PaymentLinks.RequestOptions, + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetPaymentLinkResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -277,6 +278,7 @@ export class PaymentLinks { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -285,6 +287,7 @@ export class PaymentLinks { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -300,62 +303,58 @@ export class PaymentLinks { * @example * await client.checkout.paymentLinks.update({ * id: "id", - * paymentLink: { + * payment_link: { * version: 1, - * checkoutOptions: { - * askForShippingAddress: true + * checkout_options: { + * ask_for_shipping_address: true * } * } * }) */ - public async update( + public update( + request: Square.checkout.UpdatePaymentLinkRequest, + requestOptions?: PaymentLinks.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.checkout.UpdatePaymentLinkRequest, requestOptions?: PaymentLinks.RequestOptions, - ): Promise { + ): Promise> { const { id, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.checkout.UpdatePaymentLinkRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdatePaymentLinkResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -364,6 +363,7 @@ export class PaymentLinks { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -372,6 +372,7 @@ export class PaymentLinks { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -387,50 +388,47 @@ export class PaymentLinks { * id: "id" * }) */ - public async delete( + public delete( + request: Square.checkout.DeletePaymentLinksRequest, + requestOptions?: PaymentLinks.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.checkout.DeletePaymentLinksRequest, requestOptions?: PaymentLinks.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeletePaymentLinkResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -439,6 +437,7 @@ export class PaymentLinks { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -447,6 +446,7 @@ export class PaymentLinks { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/checkout/resources/paymentLinks/client/index.ts b/src/api/resources/checkout/resources/paymentLinks/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/checkout/resources/paymentLinks/client/index.ts +++ b/src/api/resources/checkout/resources/paymentLinks/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts index 042082f59..8db1759f4 100644 --- a/src/api/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "cd9e25dc-d9f2-4430-aedb-61605070e95f", - * quickPay: { + * idempotency_key: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + * quick_pay: { * name: "Auto Detailing", - * priceMoney: { - * amount: 10000, + * price_money: { + * amount: BigInt("10000"), * currency: "USD" * }, - * locationId: "A9Y43N9ABXZBP" + * location_id: "A9Y43N9ABXZBP" * } * } */ @@ -26,7 +26,7 @@ export interface CreatePaymentLinkRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey?: string; + idempotency_key?: string; /** * A description of the payment link. You provide this optional description that is useful in your * application context. It is not used anywhere. @@ -37,7 +37,7 @@ export interface CreatePaymentLinkRequest { * For more information, * see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). */ - quickPay?: Square.QuickPay; + quick_pay?: Square.QuickPay; /** * Describes the `Order` for which to create a checkout link. * For more information, @@ -49,12 +49,12 @@ export interface CreatePaymentLinkRequest { * For more information, * see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). */ - checkoutOptions?: Square.CheckoutOptions; + checkout_options?: 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; + pre_populated_data?: Square.PrePopulatedData; /** A note for the payment. After processing the payment, Square adds this note to the resulting `Payment`. */ - paymentNote?: string; + payment_note?: string; } diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts index 52118ba6c..03ffc6182 100644 --- a/src/api/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * id: "id", - * paymentLink: { + * payment_link: { * version: 1, - * checkoutOptions: { - * askForShippingAddress: true + * checkout_options: { + * ask_for_shipping_address: true * } * } * } @@ -25,5 +25,5 @@ export interface UpdatePaymentLinkRequest { * 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; + payment_link: 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 index f201fa065..688d0ba7a 100644 --- a/src/api/resources/checkout/resources/paymentLinks/client/requests/index.ts +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type ListPaymentLinksRequest } from "./ListPaymentLinksRequest"; -export { type CreatePaymentLinkRequest } from "./CreatePaymentLinkRequest"; -export { type GetPaymentLinksRequest } from "./GetPaymentLinksRequest"; -export { type UpdatePaymentLinkRequest } from "./UpdatePaymentLinkRequest"; -export { type DeletePaymentLinksRequest } from "./DeletePaymentLinksRequest"; +export { type ListPaymentLinksRequest } from "./ListPaymentLinksRequest.js"; +export { type CreatePaymentLinkRequest } from "./CreatePaymentLinkRequest.js"; +export { type GetPaymentLinksRequest } from "./GetPaymentLinksRequest.js"; +export { type UpdatePaymentLinkRequest } from "./UpdatePaymentLinkRequest.js"; +export { type DeletePaymentLinksRequest } from "./DeletePaymentLinksRequest.js"; diff --git a/src/api/resources/checkout/resources/paymentLinks/index.ts b/src/api/resources/checkout/resources/paymentLinks/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/checkout/resources/paymentLinks/index.ts +++ b/src/api/resources/checkout/resources/paymentLinks/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/customers/client/Client.ts b/src/api/resources/customers/client/Client.ts index 4ecdd790f..afdd3c0bd 100644 --- a/src/api/resources/customers/client/Client.ts +++ b/src/api/resources/customers/client/Client.ts @@ -2,17 +2,16 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client.js"; +import { Groups } from "../resources/groups/client/Client.js"; +import { Segments } from "../resources/segments/client/Client.js"; +import { Cards } from "../resources/cards/client/Client.js"; +import { CustomAttributes } from "../resources/customAttributes/client/Client.js"; export declare namespace Customers { export interface Options { @@ -22,6 +21,8 @@ export declare namespace Customers { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -35,18 +36,21 @@ export declare namespace Customers { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Customers { + protected readonly _options: Customers.Options; 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 = {}) {} + constructor(_options: Customers.Options = {}) { + this._options = _options; + } public get customAttributeDefinitions(): CustomAttributeDefinitions { return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); @@ -85,88 +89,82 @@ export class Customers { request: Square.ListCustomersRequest = {}, requestOptions?: Customers.RequestOptions, ): Promise> { - const list = async (request: Square.ListCustomersRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListCustomersRequest, + ): Promise> => { + const { cursor, limit, sort_field: sortField, sort_order: 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"] = sortField; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = sortOrder; + } + if (count !== undefined) { + _queryParams["count"] = count?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListCustomersResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/customers."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/customers."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.customers ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -191,69 +189,65 @@ export class Customers { * * @example * await client.customers.create({ - * givenName: "Amelia", - * familyName: "Earhart", - * emailAddress: "Amelia.Earhart@example.com", + * given_name: "Amelia", + * family_name: "Earhart", + * email_address: "Amelia.Earhart@example.com", * address: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * phoneNumber: "+1-212-555-4240", - * referenceId: "YOUR_REFERENCE_ID", + * phone_number: "+1-212-555-4240", + * reference_id: "YOUR_REFERENCE_ID", * note: "a customer" * }) */ - public async create( + public create( request: Square.CreateCustomerRequest = {}, requestOptions?: Customers.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.CreateCustomerRequest = {}, + requestOptions?: Customers.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateCustomerRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateCustomerResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -262,12 +256,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -292,87 +288,83 @@ export class Customers { * await client.customers.batchCreate({ * customers: { * "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { - * givenName: "Amelia", - * familyName: "Earhart", - * emailAddress: "Amelia.Earhart@example.com", + * given_name: "Amelia", + * family_name: "Earhart", + * email_address: "Amelia.Earhart@example.com", * address: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * phoneNumber: "+1-212-555-4240", - * referenceId: "YOUR_REFERENCE_ID", + * phone_number: "+1-212-555-4240", + * reference_id: "YOUR_REFERENCE_ID", * note: "a customer" * }, * "d1689f23-b25d-4932-b2f0-aed00f5e2029": { - * givenName: "Marie", - * familyName: "Curie", - * emailAddress: "Marie.Curie@example.com", + * given_name: "Marie", + * family_name: "Curie", + * email_address: "Marie.Curie@example.com", * address: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 601", + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 601", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * phoneNumber: "+1-212-444-4240", - * referenceId: "YOUR_REFERENCE_ID", + * phone_number: "+1-212-444-4240", + * reference_id: "YOUR_REFERENCE_ID", * note: "another customer" * } * } * }) */ - public async batchCreate( + public batchCreate( + request: Square.BulkCreateCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchCreate(request, requestOptions)); + } + + private async __batchCreate( request: Square.BulkCreateCustomersRequest, requestOptions?: Customers.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkCreateCustomersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BulkCreateCustomersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -381,12 +373,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -401,56 +395,52 @@ export class Customers { * * @example * await client.customers.bulkDeleteCustomers({ - * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] * }) */ - public async bulkDeleteCustomers( + public bulkDeleteCustomers( request: Square.BulkDeleteCustomersRequest, requestOptions?: Customers.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__bulkDeleteCustomers(request, requestOptions)); + } + + private async __bulkDeleteCustomers( + request: Square.BulkDeleteCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkDeleteCustomersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BulkDeleteCustomersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -459,12 +449,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -479,56 +471,52 @@ export class Customers { * * @example * await client.customers.bulkRetrieveCustomers({ - * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] * }) */ - public async bulkRetrieveCustomers( + public bulkRetrieveCustomers( + request: Square.BulkRetrieveCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__bulkRetrieveCustomers(request, requestOptions)); + } + + private async __bulkRetrieveCustomers( request: Square.BulkRetrieveCustomersRequest, requestOptions?: Customers.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkRetrieveCustomersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BulkRetrieveCustomersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -537,12 +525,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -559,65 +549,61 @@ export class Customers { * await client.customers.bulkUpdateCustomers({ * customers: { * "8DDA5NZVBZFGAX0V3HPF81HHE0": { - * emailAddress: "New.Amelia.Earhart@example.com", + * email_address: "New.Amelia.Earhart@example.com", * note: "updated customer note", - * version: 2 + * version: BigInt("2") * }, * "N18CPRVXR5214XPBBA6BZQWF3C": { - * givenName: "Marie", - * familyName: "Curie", - * version: 0 + * given_name: "Marie", + * family_name: "Curie", + * version: BigInt("0") * } * } * }) */ - public async bulkUpdateCustomers( + public bulkUpdateCustomers( request: Square.BulkUpdateCustomersRequest, requestOptions?: Customers.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__bulkUpdateCustomers(request, requestOptions)); + } + + private async __bulkUpdateCustomers( + request: Square.BulkUpdateCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkUpdateCustomersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BulkUpdateCustomersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -626,12 +612,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -652,21 +640,21 @@ export class Customers { * * @example * await client.customers.search({ - * limit: 2, + * limit: BigInt("2"), * query: { * filter: { - * creationSource: { + * creation_source: { * values: ["THIRD_PARTY"], * rule: "INCLUDE" * }, - * createdAt: { - * startAt: "2018-01-01T00:00:00-00:00", - * endAt: "2018-02-01T00:00:00-00:00" + * created_at: { + * start_at: "2018-01-01T00:00:00-00:00", + * end_at: "2018-02-01T00:00:00-00:00" * }, - * emailAddress: { + * email_address: { * fuzzy: "example.com" * }, - * groupIds: { + * group_ids: { * all: ["545AXB44B4XXWMVQ4W8SBT3HHF"] * } * }, @@ -677,53 +665,49 @@ export class Customers { * } * }) */ - public async search( + public search( + request: Square.SearchCustomersRequest = {}, + requestOptions?: Customers.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( request: Square.SearchCustomersRequest = {}, requestOptions?: Customers.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchCustomersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchCustomersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -732,12 +716,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/search."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -750,53 +736,50 @@ export class Customers { * * @example * await client.customers.get({ - * customerId: "customer_id" + * customer_id: "customer_id" * }) */ - public async get( + public get( request: Square.GetCustomersRequest, requestOptions?: Customers.RequestOptions, - ): Promise { - const { customerId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise> { + const { customer_id: customerId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetCustomerResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -805,12 +788,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -826,60 +811,56 @@ export class Customers { * * @example * await client.customers.update({ - * customerId: "customer_id", - * emailAddress: "New.Amelia.Earhart@example.com", + * customer_id: "customer_id", + * email_address: "New.Amelia.Earhart@example.com", * note: "updated customer note", - * version: 2 + * version: BigInt("2") * }) */ - public async update( + public update( request: Square.UpdateCustomerRequest, requestOptions?: Customers.RequestOptions, - ): Promise { - const { customerId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.UpdateCustomerRequest, + requestOptions?: Customers.RequestOptions, + ): Promise> { + const { customer_id: customerId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateCustomerRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateCustomerResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -888,12 +869,14 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -908,59 +891,56 @@ export class Customers { * * @example * await client.customers.delete({ - * customerId: "customer_id" + * customer_id: "customer_id" * }) */ - public async delete( + public delete( request: Square.DeleteCustomersRequest, requestOptions?: Customers.RequestOptions, - ): Promise { - const { customerId, version } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.DeleteCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise> { + const { customer_id: customerId, version } = request; const _queryParams: Record = {}; if (version !== undefined) { _queryParams["version"] = version?.toString() ?? null; } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteCustomerResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -969,6 +949,7 @@ export class Customers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -977,6 +958,7 @@ export class Customers { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/customers/client/index.ts b/src/api/resources/customers/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/customers/client/index.ts +++ b/src/api/resources/customers/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/customers/client/requests/BulkCreateCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkCreateCustomersRequest.ts index 95a024d18..4b7f624ac 100644 --- a/src/api/resources/customers/client/requests/BulkCreateCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/BulkCreateCustomersRequest.ts @@ -2,42 +2,42 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * customers: { * "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { - * givenName: "Amelia", - * familyName: "Earhart", - * emailAddress: "Amelia.Earhart@example.com", + * given_name: "Amelia", + * family_name: "Earhart", + * email_address: "Amelia.Earhart@example.com", * address: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * phoneNumber: "+1-212-555-4240", - * referenceId: "YOUR_REFERENCE_ID", + * phone_number: "+1-212-555-4240", + * reference_id: "YOUR_REFERENCE_ID", * note: "a customer" * }, * "d1689f23-b25d-4932-b2f0-aed00f5e2029": { - * givenName: "Marie", - * familyName: "Curie", - * emailAddress: "Marie.Curie@example.com", + * given_name: "Marie", + * family_name: "Curie", + * email_address: "Marie.Curie@example.com", * address: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 601", + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 601", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * phoneNumber: "+1-212-444-4240", - * referenceId: "YOUR_REFERENCE_ID", + * phone_number: "+1-212-444-4240", + * reference_id: "YOUR_REFERENCE_ID", * note: "another customer" * } * } diff --git a/src/api/resources/customers/client/requests/BulkDeleteCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkDeleteCustomersRequest.ts index 125111848..38c396d15 100644 --- a/src/api/resources/customers/client/requests/BulkDeleteCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/BulkDeleteCustomersRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] * } */ export interface BulkDeleteCustomersRequest { /** The IDs of the [customer profiles](entity:Customer) to delete. */ - customerIds: string[]; + customer_ids: string[]; } diff --git a/src/api/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts index 99a7568c7..30dd16fb9 100644 --- a/src/api/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] * } */ export interface BulkRetrieveCustomersRequest { /** The IDs of the [customer profiles](entity:Customer) to retrieve. */ - customerIds: string[]; + customer_ids: string[]; } diff --git a/src/api/resources/customers/client/requests/BulkUpdateCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkUpdateCustomersRequest.ts index 7cfa8b1a8..cc2992480 100644 --- a/src/api/resources/customers/client/requests/BulkUpdateCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/BulkUpdateCustomersRequest.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * customers: { * "8DDA5NZVBZFGAX0V3HPF81HHE0": { - * emailAddress: "New.Amelia.Earhart@example.com", + * email_address: "New.Amelia.Earhart@example.com", * note: "updated customer note", - * version: 2 + * version: BigInt("2") * }, * "N18CPRVXR5214XPBBA6BZQWF3C": { - * givenName: "Marie", - * familyName: "Curie", - * version: 0 + * given_name: "Marie", + * family_name: "Curie", + * version: BigInt("0") * } * } * } diff --git a/src/api/resources/customers/client/requests/CreateCustomerRequest.ts b/src/api/resources/customers/client/requests/CreateCustomerRequest.ts index 3aeb62979..69a1a5a25 100644 --- a/src/api/resources/customers/client/requests/CreateCustomerRequest.ts +++ b/src/api/resources/customers/client/requests/CreateCustomerRequest.ts @@ -2,24 +2,24 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * givenName: "Amelia", - * familyName: "Earhart", - * emailAddress: "Amelia.Earhart@example.com", + * given_name: "Amelia", + * family_name: "Earhart", + * email_address: "Amelia.Earhart@example.com", * address: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * phoneNumber: "+1-212-555-4240", - * referenceId: "YOUR_REFERENCE_ID", + * phone_number: "+1-212-555-4240", + * reference_id: "YOUR_REFERENCE_ID", * note: "a customer" * } */ @@ -28,25 +28,25 @@ 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; + idempotency_key?: 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; + given_name?: 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; + family_name?: string; /** * A business name associated with the customer profile. * * The maximum length for this value is 500 characters. */ - companyName?: string; + company_name?: string; /** * A nickname for the customer profile. * @@ -58,7 +58,7 @@ export interface CreateCustomerRequest { * * The maximum length for this value is 254 characters. */ - emailAddress?: string; + email_address?: 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). @@ -70,14 +70,14 @@ export interface CreateCustomerRequest { * 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; + phone_number?: 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; + reference_id?: string; /** A custom note associated with the customer profile. */ note?: string; /** @@ -91,5 +91,5 @@ export interface CreateCustomerRequest { * 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; + tax_ids?: Square.CustomerTaxIds; } diff --git a/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts b/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts index af3a62bb6..15c3198f2 100644 --- a/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts @@ -5,18 +5,18 @@ /** * @example * { - * customerId: "customer_id" + * customer_id: "customer_id" * } */ export interface DeleteCustomersRequest { /** * The ID of the customer to delete. */ - customerId: string; + customer_id: 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; + version?: (number | bigint) | null; } diff --git a/src/api/resources/customers/client/requests/GetCustomersRequest.ts b/src/api/resources/customers/client/requests/GetCustomersRequest.ts index 5e5f54091..910adc8ce 100644 --- a/src/api/resources/customers/client/requests/GetCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/GetCustomersRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * customerId: "customer_id" + * customer_id: "customer_id" * } */ export interface GetCustomersRequest { /** * The ID of the customer to retrieve. */ - customerId: string; + customer_id: string; } diff --git a/src/api/resources/customers/client/requests/ListCustomersRequest.ts b/src/api/resources/customers/client/requests/ListCustomersRequest.ts index 6d319949c..436e3561d 100644 --- a/src/api/resources/customers/client/requests/ListCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/ListCustomersRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -28,14 +28,14 @@ export interface ListCustomersRequest { * * The default value is `DEFAULT`. */ - sortField?: Square.CustomerSortField | null; + sort_field?: 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; + sort_order?: Square.SortOrder | null; /** * Indicates whether to return the total count of customers in the `count` field of the response. * diff --git a/src/api/resources/customers/client/requests/SearchCustomersRequest.ts b/src/api/resources/customers/client/requests/SearchCustomersRequest.ts index 4b583487e..61bbda89f 100644 --- a/src/api/resources/customers/client/requests/SearchCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/SearchCustomersRequest.ts @@ -2,26 +2,26 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * limit: 2, + * limit: BigInt("2"), * query: { * filter: { - * creationSource: { + * creation_source: { * values: ["THIRD_PARTY"], * rule: "INCLUDE" * }, - * createdAt: { - * startAt: "2018-01-01T00:00:00-00:00", - * endAt: "2018-02-01T00:00:00-00:00" + * created_at: { + * start_at: "2018-01-01T00:00:00-00:00", + * end_at: "2018-02-01T00:00:00-00:00" * }, - * emailAddress: { + * email_address: { * fuzzy: "example.com" * }, - * groupIds: { + * group_ids: { * all: ["545AXB44B4XXWMVQ4W8SBT3HHF"] * } * }, @@ -46,7 +46,7 @@ export interface SearchCustomersRequest { * * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). */ - limit?: bigint; + limit?: number | 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`. diff --git a/src/api/resources/customers/client/requests/UpdateCustomerRequest.ts b/src/api/resources/customers/client/requests/UpdateCustomerRequest.ts index 634ee8d34..9e97ece17 100644 --- a/src/api/resources/customers/client/requests/UpdateCustomerRequest.ts +++ b/src/api/resources/customers/client/requests/UpdateCustomerRequest.ts @@ -2,40 +2,40 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * customerId: "customer_id", - * emailAddress: "New.Amelia.Earhart@example.com", + * customer_id: "customer_id", + * email_address: "New.Amelia.Earhart@example.com", * note: "updated customer note", - * version: 2 + * version: BigInt("2") * } */ export interface UpdateCustomerRequest { /** * The ID of the customer to update. */ - customerId: string; + customer_id: 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; + given_name?: 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; + family_name?: string | null; /** * A business name associated with the customer profile. * * The maximum length for this value is 500 characters. */ - companyName?: string | null; + company_name?: string | null; /** * A nickname for the customer profile. * @@ -47,7 +47,7 @@ export interface UpdateCustomerRequest { * * The maximum length for this value is 254 characters. */ - emailAddress?: string | null; + email_address?: string | null; /** * The physical address associated with the customer profile. Only new or changed fields are required in the request. * @@ -60,14 +60,14 @@ export interface UpdateCustomerRequest { * 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; + phone_number?: 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; + reference_id?: string | null; /** A custom note associated with the customer profile. */ note?: string | null; /** @@ -81,11 +81,11 @@ export interface UpdateCustomerRequest { * * 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; + version?: number | 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; + tax_ids?: Square.CustomerTaxIds; } diff --git a/src/api/resources/customers/client/requests/index.ts b/src/api/resources/customers/client/requests/index.ts index 01de7b583..efdd39ded 100644 --- a/src/api/resources/customers/client/requests/index.ts +++ b/src/api/resources/customers/client/requests/index.ts @@ -1,10 +1,10 @@ -export { type ListCustomersRequest } from "./ListCustomersRequest"; -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 GetCustomersRequest } from "./GetCustomersRequest"; -export { type UpdateCustomerRequest } from "./UpdateCustomerRequest"; -export { type DeleteCustomersRequest } from "./DeleteCustomersRequest"; +export { type ListCustomersRequest } from "./ListCustomersRequest.js"; +export { type CreateCustomerRequest } from "./CreateCustomerRequest.js"; +export { type BulkCreateCustomersRequest } from "./BulkCreateCustomersRequest.js"; +export { type BulkDeleteCustomersRequest } from "./BulkDeleteCustomersRequest.js"; +export { type BulkRetrieveCustomersRequest } from "./BulkRetrieveCustomersRequest.js"; +export { type BulkUpdateCustomersRequest } from "./BulkUpdateCustomersRequest.js"; +export { type SearchCustomersRequest } from "./SearchCustomersRequest.js"; +export { type GetCustomersRequest } from "./GetCustomersRequest.js"; +export { type UpdateCustomerRequest } from "./UpdateCustomerRequest.js"; +export { type DeleteCustomersRequest } from "./DeleteCustomersRequest.js"; diff --git a/src/api/resources/customers/index.ts b/src/api/resources/customers/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/customers/index.ts +++ b/src/api/resources/customers/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/customers/resources/cards/client/Client.ts b/src/api/resources/customers/resources/cards/client/Client.ts index 1f29d7a0b..fb65dd80c 100644 --- a/src/api/resources/customers/resources/cards/client/Client.ts +++ b/src/api/resources/customers/resources/cards/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Cards { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Cards { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Cards { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Cards { - constructor(protected readonly _options: Cards.Options = {}) {} + protected readonly _options: Cards.Options; + + constructor(_options: Cards.Options = {}) { + this._options = _options; + } /** * Adds a card on file to an existing customer. @@ -49,67 +54,63 @@ export class Cards { * * @example * await client.customers.cards.create({ - * customerId: "customer_id", - * cardNonce: "YOUR_CARD_NONCE", - * billingAddress: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * customer_id: "customer_id", + * card_nonce: "YOUR_CARD_NONCE", + * billing_address: { + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * cardholderName: "Amelia Earhart" + * cardholder_name: "Amelia Earhart" * }) */ - public async create( + public create( + request: Square.customers.CreateCustomerCardRequest, + requestOptions?: Cards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.customers.CreateCustomerCardRequest, requestOptions?: Cards.RequestOptions, - ): Promise { - const { customerId, ..._body } = request; + ): Promise> { + const { customer_id: customerId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.customers.CreateCustomerCardRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.CreateCustomerCardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -118,6 +119,7 @@ export class Cards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -126,6 +128,7 @@ export class Cards { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -138,54 +141,51 @@ export class Cards { * * @example * await client.customers.cards.delete({ - * customerId: "customer_id", - * cardId: "card_id" + * customer_id: "customer_id", + * card_id: "card_id" * }) */ - public async delete( + public delete( request: Square.customers.DeleteCardsRequest, requestOptions?: Cards.RequestOptions, - ): Promise { - const { customerId, cardId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.customers.DeleteCardsRequest, + requestOptions?: Cards.RequestOptions, + ): Promise> { + const { customer_id: customerId, card_id: cardId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteCustomerCardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -194,6 +194,7 @@ export class Cards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -202,6 +203,7 @@ export class Cards { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/customers/resources/cards/client/index.ts b/src/api/resources/customers/resources/cards/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/customers/resources/cards/client/index.ts +++ b/src/api/resources/customers/resources/cards/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts b/src/api/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts index 05226b95c..81e7f155e 100644 --- a/src/api/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts +++ b/src/api/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts @@ -2,29 +2,29 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * customerId: "customer_id", - * cardNonce: "YOUR_CARD_NONCE", - * billingAddress: { - * addressLine1: "500 Electric Ave", - * addressLine2: "Suite 600", + * customer_id: "customer_id", + * card_nonce: "YOUR_CARD_NONCE", + * billing_address: { + * address_line_1: "500 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, - * cardholderName: "Amelia Earhart" + * cardholder_name: "Amelia Earhart" * } */ export interface CreateCustomerCardRequest { /** * The Square ID of the customer profile the card is linked to. */ - customerId: string; + customer_id: string; /** * A card nonce representing the credit card to link to the customer. * @@ -35,7 +35,7 @@ export interface CreateCustomerCardRequest { * __NOTE:__ Card nonces generated by digital wallets (such as Apple Pay) * cannot be used to create a customer card. */ - cardNonce: string; + card_nonce: string; /** * Address information for the card on file. * @@ -43,13 +43,13 @@ export interface CreateCustomerCardRequest { * `CreateCustomerCardRequest.billing_address.postal_code` must match * the postal code encoded in the card nonce. */ - billingAddress?: Square.Address; + billing_address?: Square.Address; /** The full name printed on the credit card. */ - cardholderName?: string; + cardholder_name?: 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; + verification_token?: string; } diff --git a/src/api/resources/customers/resources/cards/client/requests/DeleteCardsRequest.ts b/src/api/resources/customers/resources/cards/client/requests/DeleteCardsRequest.ts index b21e54b56..b72cbba43 100644 --- a/src/api/resources/customers/resources/cards/client/requests/DeleteCardsRequest.ts +++ b/src/api/resources/customers/resources/cards/client/requests/DeleteCardsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * customerId: "customer_id", - * cardId: "card_id" + * customer_id: "customer_id", + * card_id: "card_id" * } */ export interface DeleteCardsRequest { /** * The ID of the customer that the card on file belongs to. */ - customerId: string; + customer_id: string; /** * The ID of the card on file to delete. */ - cardId: string; + card_id: 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 index f9b2da688..5c3100000 100644 --- a/src/api/resources/customers/resources/cards/client/requests/index.ts +++ b/src/api/resources/customers/resources/cards/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type CreateCustomerCardRequest } from "./CreateCustomerCardRequest"; -export { type DeleteCardsRequest } from "./DeleteCardsRequest"; +export { type CreateCustomerCardRequest } from "./CreateCustomerCardRequest.js"; +export { type DeleteCardsRequest } from "./DeleteCardsRequest.js"; diff --git a/src/api/resources/customers/resources/cards/index.ts b/src/api/resources/customers/resources/cards/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/customers/resources/cards/index.ts +++ b/src/api/resources/customers/resources/cards/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts index 85bb9526f..8ac184fcc 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributeDefinitions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributeDefinitions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributeDefinitions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributeDefinitions { - constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + protected readonly _options: CustomAttributeDefinitions.Options; + + constructor(_options: CustomAttributeDefinitions.Options = {}) { + this._options = _options; + } /** * Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. @@ -55,81 +60,82 @@ export class CustomAttributeDefinitions { request: Square.customers.ListCustomAttributeDefinitionsRequest = {}, requestOptions?: CustomAttributeDefinitions.RequestOptions, ): Promise> { - const list = async ( - request: Square.customers.ListCustomAttributeDefinitionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.customers.ListCustomAttributeDefinitionsRequest, + ): 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListCustomerCustomAttributeDefinitionsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable< Square.ListCustomerCustomAttributeDefinitionsResponse, Square.CustomAttributeDefinition >({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributeDefinitions ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attribute_definitions ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -154,7 +160,7 @@ export class CustomAttributeDefinitions { * * @example * await client.customers.customAttributeDefinitions.create({ - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "favoritemovie", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" @@ -165,53 +171,52 @@ export class CustomAttributeDefinitions { * } * }) */ - public async create( + public create( + request: Square.customers.CreateCustomerCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.customers.CreateCustomerCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.customers.CreateCustomerCustomAttributeDefinitionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateCustomerCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -220,6 +225,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -228,6 +234,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -247,10 +254,17 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async get( + public get( request: Square.customers.GetCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.customers.GetCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { const { key, version } = request; const _queryParams: Record = {}; if (version !== undefined) { @@ -258,45 +272,38 @@ export class CustomAttributeDefinitions { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetCustomerCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -305,6 +312,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -313,6 +321,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -332,60 +341,59 @@ export class CustomAttributeDefinitions { * @example * await client.customers.customAttributeDefinitions.update({ * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * description: "Update the description as desired.", * visibility: "VISIBILITY_READ_ONLY" * } * }) */ - public async update( + public update( request: Square.customers.UpdateCustomerCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.customers.UpdateCustomerCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { const { key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.customers.UpdateCustomerCustomAttributeDefinitionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateCustomerCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -394,6 +402,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -402,6 +411,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -422,50 +432,50 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async delete( + public delete( request: Square.customers.DeleteCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.customers.DeleteCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { const { key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteCustomerCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -474,6 +484,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -482,6 +493,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -509,36 +521,36 @@ export class CustomAttributeDefinitions { * await client.customers.customAttributeDefinitions.batchUpsert({ * values: { * "id1": { - * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", - * customAttribute: { + * customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + * custom_attribute: { * key: "favoritemovie", * value: "Dune" * } * }, * "id2": { - * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", - * customAttribute: { + * customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * custom_attribute: { * key: "ownsmovie", * value: false * } * }, * "id3": { - * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", - * customAttribute: { + * customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * custom_attribute: { * key: "favoritemovie", * value: "Star Wars" * } * }, * "id4": { - * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", - * customAttribute: { + * customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + * custom_attribute: { * key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", * value: "10.5" * } * }, * "id5": { - * customerId: "70548QG1HN43B05G0KCZ4MMC1G", - * customAttribute: { + * customer_id: "70548QG1HN43B05G0KCZ4MMC1G", + * custom_attribute: { * key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", * value: "fake-email@squareup.com" * } @@ -546,53 +558,52 @@ export class CustomAttributeDefinitions { * } * }) */ - public async batchUpsert( + public batchUpsert( request: Square.customers.BatchUpsertCustomerCustomAttributesRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpsert(request, requestOptions)); + } + + private async __batchUpsert( + request: Square.customers.BatchUpsertCustomerCustomAttributesRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.customers.BatchUpsertCustomerCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchUpsertCustomerCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -601,6 +612,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -609,6 +621,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/index.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts index a4550a3fe..cc0a59a1f 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts @@ -2,43 +2,43 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * values: { * "id1": { - * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", - * customAttribute: { + * customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + * custom_attribute: { * key: "favoritemovie", * value: "Dune" * } * }, * "id2": { - * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", - * customAttribute: { + * customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * custom_attribute: { * key: "ownsmovie", * value: false * } * }, * "id3": { - * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", - * customAttribute: { + * customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * custom_attribute: { * key: "favoritemovie", * value: "Star Wars" * } * }, * "id4": { - * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", - * customAttribute: { + * customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + * custom_attribute: { * key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", * value: "10.5" * } * }, * "id5": { - * customerId: "70548QG1HN43B05G0KCZ4MMC1G", - * customAttribute: { + * customer_id: "70548QG1HN43B05G0KCZ4MMC1G", + * custom_attribute: { * key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", * value: "fake-email@squareup.com" * } diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts index f433f19ae..94bb2ed85 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "favoritemovie", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" @@ -27,10 +27,10 @@ export interface CreateCustomerCustomAttributeDefinitionRequest { * - 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; + custom_attribute_definition: 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; + idempotency_key?: string; } diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts index 1a6d65104..6fabe434c 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * description: "Update the description as desired.", * visibility: "VISIBILITY_READ_ONLY" * } @@ -36,10 +36,10 @@ export interface UpdateCustomerCustomAttributeDefinitionRequest { * 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; + custom_attribute_definition: 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; + idempotency_key?: 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 index 5ad73b714..cda9eac1f 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest"; -export { type CreateCustomerCustomAttributeDefinitionRequest } from "./CreateCustomerCustomAttributeDefinitionRequest"; -export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest"; -export { type UpdateCustomerCustomAttributeDefinitionRequest } from "./UpdateCustomerCustomAttributeDefinitionRequest"; -export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest"; -export { type BatchUpsertCustomerCustomAttributesRequest } from "./BatchUpsertCustomerCustomAttributesRequest"; +export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest.js"; +export { type CreateCustomerCustomAttributeDefinitionRequest } from "./CreateCustomerCustomAttributeDefinitionRequest.js"; +export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest.js"; +export { type UpdateCustomerCustomAttributeDefinitionRequest } from "./UpdateCustomerCustomAttributeDefinitionRequest.js"; +export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest.js"; +export { type BatchUpsertCustomerCustomAttributesRequest } from "./BatchUpsertCustomerCustomAttributesRequest.js"; diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/index.ts b/src/api/resources/customers/resources/customAttributeDefinitions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/index.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/customers/resources/customAttributes/client/Client.ts b/src/api/resources/customers/resources/customAttributes/client/Client.ts index aa1364f0e..3911affce 100644 --- a/src/api/resources/customers/resources/customAttributes/client/Client.ts +++ b/src/api/resources/customers/resources/customAttributes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributes { - constructor(protected readonly _options: CustomAttributes.Options = {}) {} + protected readonly _options: CustomAttributes.Options; + + constructor(_options: CustomAttributes.Options = {}) { + this._options = _options; + } /** * Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile. @@ -52,88 +57,89 @@ export class CustomAttributes { * * @example * await client.customers.customAttributes.list({ - * customerId: "customer_id" + * customer_id: "customer_id" * }) */ public async list( request: Square.customers.ListCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, ): Promise> { - const list = async ( - request: Square.customers.ListCustomAttributesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.customers.ListCustomAttributesRequest, + ): Promise> => { + const { customer_id: customerId, limit, cursor, with_definitions: 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListCustomerCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributes ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attributes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -155,15 +161,22 @@ export class CustomAttributes { * * @example * await client.customers.customAttributes.get({ - * customerId: "customer_id", + * customer_id: "customer_id", * key: "key" * }) */ - public async get( + public get( request: Square.customers.GetCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { customerId, key, withDefinition, version } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.customers.GetCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { customer_id: customerId, key, with_definition: withDefinition, version } = request; const _queryParams: Record = {}; if (withDefinition !== undefined) { _queryParams["with_definition"] = withDefinition?.toString() ?? null; @@ -174,45 +187,38 @@ export class CustomAttributes { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetCustomerCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -221,6 +227,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -229,6 +236,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -249,61 +257,60 @@ export class CustomAttributes { * * @example * await client.customers.customAttributes.upsert({ - * customerId: "customer_id", + * customer_id: "customer_id", * key: "key", - * customAttribute: { + * custom_attribute: { * value: "Dune" * } * }) */ - public async upsert( + public upsert( + request: Square.customers.UpsertCustomerCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions)); + } + + private async __upsert( request: Square.customers.UpsertCustomerCustomAttributeRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { customerId, key, ..._body } = request; + ): Promise> { + const { customer_id: customerId, key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.customers.UpsertCustomerCustomAttributeRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpsertCustomerCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -312,6 +319,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -320,6 +328,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -336,54 +345,54 @@ export class CustomAttributes { * * @example * await client.customers.customAttributes.delete({ - * customerId: "customer_id", + * customer_id: "customer_id", * key: "key" * }) */ - public async delete( + public delete( request: Square.customers.DeleteCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { customerId, key } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.customers.DeleteCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { customer_id: customerId, key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteCustomerCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -392,6 +401,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -400,6 +410,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/customers/resources/customAttributes/client/index.ts b/src/api/resources/customers/resources/customAttributes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/customers/resources/customAttributes/client/index.ts +++ b/src/api/resources/customers/resources/customAttributes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts b/src/api/resources/customers/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts index fd96e16a6..7d2581bcf 100644 --- a/src/api/resources/customers/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts +++ b/src/api/resources/customers/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * customerId: "customer_id", + * customer_id: "customer_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface DeleteCustomAttributesRequest { /** * The ID of the target [customer profile](entity:Customer). */ - customerId: string; + customer_id: 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 diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts b/src/api/resources/customers/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts index f59d7efa3..b1ff37bc9 100644 --- a/src/api/resources/customers/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/customers/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * customerId: "customer_id", + * customer_id: "customer_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface GetCustomAttributesRequest { /** * The ID of the target [customer profile](entity:Customer). */ - customerId: string; + customer_id: 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 @@ -25,7 +25,7 @@ export interface GetCustomAttributesRequest { * 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; + with_definition?: 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 diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts b/src/api/resources/customers/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts index 505056267..533c931bd 100644 --- a/src/api/resources/customers/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/customers/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * customerId: "customer_id" + * customer_id: "customer_id" * } */ export interface ListCustomAttributesRequest { /** * The ID of the target [customer profile](entity:Customer). */ - customerId: string; + customer_id: 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. @@ -30,5 +30,5 @@ export interface ListCustomAttributesRequest { * 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; + with_definitions?: 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 index c9728624d..eb15ad22c 100644 --- a/src/api/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts +++ b/src/api/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * customerId: "customer_id", + * customer_id: "customer_id", * key: "key", - * customAttribute: { + * custom_attribute: { * value: "Dune" * } * } @@ -18,7 +18,7 @@ export interface UpsertCustomerCustomAttributeRequest { /** * The ID of the target [customer profile](entity:Customer). */ - customerId: string; + customer_id: 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 @@ -35,10 +35,10 @@ export interface UpsertCustomerCustomAttributeRequest { * control for an update operation, include this optional field and specify the current version * of the custom attribute. */ - customAttribute: Square.CustomAttribute; + custom_attribute: 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; + idempotency_key?: 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 index db9a23463..23f1c4d0a 100644 --- a/src/api/resources/customers/resources/customAttributes/client/requests/index.ts +++ b/src/api/resources/customers/resources/customAttributes/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest"; -export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest"; -export { type UpsertCustomerCustomAttributeRequest } from "./UpsertCustomerCustomAttributeRequest"; -export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest"; +export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest.js"; +export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest.js"; +export { type UpsertCustomerCustomAttributeRequest } from "./UpsertCustomerCustomAttributeRequest.js"; +export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest.js"; diff --git a/src/api/resources/customers/resources/customAttributes/index.ts b/src/api/resources/customers/resources/customAttributes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/customers/resources/customAttributes/index.ts +++ b/src/api/resources/customers/resources/customAttributes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/customers/resources/groups/client/Client.ts b/src/api/resources/customers/resources/groups/client/Client.ts index a0c37461b..13f1379f9 100644 --- a/src/api/resources/customers/resources/groups/client/Client.ts +++ b/src/api/resources/customers/resources/groups/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Groups { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Groups { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Groups { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Groups { - constructor(protected readonly _options: Groups.Options = {}) {} + protected readonly _options: Groups.Options; + + constructor(_options: Groups.Options = {}) { + this._options = _options; + } /** * Retrieves the list of customer groups of a business. @@ -50,75 +55,76 @@ export class Groups { request: Square.customers.ListGroupsRequest = {}, requestOptions?: Groups.RequestOptions, ): Promise> { - const list = async ( - request: Square.customers.ListGroupsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.customers.ListGroupsRequest, + ): 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/groups", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListCustomerGroupsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/customers/groups."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.groups ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -141,53 +147,49 @@ export class Groups { * } * }) */ - public async create( + public create( + request: Square.customers.CreateCustomerGroupRequest, + requestOptions?: Groups.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.customers.CreateCustomerGroupRequest, requestOptions?: Groups.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.customers.CreateCustomerGroupRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateCustomerGroupResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -196,12 +198,14 @@ export class Groups { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/groups."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -214,53 +218,50 @@ export class Groups { * * @example * await client.customers.groups.get({ - * groupId: "group_id" + * group_id: "group_id" * }) */ - public async get( + public get( + request: Square.customers.GetGroupsRequest, + requestOptions?: Groups.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.customers.GetGroupsRequest, requestOptions?: Groups.RequestOptions, - ): Promise { - const { groupId } = request; + ): Promise> { + const { group_id: groupId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetCustomerGroupResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -269,6 +270,7 @@ export class Groups { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -277,6 +279,7 @@ export class Groups { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -289,60 +292,56 @@ export class Groups { * * @example * await client.customers.groups.update({ - * groupId: "group_id", + * group_id: "group_id", * group: { * name: "Loyal Customers" * } * }) */ - public async update( + public update( + request: Square.customers.UpdateCustomerGroupRequest, + requestOptions?: Groups.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.customers.UpdateCustomerGroupRequest, requestOptions?: Groups.RequestOptions, - ): Promise { - const { groupId, ..._body } = request; + ): Promise> { + const { group_id: groupId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.customers.UpdateCustomerGroupRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateCustomerGroupResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -351,6 +350,7 @@ export class Groups { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -359,6 +359,7 @@ export class Groups { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -371,53 +372,50 @@ export class Groups { * * @example * await client.customers.groups.delete({ - * groupId: "group_id" + * group_id: "group_id" * }) */ - public async delete( + public delete( request: Square.customers.DeleteGroupsRequest, requestOptions?: Groups.RequestOptions, - ): Promise { - const { groupId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.customers.DeleteGroupsRequest, + requestOptions?: Groups.RequestOptions, + ): Promise> { + const { group_id: groupId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteCustomerGroupResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -426,6 +424,7 @@ export class Groups { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -434,6 +433,7 @@ export class Groups { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -449,54 +449,51 @@ export class Groups { * * @example * await client.customers.groups.add({ - * customerId: "customer_id", - * groupId: "group_id" + * customer_id: "customer_id", + * group_id: "group_id" * }) */ - public async add( + public add( + request: Square.customers.AddGroupsRequest, + requestOptions?: Groups.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__add(request, requestOptions)); + } + + private async __add( request: Square.customers.AddGroupsRequest, requestOptions?: Groups.RequestOptions, - ): Promise { - const { customerId, groupId } = request; + ): Promise> { + const { customer_id: customerId, group_id: groupId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.AddGroupToCustomerResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -505,6 +502,7 @@ export class Groups { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -513,6 +511,7 @@ export class Groups { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -528,54 +527,54 @@ export class Groups { * * @example * await client.customers.groups.remove({ - * customerId: "customer_id", - * groupId: "group_id" + * customer_id: "customer_id", + * group_id: "group_id" * }) */ - public async remove( + public remove( + request: Square.customers.RemoveGroupsRequest, + requestOptions?: Groups.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__remove(request, requestOptions)); + } + + private async __remove( request: Square.customers.RemoveGroupsRequest, requestOptions?: Groups.RequestOptions, - ): Promise { - const { customerId, groupId } = request; + ): Promise> { + const { customer_id: customerId, group_id: groupId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RemoveGroupFromCustomerResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -584,6 +583,7 @@ export class Groups { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -592,6 +592,7 @@ export class Groups { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/customers/resources/groups/client/index.ts b/src/api/resources/customers/resources/groups/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/customers/resources/groups/client/index.ts +++ b/src/api/resources/customers/resources/groups/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/customers/resources/groups/client/requests/AddGroupsRequest.ts b/src/api/resources/customers/resources/groups/client/requests/AddGroupsRequest.ts index df2f570ea..f7556d79e 100644 --- a/src/api/resources/customers/resources/groups/client/requests/AddGroupsRequest.ts +++ b/src/api/resources/customers/resources/groups/client/requests/AddGroupsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * customerId: "customer_id", - * groupId: "group_id" + * customer_id: "customer_id", + * group_id: "group_id" * } */ export interface AddGroupsRequest { /** * The ID of the customer to add to a group. */ - customerId: string; + customer_id: string; /** * The ID of the customer group to add the customer to. */ - groupId: string; + group_id: string; } diff --git a/src/api/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts b/src/api/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts index 4bbad8d1a..866785e91 100644 --- a/src/api/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts +++ b/src/api/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -14,7 +14,7 @@ import * as Square from "../../../../../../index"; */ 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; + idempotency_key?: string; /** The customer group to create. */ group: Square.CustomerGroup; } diff --git a/src/api/resources/customers/resources/groups/client/requests/DeleteGroupsRequest.ts b/src/api/resources/customers/resources/groups/client/requests/DeleteGroupsRequest.ts index 42f86baa1..a459259bc 100644 --- a/src/api/resources/customers/resources/groups/client/requests/DeleteGroupsRequest.ts +++ b/src/api/resources/customers/resources/groups/client/requests/DeleteGroupsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * groupId: "group_id" + * group_id: "group_id" * } */ export interface DeleteGroupsRequest { /** * The ID of the customer group to delete. */ - groupId: string; + group_id: string; } diff --git a/src/api/resources/customers/resources/groups/client/requests/GetGroupsRequest.ts b/src/api/resources/customers/resources/groups/client/requests/GetGroupsRequest.ts index 2ee379d62..5ab05ce0f 100644 --- a/src/api/resources/customers/resources/groups/client/requests/GetGroupsRequest.ts +++ b/src/api/resources/customers/resources/groups/client/requests/GetGroupsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * groupId: "group_id" + * group_id: "group_id" * } */ export interface GetGroupsRequest { /** * The ID of the customer group to retrieve. */ - groupId: string; + group_id: string; } diff --git a/src/api/resources/customers/resources/groups/client/requests/RemoveGroupsRequest.ts b/src/api/resources/customers/resources/groups/client/requests/RemoveGroupsRequest.ts index 5404edfa6..018902278 100644 --- a/src/api/resources/customers/resources/groups/client/requests/RemoveGroupsRequest.ts +++ b/src/api/resources/customers/resources/groups/client/requests/RemoveGroupsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * customerId: "customer_id", - * groupId: "group_id" + * customer_id: "customer_id", + * group_id: "group_id" * } */ export interface RemoveGroupsRequest { /** * The ID of the customer to remove from the group. */ - customerId: string; + customer_id: string; /** * The ID of the customer group to remove the customer from. */ - groupId: string; + group_id: 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 index d1655a132..bf5f49ec3 100644 --- a/src/api/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts +++ b/src/api/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * groupId: "group_id", + * group_id: "group_id", * group: { * name: "Loyal Customers" * } @@ -17,7 +17,7 @@ export interface UpdateCustomerGroupRequest { /** * The ID of the customer group to update. */ - groupId: string; + group_id: 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 index 8b20adcd7..17a0831a8 100644 --- a/src/api/resources/customers/resources/groups/client/requests/index.ts +++ b/src/api/resources/customers/resources/groups/client/requests/index.ts @@ -1,7 +1,7 @@ -export { type ListGroupsRequest } from "./ListGroupsRequest"; -export { type CreateCustomerGroupRequest } from "./CreateCustomerGroupRequest"; -export { type GetGroupsRequest } from "./GetGroupsRequest"; -export { type UpdateCustomerGroupRequest } from "./UpdateCustomerGroupRequest"; -export { type DeleteGroupsRequest } from "./DeleteGroupsRequest"; -export { type AddGroupsRequest } from "./AddGroupsRequest"; -export { type RemoveGroupsRequest } from "./RemoveGroupsRequest"; +export { type ListGroupsRequest } from "./ListGroupsRequest.js"; +export { type CreateCustomerGroupRequest } from "./CreateCustomerGroupRequest.js"; +export { type GetGroupsRequest } from "./GetGroupsRequest.js"; +export { type UpdateCustomerGroupRequest } from "./UpdateCustomerGroupRequest.js"; +export { type DeleteGroupsRequest } from "./DeleteGroupsRequest.js"; +export { type AddGroupsRequest } from "./AddGroupsRequest.js"; +export { type RemoveGroupsRequest } from "./RemoveGroupsRequest.js"; diff --git a/src/api/resources/customers/resources/groups/index.ts b/src/api/resources/customers/resources/groups/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/customers/resources/groups/index.ts +++ b/src/api/resources/customers/resources/groups/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/customers/resources/index.ts b/src/api/resources/customers/resources/index.ts index 7cd096b80..353874030 100644 --- a/src/api/resources/customers/resources/index.ts +++ b/src/api/resources/customers/resources/index.ts @@ -1,10 +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"; +export * as customAttributeDefinitions from "./customAttributeDefinitions/index.js"; +export * as groups from "./groups/index.js"; +export * as segments from "./segments/index.js"; +export * as cards from "./cards/index.js"; +export * as customAttributes from "./customAttributes/index.js"; +export * from "./customAttributeDefinitions/client/requests/index.js"; +export * from "./groups/client/requests/index.js"; +export * from "./segments/client/requests/index.js"; +export * from "./cards/client/requests/index.js"; +export * from "./customAttributes/client/requests/index.js"; diff --git a/src/api/resources/customers/resources/segments/client/Client.ts b/src/api/resources/customers/resources/segments/client/Client.ts index 3d4d9cbb8..8aed24269 100644 --- a/src/api/resources/customers/resources/segments/client/Client.ts +++ b/src/api/resources/customers/resources/segments/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Segments { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Segments { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Segments { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Segments { - constructor(protected readonly _options: Segments.Options = {}) {} + protected readonly _options: Segments.Options; + + constructor(_options: Segments.Options = {}) { + this._options = _options; + } /** * Retrieves the list of customer segments of a business. @@ -50,75 +55,78 @@ export class Segments { request: Square.customers.ListSegmentsRequest = {}, requestOptions?: Segments.RequestOptions, ): Promise> { - const list = async ( - request: Square.customers.ListSegmentsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.customers.ListSegmentsRequest, + ): 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/segments", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListCustomerSegmentsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/customers/segments.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.segments ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -134,53 +142,50 @@ export class Segments { * * @example * await client.customers.segments.get({ - * segmentId: "segment_id" + * segment_id: "segment_id" * }) */ - public async get( + public get( + request: Square.customers.GetSegmentsRequest, + requestOptions?: Segments.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.customers.GetSegmentsRequest, requestOptions?: Segments.RequestOptions, - ): Promise { - const { segmentId } = request; + ): Promise> { + const { segment_id: segmentId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetCustomerSegmentResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -189,6 +194,7 @@ export class Segments { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -197,6 +203,7 @@ export class Segments { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/customers/resources/segments/client/index.ts b/src/api/resources/customers/resources/segments/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/customers/resources/segments/client/index.ts +++ b/src/api/resources/customers/resources/segments/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/customers/resources/segments/client/requests/GetSegmentsRequest.ts b/src/api/resources/customers/resources/segments/client/requests/GetSegmentsRequest.ts index e8c325079..fd06164bd 100644 --- a/src/api/resources/customers/resources/segments/client/requests/GetSegmentsRequest.ts +++ b/src/api/resources/customers/resources/segments/client/requests/GetSegmentsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * segmentId: "segment_id" + * segment_id: "segment_id" * } */ export interface GetSegmentsRequest { /** * The Square-issued ID of the customer segment. */ - segmentId: string; + segment_id: string; } diff --git a/src/api/resources/customers/resources/segments/client/requests/index.ts b/src/api/resources/customers/resources/segments/client/requests/index.ts index f5fa9bba2..87ca00961 100644 --- a/src/api/resources/customers/resources/segments/client/requests/index.ts +++ b/src/api/resources/customers/resources/segments/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListSegmentsRequest } from "./ListSegmentsRequest"; -export { type GetSegmentsRequest } from "./GetSegmentsRequest"; +export { type ListSegmentsRequest } from "./ListSegmentsRequest.js"; +export { type GetSegmentsRequest } from "./GetSegmentsRequest.js"; diff --git a/src/api/resources/customers/resources/segments/index.ts b/src/api/resources/customers/resources/segments/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/customers/resources/segments/index.ts +++ b/src/api/resources/customers/resources/segments/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/devices/client/Client.ts b/src/api/resources/devices/client/Client.ts index 2dfabecaf..6367c0117 100644 --- a/src/api/resources/devices/client/Client.ts +++ b/src/api/resources/devices/client/Client.ts @@ -2,13 +2,12 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { Codes } from "../resources/codes/client/Client.js"; export declare namespace Devices { export interface Options { @@ -18,6 +17,8 @@ export declare namespace Devices { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -31,14 +32,17 @@ export declare namespace Devices { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Devices { + protected readonly _options: Devices.Options; protected _codes: Codes | undefined; - constructor(protected readonly _options: Devices.Options = {}) {} + constructor(_options: Devices.Options = {}) { + this._options = _options; + } public get codes(): Codes { return (this._codes ??= new Codes(this._options)); @@ -58,82 +62,77 @@ export class Devices { request: Square.ListDevicesRequest = {}, requestOptions?: Devices.RequestOptions, ): Promise> { - const list = async (request: Square.ListDevicesRequest): 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, + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListDevicesRequest): Promise> => { + const { cursor, sort_order: sortOrder, limit, location_id: locationId } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = sortOrder; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/devices", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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": + if (_response.ok) { + return { data: _response.body as Square.ListDevicesResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/devices."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.devices ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -149,53 +148,50 @@ export class Devices { * * @example * await client.devices.get({ - * deviceId: "device_id" + * device_id: "device_id" * }) */ - public async get( + public get( + request: Square.GetDevicesRequest, + requestOptions?: Devices.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetDevicesRequest, requestOptions?: Devices.RequestOptions, - ): Promise { - const { deviceId } = request; + ): Promise> { + const { device_id: deviceId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetDeviceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -204,12 +200,14 @@ export class Devices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/devices/client/index.ts b/src/api/resources/devices/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/devices/client/index.ts +++ b/src/api/resources/devices/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/devices/client/requests/GetDevicesRequest.ts b/src/api/resources/devices/client/requests/GetDevicesRequest.ts index cce78e0b7..67652f69a 100644 --- a/src/api/resources/devices/client/requests/GetDevicesRequest.ts +++ b/src/api/resources/devices/client/requests/GetDevicesRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * deviceId: "device_id" + * device_id: "device_id" * } */ export interface GetDevicesRequest { /** * The unique ID for the desired `Device`. */ - deviceId: string; + device_id: string; } diff --git a/src/api/resources/devices/client/requests/ListDevicesRequest.ts b/src/api/resources/devices/client/requests/ListDevicesRequest.ts index 323d264f4..e12fa2b35 100644 --- a/src/api/resources/devices/client/requests/ListDevicesRequest.ts +++ b/src/api/resources/devices/client/requests/ListDevicesRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -20,7 +20,7 @@ export interface ListDevicesRequest { * - `ASC` - Oldest to newest. * - `DESC` - Newest to oldest (default). */ - sortOrder?: Square.SortOrder | null; + sort_order?: Square.SortOrder | null; /** * The number of results to return in a single page. */ @@ -28,5 +28,5 @@ export interface ListDevicesRequest { /** * If present, only returns devices at the target location. */ - locationId?: string | null; + location_id?: string | null; } diff --git a/src/api/resources/devices/client/requests/index.ts b/src/api/resources/devices/client/requests/index.ts index cb037fcfd..7861b73f6 100644 --- a/src/api/resources/devices/client/requests/index.ts +++ b/src/api/resources/devices/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListDevicesRequest } from "./ListDevicesRequest"; -export { type GetDevicesRequest } from "./GetDevicesRequest"; +export { type ListDevicesRequest } from "./ListDevicesRequest.js"; +export { type GetDevicesRequest } from "./GetDevicesRequest.js"; diff --git a/src/api/resources/devices/index.ts b/src/api/resources/devices/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/devices/index.ts +++ b/src/api/resources/devices/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/devices/resources/codes/client/Client.ts b/src/api/resources/devices/resources/codes/client/Client.ts index 24ce8aad2..55fab92be 100644 --- a/src/api/resources/devices/resources/codes/client/Client.ts +++ b/src/api/resources/devices/resources/codes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Codes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Codes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Codes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Codes { - constructor(protected readonly _options: Codes.Options = {}) {} + protected readonly _options: Codes.Options; + + constructor(_options: Codes.Options = {}) { + this._options = _options; + } /** * Lists all DeviceCodes associated with the merchant. @@ -50,86 +55,83 @@ export class Codes { request: Square.devices.ListCodesRequest = {}, requestOptions?: Codes.RequestOptions, ): Promise> { - const list = async (request: Square.devices.ListCodesRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.devices.ListCodesRequest, + ): Promise> => { + const { cursor, location_id: locationId, product_type: 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"] = productType; + } + if (status !== undefined) { + _queryParams["status"] = status; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/devices/codes", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListDeviceCodesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/devices/codes."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.deviceCodes ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.device_codes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -145,61 +147,57 @@ export class Codes { * * @example * await client.devices.codes.create({ - * idempotencyKey: "01bb00a6-0c86-4770-94ed-f5fca973cd56", - * deviceCode: { + * idempotency_key: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + * device_code: { * name: "Counter 1", - * productType: "TERMINAL_API", - * locationId: "B5E4484SHHNYH" + * product_type: "TERMINAL_API", + * location_id: "B5E4484SHHNYH" * } * }) */ - public async create( + public create( + request: Square.devices.CreateDeviceCodeRequest, + requestOptions?: Codes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.devices.CreateDeviceCodeRequest, requestOptions?: Codes.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.devices.CreateDeviceCodeRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateDeviceCodeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -208,12 +206,14 @@ export class Codes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/devices/codes."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -229,50 +229,47 @@ export class Codes { * id: "id" * }) */ - public async get( + public get( request: Square.devices.GetCodesRequest, requestOptions?: Codes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.devices.GetCodesRequest, + requestOptions?: Codes.RequestOptions, + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetDeviceCodeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -281,12 +278,14 @@ export class Codes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/devices/resources/codes/client/index.ts b/src/api/resources/devices/resources/codes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/devices/resources/codes/client/index.ts +++ b/src/api/resources/devices/resources/codes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts b/src/api/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts index 2e6a6d4fe..050329584 100644 --- a/src/api/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts +++ b/src/api/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "01bb00a6-0c86-4770-94ed-f5fca973cd56", - * deviceCode: { + * idempotency_key: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + * device_code: { * name: "Counter 1", - * productType: "TERMINAL_API", - * locationId: "B5E4484SHHNYH" + * product_type: "TERMINAL_API", + * location_id: "B5E4484SHHNYH" * } * } */ @@ -22,7 +22,7 @@ export interface CreateDeviceCodeRequest { * * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: string; /** The device code to create. */ - deviceCode: Square.DeviceCode; + device_code: Square.DeviceCode; } diff --git a/src/api/resources/devices/resources/codes/client/requests/ListCodesRequest.ts b/src/api/resources/devices/resources/codes/client/requests/ListCodesRequest.ts index dcb084347..d611db583 100644 --- a/src/api/resources/devices/resources/codes/client/requests/ListCodesRequest.ts +++ b/src/api/resources/devices/resources/codes/client/requests/ListCodesRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -20,12 +20,12 @@ export interface ListCodesRequest { * If specified, only returns DeviceCodes of the specified location. * Returns DeviceCodes of all locations if empty. */ - locationId?: string | null; + location_id?: string | null; /** * If specified, only returns DeviceCodes targeting the specified product type. * Returns DeviceCodes of all product types if empty. */ - productType?: Square.ProductType | null; + product_type?: Square.ProductType | null; /** * If specified, returns DeviceCodes with the specified statuses. * Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. diff --git a/src/api/resources/devices/resources/codes/client/requests/index.ts b/src/api/resources/devices/resources/codes/client/requests/index.ts index 884d772bf..d6a2ce278 100644 --- a/src/api/resources/devices/resources/codes/client/requests/index.ts +++ b/src/api/resources/devices/resources/codes/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type ListCodesRequest } from "./ListCodesRequest"; -export { type CreateDeviceCodeRequest } from "./CreateDeviceCodeRequest"; -export { type GetCodesRequest } from "./GetCodesRequest"; +export { type ListCodesRequest } from "./ListCodesRequest.js"; +export { type CreateDeviceCodeRequest } from "./CreateDeviceCodeRequest.js"; +export { type GetCodesRequest } from "./GetCodesRequest.js"; diff --git a/src/api/resources/devices/resources/codes/index.ts b/src/api/resources/devices/resources/codes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/devices/resources/codes/index.ts +++ b/src/api/resources/devices/resources/codes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/devices/resources/index.ts b/src/api/resources/devices/resources/index.ts index b75af3b53..c7a441288 100644 --- a/src/api/resources/devices/resources/index.ts +++ b/src/api/resources/devices/resources/index.ts @@ -1,2 +1,2 @@ -export * as codes from "./codes"; -export * from "./codes/client/requests"; +export * as codes from "./codes/index.js"; +export * from "./codes/client/requests/index.js"; diff --git a/src/api/resources/disputes/client/Client.ts b/src/api/resources/disputes/client/Client.ts index cbb523844..1664704ae 100644 --- a/src/api/resources/disputes/client/Client.ts +++ b/src/api/resources/disputes/client/Client.ts @@ -2,14 +2,13 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { toJson } from "../../../../core/json.js"; +import { Evidence } from "../resources/evidence/client/Client.js"; export declare namespace Disputes { export interface Options { @@ -19,6 +18,8 @@ export declare namespace Disputes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -32,14 +33,17 @@ export declare namespace Disputes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Disputes { + protected readonly _options: Disputes.Options; protected _evidence: Evidence | undefined; - constructor(protected readonly _options: Disputes.Options = {}) {} + constructor(_options: Disputes.Options = {}) { + this._options = _options; + } public get evidence(): Evidence { return (this._evidence ??= new Evidence(this._options)); @@ -58,79 +62,74 @@ export class Disputes { request: Square.ListDisputesRequest = {}, requestOptions?: Disputes.RequestOptions, ): Promise> { - const list = async (request: Square.ListDisputesRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListDisputesRequest): Promise> => { + const { cursor, states, location_id: locationId } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (states !== undefined) { + _queryParams["states"] = states; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/disputes", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListDisputesResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/disputes."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/disputes."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.disputes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -146,53 +145,50 @@ export class Disputes { * * @example * await client.disputes.get({ - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * }) */ - public async get( + public get( + request: Square.GetDisputesRequest, + requestOptions?: Disputes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetDisputesRequest, requestOptions?: Disputes.RequestOptions, - ): Promise { - const { disputeId } = request; + ): Promise> { + const { dispute_id: disputeId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetDisputeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -201,12 +197,14 @@ export class Disputes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -223,53 +221,50 @@ export class Disputes { * * @example * await client.disputes.accept({ - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * }) */ - public async accept( + public accept( + request: Square.AcceptDisputesRequest, + requestOptions?: Disputes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__accept(request, requestOptions)); + } + + private async __accept( request: Square.AcceptDisputesRequest, requestOptions?: Disputes.RequestOptions, - ): Promise { - const { disputeId } = request; + ): Promise> { + const { dispute_id: disputeId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.AcceptDisputeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -278,6 +273,7 @@ export class Disputes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -286,6 +282,7 @@ export class Disputes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -299,51 +296,47 @@ export class Disputes { * * @example * await client.disputes.createEvidenceFile({ - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * }) */ - public async createEvidenceFile( + public createEvidenceFile( request: Square.CreateEvidenceFileDisputesRequest, requestOptions?: Disputes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createEvidenceFile(request, requestOptions)); + } + + private async __createEvidenceFile( + request: Square.CreateEvidenceFileDisputesRequest, + 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, - }), - ), - ); + _request.append("request", toJson(request.request)); } - if (request.imageFile != null) { - await _request.appendFile("image_file", request.imageFile); + if (request.image_file != null) { + await _request.appendFile("image_file", request.image_file); } const _maybeEncodedRequest = await _request.getRequest(); const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, - `v2/disputes/${encodeURIComponent(request.disputeId)}/evidence-files`, + `v2/disputes/${encodeURIComponent(request.dispute_id)}/evidence-files`, ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ..._maybeEncodedRequest.headers, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + ..._maybeEncodedRequest.headers, + }), + requestOptions?.headers, + ), requestType: "file", duplex: _maybeEncodedRequest.duplex, body: _maybeEncodedRequest.body, @@ -352,19 +345,17 @@ export class Disputes { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateDisputeEvidenceFileResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Square.CreateDisputeEvidenceFileResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -373,6 +364,7 @@ export class Disputes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -381,6 +373,7 @@ export class Disputes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -393,60 +386,59 @@ export class Disputes { * * @example * await client.disputes.createEvidenceText({ - * disputeId: "dispute_id", - * idempotencyKey: "ed3ee3933d946f1514d505d173c82648", - * evidenceType: "TRACKING_NUMBER", - * evidenceText: "1Z8888888888888888" + * dispute_id: "dispute_id", + * idempotency_key: "ed3ee3933d946f1514d505d173c82648", + * evidence_type: "TRACKING_NUMBER", + * evidence_text: "1Z8888888888888888" * }) */ - public async createEvidenceText( + public createEvidenceText( + request: Square.CreateDisputeEvidenceTextRequest, + requestOptions?: Disputes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createEvidenceText(request, requestOptions)); + } + + private async __createEvidenceText( request: Square.CreateDisputeEvidenceTextRequest, requestOptions?: Disputes.RequestOptions, - ): Promise { - const { disputeId, ..._body } = request; + ): Promise> { + const { dispute_id: disputeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateDisputeEvidenceTextRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.CreateDisputeEvidenceTextResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -455,6 +447,7 @@ export class Disputes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -463,6 +456,7 @@ export class Disputes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -481,53 +475,50 @@ export class Disputes { * * @example * await client.disputes.submitEvidence({ - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * }) */ - public async submitEvidence( + public submitEvidence( + request: Square.SubmitEvidenceDisputesRequest, + requestOptions?: Disputes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__submitEvidence(request, requestOptions)); + } + + private async __submitEvidence( request: Square.SubmitEvidenceDisputesRequest, requestOptions?: Disputes.RequestOptions, - ): Promise { - const { disputeId } = request; + ): Promise> { + const { dispute_id: disputeId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.SubmitEvidenceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -536,6 +527,7 @@ export class Disputes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -544,6 +536,7 @@ export class Disputes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/disputes/client/index.ts b/src/api/resources/disputes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/disputes/client/index.ts +++ b/src/api/resources/disputes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/disputes/client/requests/AcceptDisputesRequest.ts b/src/api/resources/disputes/client/requests/AcceptDisputesRequest.ts index e7b39024c..fbb5e4c45 100644 --- a/src/api/resources/disputes/client/requests/AcceptDisputesRequest.ts +++ b/src/api/resources/disputes/client/requests/AcceptDisputesRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * } */ export interface AcceptDisputesRequest { /** * The ID of the dispute you want to accept. */ - disputeId: string; + dispute_id: string; } diff --git a/src/api/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts b/src/api/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts index dd6bf19e1..ec3104680 100644 --- a/src/api/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts +++ b/src/api/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts @@ -2,29 +2,29 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * disputeId: "dispute_id", - * idempotencyKey: "ed3ee3933d946f1514d505d173c82648", - * evidenceType: "TRACKING_NUMBER", - * evidenceText: "1Z8888888888888888" + * dispute_id: "dispute_id", + * idempotency_key: "ed3ee3933d946f1514d505d173c82648", + * evidence_type: "TRACKING_NUMBER", + * evidence_text: "1Z8888888888888888" * } */ export interface CreateDisputeEvidenceTextRequest { /** * The ID of the dispute for which you want to upload evidence. */ - disputeId: string; + dispute_id: string; /** A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; + idempotency_key: string; /** * The type of evidence you are uploading. * See [DisputeEvidenceType](#type-disputeevidencetype) for possible values */ - evidenceType?: Square.DisputeEvidenceType; + evidence_type?: Square.DisputeEvidenceType; /** The evidence string. */ - evidenceText: string; + evidence_text: string; } diff --git a/src/api/resources/disputes/client/requests/CreateEvidenceFileDisputesRequest.ts b/src/api/resources/disputes/client/requests/CreateEvidenceFileDisputesRequest.ts index bd5c4e399..c96b14ceb 100644 --- a/src/api/resources/disputes/client/requests/CreateEvidenceFileDisputesRequest.ts +++ b/src/api/resources/disputes/client/requests/CreateEvidenceFileDisputesRequest.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; -import * as fs from "fs"; +import * as Square from "../../../../index.js"; +import * as core from "../../../../../core/index.js"; /** * @example * { - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * } */ export interface CreateEvidenceFileDisputesRequest { /** * The ID of the dispute for which you want to upload evidence. */ - disputeId: string; + dispute_id: string; request?: Square.CreateDisputeEvidenceFileRequest; - imageFile?: File | fs.ReadStream | Blob | undefined; + image_file?: core.FileLike | undefined; } diff --git a/src/api/resources/disputes/client/requests/GetDisputesRequest.ts b/src/api/resources/disputes/client/requests/GetDisputesRequest.ts index 8ce67be68..8e49e6dbd 100644 --- a/src/api/resources/disputes/client/requests/GetDisputesRequest.ts +++ b/src/api/resources/disputes/client/requests/GetDisputesRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * } */ export interface GetDisputesRequest { /** * The ID of the dispute you want more details about. */ - disputeId: string; + dispute_id: string; } diff --git a/src/api/resources/disputes/client/requests/ListDisputesRequest.ts b/src/api/resources/disputes/client/requests/ListDisputesRequest.ts index eb1e6a560..9299b0cab 100644 --- a/src/api/resources/disputes/client/requests/ListDisputesRequest.ts +++ b/src/api/resources/disputes/client/requests/ListDisputesRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -23,5 +23,5 @@ export interface ListDisputesRequest { * 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; + location_id?: string | null; } diff --git a/src/api/resources/disputes/client/requests/SubmitEvidenceDisputesRequest.ts b/src/api/resources/disputes/client/requests/SubmitEvidenceDisputesRequest.ts index 260395581..9900e7531 100644 --- a/src/api/resources/disputes/client/requests/SubmitEvidenceDisputesRequest.ts +++ b/src/api/resources/disputes/client/requests/SubmitEvidenceDisputesRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * } */ export interface SubmitEvidenceDisputesRequest { /** * The ID of the dispute for which you want to submit evidence. */ - disputeId: string; + dispute_id: string; } diff --git a/src/api/resources/disputes/client/requests/index.ts b/src/api/resources/disputes/client/requests/index.ts index 9be21844e..1e359597e 100644 --- a/src/api/resources/disputes/client/requests/index.ts +++ b/src/api/resources/disputes/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type ListDisputesRequest } from "./ListDisputesRequest"; -export { type GetDisputesRequest } from "./GetDisputesRequest"; -export { type AcceptDisputesRequest } from "./AcceptDisputesRequest"; -export { type CreateEvidenceFileDisputesRequest } from "./CreateEvidenceFileDisputesRequest"; -export { type CreateDisputeEvidenceTextRequest } from "./CreateDisputeEvidenceTextRequest"; -export { type SubmitEvidenceDisputesRequest } from "./SubmitEvidenceDisputesRequest"; +export { type ListDisputesRequest } from "./ListDisputesRequest.js"; +export { type GetDisputesRequest } from "./GetDisputesRequest.js"; +export { type AcceptDisputesRequest } from "./AcceptDisputesRequest.js"; +export { type CreateEvidenceFileDisputesRequest } from "./CreateEvidenceFileDisputesRequest.js"; +export { type CreateDisputeEvidenceTextRequest } from "./CreateDisputeEvidenceTextRequest.js"; +export { type SubmitEvidenceDisputesRequest } from "./SubmitEvidenceDisputesRequest.js"; diff --git a/src/api/resources/disputes/index.ts b/src/api/resources/disputes/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/disputes/index.ts +++ b/src/api/resources/disputes/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/disputes/resources/evidence/client/Client.ts b/src/api/resources/disputes/resources/evidence/client/Client.ts index 70b081629..e1d4678a3 100644 --- a/src/api/resources/disputes/resources/evidence/client/Client.ts +++ b/src/api/resources/disputes/resources/evidence/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Evidence { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Evidence { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Evidence { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Evidence { - constructor(protected readonly _options: Evidence.Options = {}) {} + protected readonly _options: Evidence.Options; + + constructor(_options: Evidence.Options = {}) { + this._options = _options; + } /** * Returns a list of evidence associated with a dispute. @@ -45,81 +50,82 @@ export class Evidence { * * @example * await client.disputes.evidence.list({ - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * }) */ public async list( request: Square.disputes.ListEvidenceRequest, requestOptions?: Evidence.RequestOptions, ): Promise> { - const list = async ( - request: Square.disputes.ListEvidenceRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.disputes.ListEvidenceRequest, + ): Promise> => { + const { dispute_id: disputeId, cursor } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListDisputeEvidenceResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.evidence ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -137,54 +143,51 @@ export class Evidence { * * @example * await client.disputes.evidence.get({ - * disputeId: "dispute_id", - * evidenceId: "evidence_id" + * dispute_id: "dispute_id", + * evidence_id: "evidence_id" * }) */ - public async get( + public get( + request: Square.disputes.GetEvidenceRequest, + requestOptions?: Evidence.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.disputes.GetEvidenceRequest, requestOptions?: Evidence.RequestOptions, - ): Promise { - const { disputeId, evidenceId } = request; + ): Promise> { + const { dispute_id: disputeId, evidence_id: evidenceId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetDisputeEvidenceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -193,6 +196,7 @@ export class Evidence { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -201,6 +205,7 @@ export class Evidence { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -214,54 +219,51 @@ export class Evidence { * * @example * await client.disputes.evidence.delete({ - * disputeId: "dispute_id", - * evidenceId: "evidence_id" + * dispute_id: "dispute_id", + * evidence_id: "evidence_id" * }) */ - public async delete( + public delete( request: Square.disputes.DeleteEvidenceRequest, requestOptions?: Evidence.RequestOptions, - ): Promise { - const { disputeId, evidenceId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.disputes.DeleteEvidenceRequest, + requestOptions?: Evidence.RequestOptions, + ): Promise> { + const { dispute_id: disputeId, evidence_id: evidenceId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteDisputeEvidenceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -270,6 +272,7 @@ export class Evidence { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -278,6 +281,7 @@ export class Evidence { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/disputes/resources/evidence/client/index.ts b/src/api/resources/disputes/resources/evidence/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/disputes/resources/evidence/client/index.ts +++ b/src/api/resources/disputes/resources/evidence/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/disputes/resources/evidence/client/requests/DeleteEvidenceRequest.ts b/src/api/resources/disputes/resources/evidence/client/requests/DeleteEvidenceRequest.ts index 0695d4de6..3ddaf9546 100644 --- a/src/api/resources/disputes/resources/evidence/client/requests/DeleteEvidenceRequest.ts +++ b/src/api/resources/disputes/resources/evidence/client/requests/DeleteEvidenceRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * disputeId: "dispute_id", - * evidenceId: "evidence_id" + * dispute_id: "dispute_id", + * evidence_id: "evidence_id" * } */ export interface DeleteEvidenceRequest { /** * The ID of the dispute from which you want to remove evidence. */ - disputeId: string; + dispute_id: string; /** * The ID of the evidence you want to remove. */ - evidenceId: string; + evidence_id: string; } diff --git a/src/api/resources/disputes/resources/evidence/client/requests/GetEvidenceRequest.ts b/src/api/resources/disputes/resources/evidence/client/requests/GetEvidenceRequest.ts index 9272744c7..844d79f3b 100644 --- a/src/api/resources/disputes/resources/evidence/client/requests/GetEvidenceRequest.ts +++ b/src/api/resources/disputes/resources/evidence/client/requests/GetEvidenceRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * disputeId: "dispute_id", - * evidenceId: "evidence_id" + * dispute_id: "dispute_id", + * evidence_id: "evidence_id" * } */ export interface GetEvidenceRequest { /** * The ID of the dispute from which you want to retrieve evidence metadata. */ - disputeId: string; + dispute_id: string; /** * The ID of the evidence to retrieve. */ - evidenceId: string; + evidence_id: string; } diff --git a/src/api/resources/disputes/resources/evidence/client/requests/ListEvidenceRequest.ts b/src/api/resources/disputes/resources/evidence/client/requests/ListEvidenceRequest.ts index 2a603aa53..81a165f0f 100644 --- a/src/api/resources/disputes/resources/evidence/client/requests/ListEvidenceRequest.ts +++ b/src/api/resources/disputes/resources/evidence/client/requests/ListEvidenceRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * disputeId: "dispute_id" + * dispute_id: "dispute_id" * } */ export interface ListEvidenceRequest { /** * The ID of the dispute. */ - disputeId: string; + dispute_id: 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. diff --git a/src/api/resources/disputes/resources/evidence/client/requests/index.ts b/src/api/resources/disputes/resources/evidence/client/requests/index.ts index 854770a17..b95e5d57c 100644 --- a/src/api/resources/disputes/resources/evidence/client/requests/index.ts +++ b/src/api/resources/disputes/resources/evidence/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type ListEvidenceRequest } from "./ListEvidenceRequest"; -export { type GetEvidenceRequest } from "./GetEvidenceRequest"; -export { type DeleteEvidenceRequest } from "./DeleteEvidenceRequest"; +export { type ListEvidenceRequest } from "./ListEvidenceRequest.js"; +export { type GetEvidenceRequest } from "./GetEvidenceRequest.js"; +export { type DeleteEvidenceRequest } from "./DeleteEvidenceRequest.js"; diff --git a/src/api/resources/disputes/resources/evidence/index.ts b/src/api/resources/disputes/resources/evidence/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/disputes/resources/evidence/index.ts +++ b/src/api/resources/disputes/resources/evidence/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/disputes/resources/index.ts b/src/api/resources/disputes/resources/index.ts index bbb817c3d..b1c257f42 100644 --- a/src/api/resources/disputes/resources/index.ts +++ b/src/api/resources/disputes/resources/index.ts @@ -1,2 +1,2 @@ -export * as evidence from "./evidence"; -export * from "./evidence/client/requests"; +export * as evidence from "./evidence/index.js"; +export * from "./evidence/client/requests/index.js"; diff --git a/src/api/resources/employees/client/Client.ts b/src/api/resources/employees/client/Client.ts index 9cc5f9f99..360ef6fd1 100644 --- a/src/api/resources/employees/client/Client.ts +++ b/src/api/resources/employees/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Employees { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Employees { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Employees { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Employees { - constructor(protected readonly _options: Employees.Options = {}) {} + protected readonly _options: Employees.Options; + + constructor(_options: Employees.Options = {}) { + this._options = _options; + } /** * @@ -50,82 +55,79 @@ export class Employees { request: Square.ListEmployeesRequest = {}, requestOptions?: Employees.RequestOptions, ): Promise> { - const list = async (request: Square.ListEmployeesRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListEmployeesRequest, + ): Promise> => { + const { location_id: locationId, status, limit, cursor } = request; + const _queryParams: Record = {}; + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (status !== undefined) { + _queryParams["status"] = status; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/employees", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListEmployeesResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/employees."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.employees ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -144,50 +146,47 @@ export class Employees { * id: "id" * }) */ - public async get( + public get( + request: Square.GetEmployeesRequest, + requestOptions?: Employees.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetEmployeesRequest, requestOptions?: Employees.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetEmployeeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -196,12 +195,14 @@ export class Employees { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/employees/{id}."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/employees/client/index.ts b/src/api/resources/employees/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/employees/client/index.ts +++ b/src/api/resources/employees/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/employees/client/requests/ListEmployeesRequest.ts b/src/api/resources/employees/client/requests/ListEmployeesRequest.ts index 78453e229..4ab759b11 100644 --- a/src/api/resources/employees/client/requests/ListEmployeesRequest.ts +++ b/src/api/resources/employees/client/requests/ListEmployeesRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -12,7 +12,7 @@ export interface ListEmployeesRequest { /** * */ - locationId?: string | null; + location_id?: string | null; /** * Specifies the EmployeeStatus to filter the employee by. */ diff --git a/src/api/resources/employees/client/requests/index.ts b/src/api/resources/employees/client/requests/index.ts index 9557dae81..0601a27df 100644 --- a/src/api/resources/employees/client/requests/index.ts +++ b/src/api/resources/employees/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListEmployeesRequest } from "./ListEmployeesRequest"; -export { type GetEmployeesRequest } from "./GetEmployeesRequest"; +export { type ListEmployeesRequest } from "./ListEmployeesRequest.js"; +export { type GetEmployeesRequest } from "./GetEmployeesRequest.js"; diff --git a/src/api/resources/employees/index.ts b/src/api/resources/employees/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/employees/index.ts +++ b/src/api/resources/employees/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts index a62c6252b..1285ec147 100644 --- a/src/api/resources/events/client/Client.ts +++ b/src/api/resources/events/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Events { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Events { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Events { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Events { - constructor(protected readonly _options: Events.Options = {}) {} + protected readonly _options: Events.Options; + + constructor(_options: Events.Options = {}) { + this._options = _options; + } /** * Search for Square API events that occur within a 28-day timeframe. @@ -46,53 +51,49 @@ export class Events { * @example * await client.events.searchEvents() */ - public async searchEvents( + public searchEvents( + request: Square.SearchEventsRequest = {}, + requestOptions?: Events.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchEvents(request, requestOptions)); + } + + private async __searchEvents( request: Square.SearchEventsRequest = {}, requestOptions?: Events.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchEventsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchEventsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -101,12 +102,14 @@ export class Events { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/events."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -121,46 +124,44 @@ export class Events { * @example * await client.events.disableEvents() */ - public async disableEvents(requestOptions?: Events.RequestOptions): Promise { + public disableEvents( + requestOptions?: Events.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__disableEvents(requestOptions)); + } + + private async __disableEvents( + requestOptions?: Events.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DisableEventsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -169,12 +170,14 @@ export class Events { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/events/disable."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -187,46 +190,42 @@ export class Events { * @example * await client.events.enableEvents() */ - public async enableEvents(requestOptions?: Events.RequestOptions): Promise { + public enableEvents(requestOptions?: Events.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__enableEvents(requestOptions)); + } + + private async __enableEvents( + requestOptions?: Events.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.EnableEventsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -235,12 +234,14 @@ export class Events { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/events/enable."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -254,56 +255,53 @@ export class Events { * @example * await client.events.listEventTypes() */ - public async listEventTypes( + public listEventTypes( request: Square.ListEventTypesRequest = {}, requestOptions?: Events.RequestOptions, - ): Promise { - const { apiVersion } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listEventTypes(request, requestOptions)); + } + + private async __listEventTypes( + request: Square.ListEventTypesRequest = {}, + requestOptions?: Events.RequestOptions, + ): Promise> { + const { api_version: apiVersion } = request; const _queryParams: Record = {}; if (apiVersion !== undefined) { _queryParams["api_version"] = apiVersion; } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.ListEventTypesResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -312,12 +310,14 @@ export class Events { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/events/types."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/events/client/index.ts b/src/api/resources/events/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/events/client/index.ts +++ b/src/api/resources/events/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/events/client/requests/ListEventTypesRequest.ts b/src/api/resources/events/client/requests/ListEventTypesRequest.ts index 58176164e..e9757197b 100644 --- a/src/api/resources/events/client/requests/ListEventTypesRequest.ts +++ b/src/api/resources/events/client/requests/ListEventTypesRequest.ts @@ -10,5 +10,5 @@ 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; + api_version?: string | null; } diff --git a/src/api/resources/events/client/requests/SearchEventsRequest.ts b/src/api/resources/events/client/requests/SearchEventsRequest.ts index e63d21d15..2dc1ddeb6 100644 --- a/src/api/resources/events/client/requests/SearchEventsRequest.ts +++ b/src/api/resources/events/client/requests/SearchEventsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example diff --git a/src/api/resources/events/client/requests/index.ts b/src/api/resources/events/client/requests/index.ts index d6a20d449..e8e1be5af 100644 --- a/src/api/resources/events/client/requests/index.ts +++ b/src/api/resources/events/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type SearchEventsRequest } from "./SearchEventsRequest"; -export { type ListEventTypesRequest } from "./ListEventTypesRequest"; +export { type SearchEventsRequest } from "./SearchEventsRequest.js"; +export { type ListEventTypesRequest } from "./ListEventTypesRequest.js"; diff --git a/src/api/resources/events/index.ts b/src/api/resources/events/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/events/index.ts +++ b/src/api/resources/events/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/giftCards/client/Client.ts b/src/api/resources/giftCards/client/Client.ts index 952a2ca1f..d5fbbff5c 100644 --- a/src/api/resources/giftCards/client/Client.ts +++ b/src/api/resources/giftCards/client/Client.ts @@ -2,13 +2,12 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { Activities } from "../resources/activities/client/Client.js"; export declare namespace GiftCards { export interface Options { @@ -18,6 +17,8 @@ export declare namespace GiftCards { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -31,14 +32,17 @@ export declare namespace GiftCards { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class GiftCards { + protected readonly _options: GiftCards.Options; protected _activities: Activities | undefined; - constructor(protected readonly _options: GiftCards.Options = {}) {} + constructor(_options: GiftCards.Options = {}) { + this._options = _options; + } public get activities(): Activities { return (this._activities ??= new Activities(this._options)); @@ -58,83 +62,83 @@ export class GiftCards { request: Square.ListGiftCardsRequest = {}, requestOptions?: GiftCards.RequestOptions, ): Promise> { - const list = async (request: Square.ListGiftCardsRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListGiftCardsRequest, + ): Promise> => { + const { type: type_, state, limit, cursor, customer_id: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListGiftCardsResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/gift-cards."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.giftCards ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.gift_cards ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -153,60 +157,56 @@ export class GiftCards { * * @example * await client.giftCards.create({ - * idempotencyKey: "NC9Tm69EjbjtConu", - * locationId: "81FN9BNFZTKS4", - * giftCard: { + * idempotency_key: "NC9Tm69EjbjtConu", + * location_id: "81FN9BNFZTKS4", + * gift_card: { * type: "DIGITAL" * } * }) */ - public async create( + public create( request: Square.CreateGiftCardRequest, requestOptions?: GiftCards.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.CreateGiftCardRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateGiftCardRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateGiftCardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -215,12 +215,14 @@ export class GiftCards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/gift-cards."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -236,53 +238,49 @@ export class GiftCards { * gan: "7783320001001635" * }) */ - public async getFromGan( + public getFromGan( + request: Square.GetGiftCardFromGanRequest, + requestOptions?: GiftCards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getFromGan(request, requestOptions)); + } + + private async __getFromGan( request: Square.GetGiftCardFromGanRequest, requestOptions?: GiftCards.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.GetGiftCardFromGanRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.GetGiftCardFromGanResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -291,12 +289,14 @@ export class GiftCards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -312,53 +312,49 @@ export class GiftCards { * nonce: "cnon:7783322135245171" * }) */ - public async getFromNonce( + public getFromNonce( request: Square.GetGiftCardFromNonceRequest, requestOptions?: GiftCards.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getFromNonce(request, requestOptions)); + } + + private async __getFromNonce( + request: Square.GetGiftCardFromNonceRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.GetGiftCardFromNonceRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.GetGiftCardFromNonceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -367,12 +363,14 @@ export class GiftCards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -385,58 +383,57 @@ export class GiftCards { * * @example * await client.giftCards.linkCustomer({ - * giftCardId: "gift_card_id", - * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * gift_card_id: "gift_card_id", + * customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW" * }) */ - public async linkCustomer( + public linkCustomer( + request: Square.LinkCustomerToGiftCardRequest, + requestOptions?: GiftCards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__linkCustomer(request, requestOptions)); + } + + private async __linkCustomer( request: Square.LinkCustomerToGiftCardRequest, requestOptions?: GiftCards.RequestOptions, - ): Promise { - const { giftCardId, ..._body } = request; + ): Promise> { + const { gift_card_id: giftCardId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.LinkCustomerToGiftCardRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.LinkCustomerToGiftCardResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -445,6 +442,7 @@ export class GiftCards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -453,6 +451,7 @@ export class GiftCards { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -465,58 +464,57 @@ export class GiftCards { * * @example * await client.giftCards.unlinkCustomer({ - * giftCardId: "gift_card_id", - * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * gift_card_id: "gift_card_id", + * customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW" * }) */ - public async unlinkCustomer( + public unlinkCustomer( + request: Square.UnlinkCustomerFromGiftCardRequest, + requestOptions?: GiftCards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__unlinkCustomer(request, requestOptions)); + } + + private async __unlinkCustomer( request: Square.UnlinkCustomerFromGiftCardRequest, requestOptions?: GiftCards.RequestOptions, - ): Promise { - const { giftCardId, ..._body } = request; + ): Promise> { + const { gift_card_id: giftCardId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UnlinkCustomerFromGiftCardRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UnlinkCustomerFromGiftCardResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -525,6 +523,7 @@ export class GiftCards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -533,6 +532,7 @@ export class GiftCards { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -548,50 +548,47 @@ export class GiftCards { * id: "id" * }) */ - public async get( + public get( + request: Square.GetGiftCardsRequest, + requestOptions?: GiftCards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetGiftCardsRequest, requestOptions?: GiftCards.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetGiftCardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -600,12 +597,14 @@ export class GiftCards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/giftCards/client/index.ts b/src/api/resources/giftCards/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/giftCards/client/index.ts +++ b/src/api/resources/giftCards/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/giftCards/client/requests/CreateGiftCardRequest.ts b/src/api/resources/giftCards/client/requests/CreateGiftCardRequest.ts index a31b388cc..277754c82 100644 --- a/src/api/resources/giftCards/client/requests/CreateGiftCardRequest.ts +++ b/src/api/resources/giftCards/client/requests/CreateGiftCardRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "NC9Tm69EjbjtConu", - * locationId: "81FN9BNFZTKS4", - * giftCard: { + * idempotency_key: "NC9Tm69EjbjtConu", + * location_id: "81FN9BNFZTKS4", + * gift_card: { * type: "DIGITAL" * } * } @@ -19,12 +19,12 @@ 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; + idempotency_key: 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; + location_id: string; /** * The gift card to create. The `type` field is required for this request. The `gan_source` * and `gan` fields are included as follows: @@ -43,5 +43,5 @@ export interface CreateGiftCardRequest { * 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; + gift_card: Square.GiftCard; } diff --git a/src/api/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts b/src/api/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts index 65406b42f..09d6f5a43 100644 --- a/src/api/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts +++ b/src/api/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts @@ -5,15 +5,15 @@ /** * @example * { - * giftCardId: "gift_card_id", - * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * gift_card_id: "gift_card_id", + * customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW" * } */ export interface LinkCustomerToGiftCardRequest { /** * The ID of the gift card to be linked. */ - giftCardId: string; + gift_card_id: string; /** The ID of the customer to link to the gift card. */ - customerId: string; + customer_id: string; } diff --git a/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts b/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts index 2a4b28c88..3ce9099f1 100644 --- a/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts +++ b/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts @@ -33,5 +33,5 @@ export interface ListGiftCardsRequest { /** * If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer. */ - customerId?: string | null; + customer_id?: string | null; } diff --git a/src/api/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts b/src/api/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts index b4c49c798..79c6a28a0 100644 --- a/src/api/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts +++ b/src/api/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts @@ -5,15 +5,15 @@ /** * @example * { - * giftCardId: "gift_card_id", - * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * gift_card_id: "gift_card_id", + * customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW" * } */ export interface UnlinkCustomerFromGiftCardRequest { /** * The ID of the gift card to be unlinked. */ - giftCardId: string; + gift_card_id: string; /** The ID of the customer to unlink from the gift card. */ - customerId: string; + customer_id: string; } diff --git a/src/api/resources/giftCards/client/requests/index.ts b/src/api/resources/giftCards/client/requests/index.ts index 0b6147fc9..6c1b8c832 100644 --- a/src/api/resources/giftCards/client/requests/index.ts +++ b/src/api/resources/giftCards/client/requests/index.ts @@ -1,7 +1,7 @@ -export { type ListGiftCardsRequest } from "./ListGiftCardsRequest"; -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 GetGiftCardsRequest } from "./GetGiftCardsRequest"; +export { type ListGiftCardsRequest } from "./ListGiftCardsRequest.js"; +export { type CreateGiftCardRequest } from "./CreateGiftCardRequest.js"; +export { type GetGiftCardFromGanRequest } from "./GetGiftCardFromGanRequest.js"; +export { type GetGiftCardFromNonceRequest } from "./GetGiftCardFromNonceRequest.js"; +export { type LinkCustomerToGiftCardRequest } from "./LinkCustomerToGiftCardRequest.js"; +export { type UnlinkCustomerFromGiftCardRequest } from "./UnlinkCustomerFromGiftCardRequest.js"; +export { type GetGiftCardsRequest } from "./GetGiftCardsRequest.js"; diff --git a/src/api/resources/giftCards/index.ts b/src/api/resources/giftCards/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/giftCards/index.ts +++ b/src/api/resources/giftCards/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/giftCards/resources/activities/client/Client.ts b/src/api/resources/giftCards/resources/activities/client/Client.ts index e098fb549..bcfe324b5 100644 --- a/src/api/resources/giftCards/resources/activities/client/Client.ts +++ b/src/api/resources/giftCards/resources/activities/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Activities { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Activities { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Activities { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Activities { - constructor(protected readonly _options: Activities.Options = {}) {} + protected readonly _options: Activities.Options; + + constructor(_options: Activities.Options = {}) { + this._options = _options; + } /** * Lists gift card activities. By default, you get gift card activities for all @@ -53,94 +58,106 @@ export class Activities { request: Square.giftCards.ListActivitiesRequest = {}, requestOptions?: Activities.RequestOptions, ): Promise> { - const list = async ( - request: Square.giftCards.ListActivitiesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.giftCards.ListActivitiesRequest, + ): Promise> => { + const { + gift_card_id: giftCardId, + type: type_, + location_id: locationId, + begin_time: beginTime, + end_time: endTime, + limit, + cursor, + sort_order: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards/activities", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListGiftCardActivitiesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.giftCardActivities ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.gift_card_activities ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -156,65 +173,64 @@ export class Activities { * * @example * await client.giftCards.activities.create({ - * idempotencyKey: "U16kfr-kA70er-q4Rsym-7U7NnY", - * giftCardActivity: { + * idempotency_key: "U16kfr-kA70er-q4Rsym-7U7NnY", + * gift_card_activity: { * type: "ACTIVATE", - * locationId: "81FN9BNFZTKS4", - * giftCardId: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", - * activateActivityDetails: { - * orderId: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", - * lineItemUid: "eIWl7X0nMuO9Ewbh0ChIx" + * location_id: "81FN9BNFZTKS4", + * gift_card_id: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + * activate_activity_details: { + * order_id: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + * line_item_uid: "eIWl7X0nMuO9Ewbh0ChIx" * } * } * }) */ - public async create( + public create( + request: Square.giftCards.CreateGiftCardActivityRequest, + requestOptions?: Activities.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.giftCards.CreateGiftCardActivityRequest, requestOptions?: Activities.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.giftCards.CreateGiftCardActivityRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateGiftCardActivityResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -223,12 +239,14 @@ export class Activities { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/giftCards/resources/activities/client/index.ts b/src/api/resources/giftCards/resources/activities/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/giftCards/resources/activities/client/index.ts +++ b/src/api/resources/giftCards/resources/activities/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts b/src/api/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts index dba2fc080..d07d7ee2a 100644 --- a/src/api/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts +++ b/src/api/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts @@ -2,29 +2,29 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "U16kfr-kA70er-q4Rsym-7U7NnY", - * giftCardActivity: { + * idempotency_key: "U16kfr-kA70er-q4Rsym-7U7NnY", + * gift_card_activity: { * type: "ACTIVATE", - * locationId: "81FN9BNFZTKS4", - * giftCardId: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", - * activateActivityDetails: { - * orderId: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", - * lineItemUid: "eIWl7X0nMuO9Ewbh0ChIx" + * location_id: "81FN9BNFZTKS4", + * gift_card_id: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + * activate_activity_details: { + * order_id: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + * line_item_uid: "eIWl7X0nMuO9Ewbh0ChIx" * } * } * } */ export interface CreateGiftCardActivityRequest { /** A unique string that identifies the `CreateGiftCardActivity` request. */ - idempotencyKey: string; + idempotency_key: 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; + gift_card_activity: Square.GiftCardActivity; } diff --git a/src/api/resources/giftCards/resources/activities/client/requests/ListActivitiesRequest.ts b/src/api/resources/giftCards/resources/activities/client/requests/ListActivitiesRequest.ts index ef91964a1..08c099deb 100644 --- a/src/api/resources/giftCards/resources/activities/client/requests/ListActivitiesRequest.ts +++ b/src/api/resources/giftCards/resources/activities/client/requests/ListActivitiesRequest.ts @@ -12,7 +12,7 @@ export interface ListActivitiesRequest { * to the specified gift card. Otherwise, the endpoint returns all gift card activities for * the seller. */ - giftCardId?: string | null; + gift_card_id?: 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. @@ -22,17 +22,17 @@ export interface ListActivitiesRequest { * 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; + location_id?: 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; + begin_time?: 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; + end_time?: 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. @@ -51,5 +51,5 @@ export interface ListActivitiesRequest { * - `ASC` - Oldest to newest. * - `DESC` - Newest to oldest (default). */ - sortOrder?: string | null; + sort_order?: string | null; } diff --git a/src/api/resources/giftCards/resources/activities/client/requests/index.ts b/src/api/resources/giftCards/resources/activities/client/requests/index.ts index 9c2bd6210..33d7dfa9e 100644 --- a/src/api/resources/giftCards/resources/activities/client/requests/index.ts +++ b/src/api/resources/giftCards/resources/activities/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListActivitiesRequest } from "./ListActivitiesRequest"; -export { type CreateGiftCardActivityRequest } from "./CreateGiftCardActivityRequest"; +export { type ListActivitiesRequest } from "./ListActivitiesRequest.js"; +export { type CreateGiftCardActivityRequest } from "./CreateGiftCardActivityRequest.js"; diff --git a/src/api/resources/giftCards/resources/activities/index.ts b/src/api/resources/giftCards/resources/activities/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/giftCards/resources/activities/index.ts +++ b/src/api/resources/giftCards/resources/activities/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/giftCards/resources/index.ts b/src/api/resources/giftCards/resources/index.ts index b1095905e..37c0129de 100644 --- a/src/api/resources/giftCards/resources/index.ts +++ b/src/api/resources/giftCards/resources/index.ts @@ -1,2 +1,2 @@ -export * as activities from "./activities"; -export * from "./activities/client/requests"; +export * as activities from "./activities/index.js"; +export * from "./activities/client/requests/index.js"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 23678d5af..4d042ec41 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,65 +1,65 @@ -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 labor from "./labor"; -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 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 "./labor/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"; +export * as mobile from "./mobile/index.js"; +export * as oAuth from "./oAuth/index.js"; +export * as v1Transactions from "./v1Transactions/index.js"; +export * as applePay from "./applePay/index.js"; +export * as bankAccounts from "./bankAccounts/index.js"; +export * as bookings from "./bookings/index.js"; +export * as cards from "./cards/index.js"; +export * as catalog from "./catalog/index.js"; +export * as customers from "./customers/index.js"; +export * as devices from "./devices/index.js"; +export * as disputes from "./disputes/index.js"; +export * as employees from "./employees/index.js"; +export * as events from "./events/index.js"; +export * as giftCards from "./giftCards/index.js"; +export * as inventory from "./inventory/index.js"; +export * as invoices from "./invoices/index.js"; +export * as labor from "./labor/index.js"; +export * as locations from "./locations/index.js"; +export * as loyalty from "./loyalty/index.js"; +export * as merchants from "./merchants/index.js"; +export * as checkout from "./checkout/index.js"; +export * as orders from "./orders/index.js"; +export * as payments from "./payments/index.js"; +export * as payouts from "./payouts/index.js"; +export * as refunds from "./refunds/index.js"; +export * as sites from "./sites/index.js"; +export * as snippets from "./snippets/index.js"; +export * as subscriptions from "./subscriptions/index.js"; +export * as teamMembers from "./teamMembers/index.js"; +export * as team from "./team/index.js"; +export * as terminal from "./terminal/index.js"; +export * as vendors from "./vendors/index.js"; +export * as cashDrawers from "./cashDrawers/index.js"; +export * as webhooks from "./webhooks/index.js"; +export * from "./mobile/client/requests/index.js"; +export * from "./oAuth/client/requests/index.js"; +export * from "./v1Transactions/client/requests/index.js"; +export * from "./applePay/client/requests/index.js"; +export * from "./bankAccounts/client/requests/index.js"; +export * from "./bookings/client/requests/index.js"; +export * from "./cards/client/requests/index.js"; +export * from "./catalog/client/requests/index.js"; +export * from "./customers/client/requests/index.js"; +export * from "./devices/client/requests/index.js"; +export * from "./disputes/client/requests/index.js"; +export * from "./employees/client/requests/index.js"; +export * from "./events/client/requests/index.js"; +export * from "./giftCards/client/requests/index.js"; +export * from "./inventory/client/requests/index.js"; +export * from "./invoices/client/requests/index.js"; +export * from "./labor/client/requests/index.js"; +export * from "./locations/client/requests/index.js"; +export * from "./loyalty/client/requests/index.js"; +export * from "./merchants/client/requests/index.js"; +export * from "./checkout/client/requests/index.js"; +export * from "./orders/client/requests/index.js"; +export * from "./payments/client/requests/index.js"; +export * from "./payouts/client/requests/index.js"; +export * from "./refunds/client/requests/index.js"; +export * from "./snippets/client/requests/index.js"; +export * from "./subscriptions/client/requests/index.js"; +export * from "./teamMembers/client/requests/index.js"; +export * from "./team/client/requests/index.js"; +export * from "./terminal/client/requests/index.js"; +export * from "./vendors/client/requests/index.js"; diff --git a/src/api/resources/inventory/client/Client.ts b/src/api/resources/inventory/client/Client.ts index 7bc9c02c8..bf47f05c3 100644 --- a/src/api/resources/inventory/client/Client.ts +++ b/src/api/resources/inventory/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Inventory { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Inventory { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Inventory { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Inventory { - constructor(protected readonly _options: Inventory.Options = {}) {} + protected readonly _options: Inventory.Options; + + constructor(_options: Inventory.Options = {}) { + this._options = _options; + } /** * Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL @@ -46,53 +51,53 @@ export class Inventory { * * @example * await client.inventory.deprecatedGetAdjustment({ - * adjustmentId: "adjustment_id" + * adjustment_id: "adjustment_id" * }) */ - public async deprecatedGetAdjustment( + public deprecatedGetAdjustment( + request: Square.DeprecatedGetAdjustmentInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deprecatedGetAdjustment(request, requestOptions)); + } + + private async __deprecatedGetAdjustment( request: Square.DeprecatedGetAdjustmentInventoryRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { - const { adjustmentId } = request; + ): Promise> { + const { adjustment_id: adjustmentId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetInventoryAdjustmentResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -101,6 +106,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -109,6 +115,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -122,53 +129,53 @@ export class Inventory { * * @example * await client.inventory.getAdjustment({ - * adjustmentId: "adjustment_id" + * adjustment_id: "adjustment_id" * }) */ - public async getAdjustment( + public getAdjustment( + request: Square.GetAdjustmentInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getAdjustment(request, requestOptions)); + } + + private async __getAdjustment( request: Square.GetAdjustmentInventoryRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { - const { adjustmentId } = request; + ): Promise> { + const { adjustment_id: adjustmentId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetInventoryAdjustmentResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -177,6 +184,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -185,6 +193,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -198,69 +207,65 @@ export class Inventory { * * @example * await client.inventory.deprecatedBatchChange({ - * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", * changes: [{ * type: "PHYSICAL_COUNT", - * physicalCount: { - * referenceId: "1536bfbf-efed-48bf-b17d-a197141b2a92", - * catalogObjectId: "W62UWFY35CWMYGVWK6TWJDNI", + * physical_count: { + * reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + * catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", * state: "IN_STOCK", - * locationId: "C6W5YS5QM06F5", + * location_id: "C6W5YS5QM06F5", * quantity: "53", - * teamMemberId: "LRK57NSQ5X7PUD05", - * occurredAt: "2016-11-16T22:25:24.878Z" + * team_member_id: "LRK57NSQ5X7PUD05", + * occurred_at: "2016-11-16T22:25:24.878Z" * } * }], - * ignoreUnchangedCounts: true + * ignore_unchanged_counts: true * }) */ - public async deprecatedBatchChange( + public deprecatedBatchChange( request: Square.BatchChangeInventoryRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deprecatedBatchChange(request, requestOptions)); + } + + private async __deprecatedBatchChange( + request: Square.BatchChangeInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchChangeInventoryRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BatchChangeInventoryResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -269,12 +274,14 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -288,61 +295,60 @@ export class Inventory { * * @example * await client.inventory.deprecatedBatchGetChanges({ - * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - * locationIds: ["C6W5YS5QM06F5"], + * catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + * location_ids: ["C6W5YS5QM06F5"], * types: ["PHYSICAL_COUNT"], * states: ["IN_STOCK"], - * updatedAfter: "2016-11-01T00:00:00.000Z", - * updatedBefore: "2016-12-01T00:00:00.000Z" + * updated_after: "2016-11-01T00:00:00.000Z", + * updated_before: "2016-12-01T00:00:00.000Z" * }) */ - public async deprecatedBatchGetChanges( + public deprecatedBatchGetChanges( + request: Square.BatchRetrieveInventoryChangesRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deprecatedBatchGetChanges(request, requestOptions)); + } + + private async __deprecatedBatchGetChanges( request: Square.BatchRetrieveInventoryChangesRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchRetrieveInventoryChangesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchGetInventoryChangesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -351,6 +357,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -359,6 +366,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -372,58 +380,57 @@ export class Inventory { * * @example * await client.inventory.deprecatedBatchGetCounts({ - * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - * locationIds: ["59TNP9SA8VGDA"], - * updatedAfter: "2016-11-16T00:00:00.000Z" + * catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + * location_ids: ["59TNP9SA8VGDA"], + * updated_after: "2016-11-16T00:00:00.000Z" * }) */ - public async deprecatedBatchGetCounts( + public deprecatedBatchGetCounts( + request: Square.BatchGetInventoryCountsRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deprecatedBatchGetCounts(request, requestOptions)); + } + + private async __deprecatedBatchGetCounts( request: Square.BatchGetInventoryCountsRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchGetInventoryCountsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchGetInventoryCountsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -432,6 +439,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -440,6 +448,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -456,69 +465,65 @@ export class Inventory { * * @example * await client.inventory.batchCreateChanges({ - * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", * changes: [{ * type: "PHYSICAL_COUNT", - * physicalCount: { - * referenceId: "1536bfbf-efed-48bf-b17d-a197141b2a92", - * catalogObjectId: "W62UWFY35CWMYGVWK6TWJDNI", + * physical_count: { + * reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + * catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", * state: "IN_STOCK", - * locationId: "C6W5YS5QM06F5", + * location_id: "C6W5YS5QM06F5", * quantity: "53", - * teamMemberId: "LRK57NSQ5X7PUD05", - * occurredAt: "2016-11-16T22:25:24.878Z" + * team_member_id: "LRK57NSQ5X7PUD05", + * occurred_at: "2016-11-16T22:25:24.878Z" * } * }], - * ignoreUnchangedCounts: true + * ignore_unchanged_counts: true * }) */ - public async batchCreateChanges( + public batchCreateChanges( + request: Square.BatchChangeInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchCreateChanges(request, requestOptions)); + } + + private async __batchCreateChanges( request: Square.BatchChangeInventoryRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchChangeInventoryRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BatchChangeInventoryResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -527,6 +532,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -535,6 +541,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -554,84 +561,84 @@ export class Inventory { * * @example * await client.inventory.batchGetChanges({ - * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - * locationIds: ["C6W5YS5QM06F5"], + * catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + * location_ids: ["C6W5YS5QM06F5"], * types: ["PHYSICAL_COUNT"], * states: ["IN_STOCK"], - * updatedAfter: "2016-11-01T00:00:00.000Z", - * updatedBefore: "2016-12-01T00:00:00.000Z" + * updated_after: "2016-11-01T00:00:00.000Z", + * updated_before: "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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.BatchRetrieveInventoryChangesRequest, + ): Promise> => { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.BatchGetInventoryChangesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.changes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -657,81 +664,81 @@ export class Inventory { * * @example * await client.inventory.batchGetCounts({ - * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - * locationIds: ["59TNP9SA8VGDA"], - * updatedAfter: "2016-11-16T00:00:00.000Z" + * catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + * location_ids: ["59TNP9SA8VGDA"], + * updated_after: "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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.BatchGetInventoryCountsRequest, + ): Promise> => { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.BatchGetInventoryCountsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.counts ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -748,53 +755,53 @@ export class Inventory { * * @example * await client.inventory.deprecatedGetPhysicalCount({ - * physicalCountId: "physical_count_id" + * physical_count_id: "physical_count_id" * }) */ - public async deprecatedGetPhysicalCount( + public deprecatedGetPhysicalCount( + request: Square.DeprecatedGetPhysicalCountInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deprecatedGetPhysicalCount(request, requestOptions)); + } + + private async __deprecatedGetPhysicalCount( request: Square.DeprecatedGetPhysicalCountInventoryRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { - const { physicalCountId } = request; + ): Promise> { + const { physical_count_id: physicalCountId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetInventoryPhysicalCountResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -803,6 +810,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -811,6 +819,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -824,53 +833,53 @@ export class Inventory { * * @example * await client.inventory.getPhysicalCount({ - * physicalCountId: "physical_count_id" + * physical_count_id: "physical_count_id" * }) */ - public async getPhysicalCount( + public getPhysicalCount( + request: Square.GetPhysicalCountInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getPhysicalCount(request, requestOptions)); + } + + private async __getPhysicalCount( request: Square.GetPhysicalCountInventoryRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { - const { physicalCountId } = request; + ): Promise> { + const { physical_count_id: physicalCountId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetInventoryPhysicalCountResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -879,6 +888,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -887,6 +897,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -900,53 +911,50 @@ export class Inventory { * * @example * await client.inventory.getTransfer({ - * transferId: "transfer_id" + * transfer_id: "transfer_id" * }) */ - public async getTransfer( + public getTransfer( + request: Square.GetTransferInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getTransfer(request, requestOptions)); + } + + private async __getTransfer( request: Square.GetTransferInventoryRequest, requestOptions?: Inventory.RequestOptions, - ): Promise { - const { transferId } = request; + ): Promise> { + const { transfer_id: transferId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetInventoryTransferResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -955,6 +963,7 @@ export class Inventory { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -963,6 +972,7 @@ export class Inventory { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -978,82 +988,85 @@ export class Inventory { * * @example * await client.inventory.get({ - * catalogObjectId: "catalog_object_id" + * catalog_object_id: "catalog_object_id" * }) */ public async get( request: Square.GetInventoryRequest, requestOptions?: Inventory.RequestOptions, ): Promise> { - const list = async (request: Square.GetInventoryRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.GetInventoryRequest, + ): Promise> => { + const { catalog_object_id: catalogObjectId, location_ids: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/${encodeURIComponent(catalogObjectId)}`, + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.GetInventoryCountResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.counts ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -1081,82 +1094,85 @@ export class Inventory { * * @example * await client.inventory.changes({ - * catalogObjectId: "catalog_object_id" + * catalog_object_id: "catalog_object_id" * }) */ public async changes( request: Square.ChangesInventoryRequest, requestOptions?: Inventory.RequestOptions, ): Promise> { - const list = async (request: Square.ChangesInventoryRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ChangesInventoryRequest, + ): Promise> => { + const { catalog_object_id: catalogObjectId, location_ids: 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.GetInventoryChangesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.changes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); diff --git a/src/api/resources/inventory/client/index.ts b/src/api/resources/inventory/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/inventory/client/index.ts +++ b/src/api/resources/inventory/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts b/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts index 0ecaff2d6..92b04a221 100644 --- a/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts @@ -5,19 +5,19 @@ /** * @example * { - * catalogObjectId: "catalog_object_id" + * catalog_object_id: "catalog_object_id" * } */ export interface ChangesInventoryRequest { /** * ID of the [CatalogObject](entity:CatalogObject) to retrieve. */ - catalogObjectId: string; + catalog_object_id: string; /** * The [Location](entity:Location) IDs to look up as a comma-separated * list. An empty list queries all locations. */ - locationIds?: string | null; + location_ids?: 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. diff --git a/src/api/resources/inventory/client/requests/DeprecatedGetAdjustmentInventoryRequest.ts b/src/api/resources/inventory/client/requests/DeprecatedGetAdjustmentInventoryRequest.ts index c9473a53c..c31677df1 100644 --- a/src/api/resources/inventory/client/requests/DeprecatedGetAdjustmentInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/DeprecatedGetAdjustmentInventoryRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * adjustmentId: "adjustment_id" + * adjustment_id: "adjustment_id" * } */ export interface DeprecatedGetAdjustmentInventoryRequest { /** * ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. */ - adjustmentId: string; + adjustment_id: string; } diff --git a/src/api/resources/inventory/client/requests/DeprecatedGetPhysicalCountInventoryRequest.ts b/src/api/resources/inventory/client/requests/DeprecatedGetPhysicalCountInventoryRequest.ts index d9de48c2a..5da8d88fe 100644 --- a/src/api/resources/inventory/client/requests/DeprecatedGetPhysicalCountInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/DeprecatedGetPhysicalCountInventoryRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * physicalCountId: "physical_count_id" + * physical_count_id: "physical_count_id" * } */ export interface DeprecatedGetPhysicalCountInventoryRequest { @@ -13,5 +13,5 @@ export interface DeprecatedGetPhysicalCountInventoryRequest { * ID of the * [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. */ - physicalCountId: string; + physical_count_id: string; } diff --git a/src/api/resources/inventory/client/requests/GetAdjustmentInventoryRequest.ts b/src/api/resources/inventory/client/requests/GetAdjustmentInventoryRequest.ts index c65aa9ca8..c39a32223 100644 --- a/src/api/resources/inventory/client/requests/GetAdjustmentInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/GetAdjustmentInventoryRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * adjustmentId: "adjustment_id" + * adjustment_id: "adjustment_id" * } */ export interface GetAdjustmentInventoryRequest { /** * ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. */ - adjustmentId: string; + adjustment_id: string; } diff --git a/src/api/resources/inventory/client/requests/GetInventoryRequest.ts b/src/api/resources/inventory/client/requests/GetInventoryRequest.ts index 7d4dab332..26e9e626e 100644 --- a/src/api/resources/inventory/client/requests/GetInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/GetInventoryRequest.ts @@ -5,19 +5,19 @@ /** * @example * { - * catalogObjectId: "catalog_object_id" + * catalog_object_id: "catalog_object_id" * } */ export interface GetInventoryRequest { /** * ID of the [CatalogObject](entity:CatalogObject) to retrieve. */ - catalogObjectId: string; + catalog_object_id: string; /** * The [Location](entity:Location) IDs to look up as a comma-separated * list. An empty list queries all locations. */ - locationIds?: string | null; + location_ids?: 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. diff --git a/src/api/resources/inventory/client/requests/GetPhysicalCountInventoryRequest.ts b/src/api/resources/inventory/client/requests/GetPhysicalCountInventoryRequest.ts index cfc96a4c6..a45656280 100644 --- a/src/api/resources/inventory/client/requests/GetPhysicalCountInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/GetPhysicalCountInventoryRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * physicalCountId: "physical_count_id" + * physical_count_id: "physical_count_id" * } */ export interface GetPhysicalCountInventoryRequest { @@ -13,5 +13,5 @@ export interface GetPhysicalCountInventoryRequest { * ID of the * [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. */ - physicalCountId: string; + physical_count_id: string; } diff --git a/src/api/resources/inventory/client/requests/GetTransferInventoryRequest.ts b/src/api/resources/inventory/client/requests/GetTransferInventoryRequest.ts index c09664a30..c71b8b12c 100644 --- a/src/api/resources/inventory/client/requests/GetTransferInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/GetTransferInventoryRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * transferId: "transfer_id" + * transfer_id: "transfer_id" * } */ export interface GetTransferInventoryRequest { /** * ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve. */ - transferId: string; + transfer_id: string; } diff --git a/src/api/resources/inventory/client/requests/index.ts b/src/api/resources/inventory/client/requests/index.ts index b1ea5cc1f..946a87080 100644 --- a/src/api/resources/inventory/client/requests/index.ts +++ b/src/api/resources/inventory/client/requests/index.ts @@ -1,7 +1,7 @@ -export { type DeprecatedGetAdjustmentInventoryRequest } from "./DeprecatedGetAdjustmentInventoryRequest"; -export { type GetAdjustmentInventoryRequest } from "./GetAdjustmentInventoryRequest"; -export { type DeprecatedGetPhysicalCountInventoryRequest } from "./DeprecatedGetPhysicalCountInventoryRequest"; -export { type GetPhysicalCountInventoryRequest } from "./GetPhysicalCountInventoryRequest"; -export { type GetTransferInventoryRequest } from "./GetTransferInventoryRequest"; -export { type GetInventoryRequest } from "./GetInventoryRequest"; -export { type ChangesInventoryRequest } from "./ChangesInventoryRequest"; +export { type DeprecatedGetAdjustmentInventoryRequest } from "./DeprecatedGetAdjustmentInventoryRequest.js"; +export { type GetAdjustmentInventoryRequest } from "./GetAdjustmentInventoryRequest.js"; +export { type DeprecatedGetPhysicalCountInventoryRequest } from "./DeprecatedGetPhysicalCountInventoryRequest.js"; +export { type GetPhysicalCountInventoryRequest } from "./GetPhysicalCountInventoryRequest.js"; +export { type GetTransferInventoryRequest } from "./GetTransferInventoryRequest.js"; +export { type GetInventoryRequest } from "./GetInventoryRequest.js"; +export { type ChangesInventoryRequest } from "./ChangesInventoryRequest.js"; diff --git a/src/api/resources/inventory/index.ts b/src/api/resources/inventory/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/inventory/index.ts +++ b/src/api/resources/inventory/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/invoices/client/Client.ts b/src/api/resources/invoices/client/Client.ts index 0e2531820..6cb6678f0 100644 --- a/src/api/resources/invoices/client/Client.ts +++ b/src/api/resources/invoices/client/Client.ts @@ -2,13 +2,12 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { toJson } from "../../../../core/json.js"; export declare namespace Invoices { export interface Options { @@ -18,6 +17,8 @@ export declare namespace Invoices { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -31,12 +32,16 @@ export declare namespace Invoices { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Invoices { - constructor(protected readonly _options: Invoices.Options = {}) {} + protected readonly _options: Invoices.Options; + + constructor(_options: Invoices.Options = {}) { + this._options = _options; + } /** * Returns a list of invoices for a given location. The response @@ -48,81 +53,79 @@ export class Invoices { * * @example * await client.invoices.list({ - * locationId: "location_id" + * location_id: "location_id" * }) */ public async list( request: Square.ListInvoicesRequest, requestOptions?: Invoices.RequestOptions, ): Promise> { - const list = async (request: Square.ListInvoicesRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListInvoicesRequest): Promise> => { + const { location_id: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/invoices", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListInvoicesResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/invoices."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.invoices ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -143,34 +146,34 @@ export class Invoices { * @example * await client.invoices.create({ * invoice: { - * locationId: "ES0RJRZYEC39A", - * orderId: "CAISENgvlJ6jLWAzERDzjyHVybY", - * primaryRecipient: { - * customerId: "JDKYHBWT1D4F8MFH63DBMEN8Y4" + * location_id: "ES0RJRZYEC39A", + * order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + * primary_recipient: { + * customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4" * }, - * paymentRequests: [{ - * requestType: "BALANCE", - * dueDate: "2030-01-24", - * tippingEnabled: true, - * automaticPaymentSource: "NONE", + * payment_requests: [{ + * request_type: "BALANCE", + * due_date: "2030-01-24", + * tipping_enabled: true, + * automatic_payment_source: "NONE", * reminders: [{ - * relativeScheduledDays: -1, + * relative_scheduled_days: -1, * message: "Your invoice is due tomorrow" * }] * }], - * deliveryMethod: "EMAIL", - * invoiceNumber: "inv-100", + * delivery_method: "EMAIL", + * invoice_number: "inv-100", * title: "Event Planning Services", * description: "We appreciate your business!", - * scheduledAt: "2030-01-13T10:00:00Z", - * acceptedPaymentMethods: { + * scheduled_at: "2030-01-13T10:00:00Z", + * accepted_payment_methods: { * card: true, - * squareGiftCard: false, - * bankAccount: false, - * buyNowPayLater: false, - * cashAppPay: false + * square_gift_card: false, + * bank_account: false, + * buy_now_pay_later: false, + * cash_app_pay: false * }, - * customFields: [{ + * custom_fields: [{ * label: "Event Reference Number", * value: "Ref. #1234", * placement: "ABOVE_LINE_ITEMS" @@ -179,59 +182,55 @@ export class Invoices { * value: "The terms of service are...", * placement: "BELOW_LINE_ITEMS" * }], - * saleOrServiceDate: "2030-01-24", - * storePaymentMethodEnabled: false + * sale_or_service_date: "2030-01-24", + * store_payment_method_enabled: false * }, - * idempotencyKey: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4" + * idempotency_key: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4" * }) */ - public async create( + public create( + request: Square.CreateInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.CreateInvoiceRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateInvoiceRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateInvoiceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -240,12 +239,14 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/invoices."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -266,8 +267,8 @@ export class Invoices { * await client.invoices.search({ * query: { * filter: { - * locationIds: ["ES0RJRZYEC39A"], - * customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * location_ids: ["ES0RJRZYEC39A"], + * customer_ids: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"] * }, * sort: { * field: "INVOICE_SORT_DATE", @@ -277,53 +278,49 @@ export class Invoices { * limit: 100 * }) */ - public async search( + public search( + request: Square.SearchInvoicesRequest, + requestOptions?: Invoices.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( request: Square.SearchInvoicesRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchInvoicesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchInvoicesResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -332,12 +329,14 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/invoices/search."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -350,53 +349,50 @@ export class Invoices { * * @example * await client.invoices.get({ - * invoiceId: "invoice_id" + * invoice_id: "invoice_id" * }) */ - public async get( + public get( request: Square.GetInvoicesRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { - const { invoiceId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetInvoicesRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise> { + const { invoice_id: invoiceId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetInvoiceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -405,12 +401,14 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -426,65 +424,61 @@ export class Invoices { * * @example * await client.invoices.update({ - * invoiceId: "invoice_id", + * invoice_id: "invoice_id", * invoice: { * version: 1, - * paymentRequests: [{ + * payment_requests: [{ * uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", - * tippingEnabled: false + * tipping_enabled: false * }] * }, - * idempotencyKey: "4ee82288-0910-499e-ab4c-5d0071dad1be" + * idempotency_key: "4ee82288-0910-499e-ab4c-5d0071dad1be" * }) */ - public async update( + public update( request: Square.UpdateInvoiceRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { - const { invoiceId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.UpdateInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise> { + const { invoice_id: invoiceId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateInvoiceRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateInvoiceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -493,12 +487,14 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -513,59 +509,56 @@ export class Invoices { * * @example * await client.invoices.delete({ - * invoiceId: "invoice_id" + * invoice_id: "invoice_id" * }) */ - public async delete( + public delete( request: Square.DeleteInvoicesRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { - const { invoiceId, version } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.DeleteInvoicesRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise> { + const { invoice_id: invoiceId, version } = request; const _queryParams: Record = {}; if (version !== undefined) { _queryParams["version"] = version?.toString() ?? null; } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteInvoiceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -574,12 +567,14 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -599,51 +594,47 @@ export class Invoices { * * @example * await client.invoices.createInvoiceAttachment({ - * invoiceId: "invoice_id" + * invoice_id: "invoice_id" * }) */ - public async createInvoiceAttachment( + public createInvoiceAttachment( + request: Square.CreateInvoiceAttachmentRequest, + requestOptions?: Invoices.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createInvoiceAttachment(request, requestOptions)); + } + + private async __createInvoiceAttachment( request: Square.CreateInvoiceAttachmentRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { + ): Promise> { const _request = await core.newFormData(); if (request.request != null) { - _request.append( - "request", - toJson( - serializers.CreateInvoiceAttachmentRequestData.jsonOrThrow(request.request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - ), - ); + _request.append("request", toJson(request.request)); } - if (request.imageFile != null) { - await _request.appendFile("image_file", request.imageFile); + if (request.image_file != null) { + await _request.appendFile("image_file", request.image_file); } const _maybeEncodedRequest = await _request.getRequest(); const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, - `v2/invoices/${encodeURIComponent(request.invoiceId)}/attachments`, + `v2/invoices/${encodeURIComponent(request.invoice_id)}/attachments`, ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ..._maybeEncodedRequest.headers, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + ..._maybeEncodedRequest.headers, + }), + requestOptions?.headers, + ), requestType: "file", duplex: _maybeEncodedRequest.duplex, body: _maybeEncodedRequest.body, @@ -652,19 +643,17 @@ export class Invoices { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateInvoiceAttachmentResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Square.CreateInvoiceAttachmentResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -673,6 +662,7 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -681,6 +671,7 @@ export class Invoices { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -694,54 +685,54 @@ export class Invoices { * * @example * await client.invoices.deleteInvoiceAttachment({ - * invoiceId: "invoice_id", - * attachmentId: "attachment_id" + * invoice_id: "invoice_id", + * attachment_id: "attachment_id" * }) */ - public async deleteInvoiceAttachment( + public deleteInvoiceAttachment( + request: Square.DeleteInvoiceAttachmentRequest, + requestOptions?: Invoices.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteInvoiceAttachment(request, requestOptions)); + } + + private async __deleteInvoiceAttachment( request: Square.DeleteInvoiceAttachmentRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { - const { invoiceId, attachmentId } = request; + ): Promise> { + const { invoice_id: invoiceId, attachment_id: attachmentId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteInvoiceAttachmentResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -750,6 +741,7 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -758,6 +750,7 @@ export class Invoices { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -773,58 +766,54 @@ export class Invoices { * * @example * await client.invoices.cancel({ - * invoiceId: "invoice_id", + * invoice_id: "invoice_id", * version: 0 * }) */ - public async cancel( + public cancel( request: Square.CancelInvoiceRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { - const { invoiceId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( + request: Square.CancelInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise> { + const { invoice_id: invoiceId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CancelInvoiceRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.CancelInvoiceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -833,6 +822,7 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -841,6 +831,7 @@ export class Invoices { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -866,59 +857,55 @@ export class Invoices { * * @example * await client.invoices.publish({ - * invoiceId: "invoice_id", + * invoice_id: "invoice_id", * version: 1, - * idempotencyKey: "32da42d0-1997-41b0-826b-f09464fc2c2e" + * idempotency_key: "32da42d0-1997-41b0-826b-f09464fc2c2e" * }) */ - public async publish( + public publish( request: Square.PublishInvoiceRequest, requestOptions?: Invoices.RequestOptions, - ): Promise { - const { invoiceId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__publish(request, requestOptions)); + } + + private async __publish( + request: Square.PublishInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise> { + const { invoice_id: invoiceId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.PublishInvoiceRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.PublishInvoiceResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -927,6 +914,7 @@ export class Invoices { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -935,6 +923,7 @@ export class Invoices { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/invoices/client/index.ts b/src/api/resources/invoices/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/invoices/client/index.ts +++ b/src/api/resources/invoices/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/invoices/client/requests/CancelInvoiceRequest.ts b/src/api/resources/invoices/client/requests/CancelInvoiceRequest.ts index 57766ffa7..ee2abb0dd 100644 --- a/src/api/resources/invoices/client/requests/CancelInvoiceRequest.ts +++ b/src/api/resources/invoices/client/requests/CancelInvoiceRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * invoiceId: "invoice_id", + * invoice_id: "invoice_id", * version: 0 * } */ @@ -13,7 +13,7 @@ export interface CancelInvoiceRequest { /** * The ID of the [invoice](entity:Invoice) to cancel. */ - invoiceId: string; + invoice_id: string; /** * The version of the [invoice](entity:Invoice) to cancel. * If you do not know the version, you can call diff --git a/src/api/resources/invoices/client/requests/CreateInvoiceAttachmentRequest.ts b/src/api/resources/invoices/client/requests/CreateInvoiceAttachmentRequest.ts index da5fcfc6f..ac6c972b2 100644 --- a/src/api/resources/invoices/client/requests/CreateInvoiceAttachmentRequest.ts +++ b/src/api/resources/invoices/client/requests/CreateInvoiceAttachmentRequest.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; -import * as fs from "fs"; +import * as Square from "../../../../index.js"; +import * as core from "../../../../../core/index.js"; /** * @example * { - * invoiceId: "invoice_id" + * invoice_id: "invoice_id" * } */ export interface CreateInvoiceAttachmentRequest { /** * The ID of the [invoice](entity:Invoice) to attach the file to. */ - invoiceId: string; + invoice_id: string; request?: Square.CreateInvoiceAttachmentRequestData; - imageFile?: File | fs.ReadStream | Blob | undefined; + image_file?: core.FileLike | undefined; } diff --git a/src/api/resources/invoices/client/requests/CreateInvoiceRequest.ts b/src/api/resources/invoices/client/requests/CreateInvoiceRequest.ts index 32296308a..7946d6599 100644 --- a/src/api/resources/invoices/client/requests/CreateInvoiceRequest.ts +++ b/src/api/resources/invoices/client/requests/CreateInvoiceRequest.ts @@ -2,40 +2,40 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * invoice: { - * locationId: "ES0RJRZYEC39A", - * orderId: "CAISENgvlJ6jLWAzERDzjyHVybY", - * primaryRecipient: { - * customerId: "JDKYHBWT1D4F8MFH63DBMEN8Y4" + * location_id: "ES0RJRZYEC39A", + * order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + * primary_recipient: { + * customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4" * }, - * paymentRequests: [{ - * requestType: "BALANCE", - * dueDate: "2030-01-24", - * tippingEnabled: true, - * automaticPaymentSource: "NONE", + * payment_requests: [{ + * request_type: "BALANCE", + * due_date: "2030-01-24", + * tipping_enabled: true, + * automatic_payment_source: "NONE", * reminders: [{ - * relativeScheduledDays: -1, + * relative_scheduled_days: -1, * message: "Your invoice is due tomorrow" * }] * }], - * deliveryMethod: "EMAIL", - * invoiceNumber: "inv-100", + * delivery_method: "EMAIL", + * invoice_number: "inv-100", * title: "Event Planning Services", * description: "We appreciate your business!", - * scheduledAt: "2030-01-13T10:00:00Z", - * acceptedPaymentMethods: { + * scheduled_at: "2030-01-13T10:00:00Z", + * accepted_payment_methods: { * card: true, - * squareGiftCard: false, - * bankAccount: false, - * buyNowPayLater: false, - * cashAppPay: false + * square_gift_card: false, + * bank_account: false, + * buy_now_pay_later: false, + * cash_app_pay: false * }, - * customFields: [{ + * custom_fields: [{ * label: "Event Reference Number", * value: "Ref. #1234", * placement: "ABOVE_LINE_ITEMS" @@ -44,10 +44,10 @@ import * as Square from "../../../../index"; * value: "The terms of service are...", * placement: "BELOW_LINE_ITEMS" * }], - * saleOrServiceDate: "2030-01-24", - * storePaymentMethodEnabled: false + * sale_or_service_date: "2030-01-24", + * store_payment_method_enabled: false * }, - * idempotencyKey: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4" + * idempotency_key: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4" * } */ export interface CreateInvoiceRequest { @@ -60,5 +60,5 @@ export interface CreateInvoiceRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string; + idempotency_key?: string; } diff --git a/src/api/resources/invoices/client/requests/DeleteInvoiceAttachmentRequest.ts b/src/api/resources/invoices/client/requests/DeleteInvoiceAttachmentRequest.ts index 56926b013..7a147cce3 100644 --- a/src/api/resources/invoices/client/requests/DeleteInvoiceAttachmentRequest.ts +++ b/src/api/resources/invoices/client/requests/DeleteInvoiceAttachmentRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * invoiceId: "invoice_id", - * attachmentId: "attachment_id" + * invoice_id: "invoice_id", + * attachment_id: "attachment_id" * } */ export interface DeleteInvoiceAttachmentRequest { /** * The ID of the [invoice](entity:Invoice) to delete the attachment from. */ - invoiceId: string; + invoice_id: string; /** * The ID of the [attachment](entity:InvoiceAttachment) to delete. */ - attachmentId: string; + attachment_id: string; } diff --git a/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts b/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts index 2cf9546a6..fd0b38feb 100644 --- a/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts +++ b/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * invoiceId: "invoice_id" + * invoice_id: "invoice_id" * } */ export interface DeleteInvoicesRequest { /** * The ID of the invoice to delete. */ - invoiceId: string; + invoice_id: 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 diff --git a/src/api/resources/invoices/client/requests/GetInvoicesRequest.ts b/src/api/resources/invoices/client/requests/GetInvoicesRequest.ts index 8f288b53f..9708016f0 100644 --- a/src/api/resources/invoices/client/requests/GetInvoicesRequest.ts +++ b/src/api/resources/invoices/client/requests/GetInvoicesRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * invoiceId: "invoice_id" + * invoice_id: "invoice_id" * } */ export interface GetInvoicesRequest { /** * The ID of the invoice to retrieve. */ - invoiceId: string; + invoice_id: string; } diff --git a/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts b/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts index d38f8f30a..ce001e4dc 100644 --- a/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts +++ b/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface ListInvoicesRequest { /** * The ID of the location for which to list invoices. */ - locationId: string; + location_id: 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. diff --git a/src/api/resources/invoices/client/requests/PublishInvoiceRequest.ts b/src/api/resources/invoices/client/requests/PublishInvoiceRequest.ts index d6c52757a..1dfe19a85 100644 --- a/src/api/resources/invoices/client/requests/PublishInvoiceRequest.ts +++ b/src/api/resources/invoices/client/requests/PublishInvoiceRequest.ts @@ -5,16 +5,16 @@ /** * @example * { - * invoiceId: "invoice_id", + * invoice_id: "invoice_id", * version: 1, - * idempotencyKey: "32da42d0-1997-41b0-826b-f09464fc2c2e" + * idempotency_key: "32da42d0-1997-41b0-826b-f09464fc2c2e" * } */ export interface PublishInvoiceRequest { /** * The ID of the invoice to publish. */ - invoiceId: string; + invoice_id: string; /** * The version of the [invoice](entity:Invoice) to publish. * This must match the current version of the invoice; otherwise, the request is rejected. @@ -27,5 +27,5 @@ export interface PublishInvoiceRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string | null; + idempotency_key?: string | null; } diff --git a/src/api/resources/invoices/client/requests/SearchInvoicesRequest.ts b/src/api/resources/invoices/client/requests/SearchInvoicesRequest.ts index a33ce5a75..a35d30870 100644 --- a/src/api/resources/invoices/client/requests/SearchInvoicesRequest.ts +++ b/src/api/resources/invoices/client/requests/SearchInvoicesRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * query: { * filter: { - * locationIds: ["ES0RJRZYEC39A"], - * customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * location_ids: ["ES0RJRZYEC39A"], + * customer_ids: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"] * }, * sort: { * field: "INVOICE_SORT_DATE", diff --git a/src/api/resources/invoices/client/requests/UpdateInvoiceRequest.ts b/src/api/resources/invoices/client/requests/UpdateInvoiceRequest.ts index a84529af0..9818df39d 100644 --- a/src/api/resources/invoices/client/requests/UpdateInvoiceRequest.ts +++ b/src/api/resources/invoices/client/requests/UpdateInvoiceRequest.ts @@ -2,27 +2,27 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * invoiceId: "invoice_id", + * invoice_id: "invoice_id", * invoice: { * version: 1, - * paymentRequests: [{ + * payment_requests: [{ * uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", - * tippingEnabled: false + * tipping_enabled: false * }] * }, - * idempotencyKey: "4ee82288-0910-499e-ab4c-5d0071dad1be" + * idempotency_key: "4ee82288-0910-499e-ab4c-5d0071dad1be" * } */ export interface UpdateInvoiceRequest { /** * The ID of the invoice to update. */ - invoiceId: string; + invoice_id: 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). @@ -37,11 +37,11 @@ export interface UpdateInvoiceRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string | null; + idempotency_key?: 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; + fields_to_clear?: string[] | null; } diff --git a/src/api/resources/invoices/client/requests/index.ts b/src/api/resources/invoices/client/requests/index.ts index d6b0b4452..df699af64 100644 --- a/src/api/resources/invoices/client/requests/index.ts +++ b/src/api/resources/invoices/client/requests/index.ts @@ -1,10 +1,10 @@ -export { type ListInvoicesRequest } from "./ListInvoicesRequest"; -export { type CreateInvoiceRequest } from "./CreateInvoiceRequest"; -export { type SearchInvoicesRequest } from "./SearchInvoicesRequest"; -export { type GetInvoicesRequest } from "./GetInvoicesRequest"; -export { type UpdateInvoiceRequest } from "./UpdateInvoiceRequest"; -export { type DeleteInvoicesRequest } from "./DeleteInvoicesRequest"; -export { type CreateInvoiceAttachmentRequest } from "./CreateInvoiceAttachmentRequest"; -export { type DeleteInvoiceAttachmentRequest } from "./DeleteInvoiceAttachmentRequest"; -export { type CancelInvoiceRequest } from "./CancelInvoiceRequest"; -export { type PublishInvoiceRequest } from "./PublishInvoiceRequest"; +export { type ListInvoicesRequest } from "./ListInvoicesRequest.js"; +export { type CreateInvoiceRequest } from "./CreateInvoiceRequest.js"; +export { type SearchInvoicesRequest } from "./SearchInvoicesRequest.js"; +export { type GetInvoicesRequest } from "./GetInvoicesRequest.js"; +export { type UpdateInvoiceRequest } from "./UpdateInvoiceRequest.js"; +export { type DeleteInvoicesRequest } from "./DeleteInvoicesRequest.js"; +export { type CreateInvoiceAttachmentRequest } from "./CreateInvoiceAttachmentRequest.js"; +export { type DeleteInvoiceAttachmentRequest } from "./DeleteInvoiceAttachmentRequest.js"; +export { type CancelInvoiceRequest } from "./CancelInvoiceRequest.js"; +export { type PublishInvoiceRequest } from "./PublishInvoiceRequest.js"; diff --git a/src/api/resources/invoices/index.ts b/src/api/resources/invoices/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/invoices/index.ts +++ b/src/api/resources/invoices/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/labor/client/Client.ts b/src/api/resources/labor/client/Client.ts index 231c4c58e..8bb3c0116 100644 --- a/src/api/resources/labor/client/Client.ts +++ b/src/api/resources/labor/client/Client.ts @@ -2,17 +2,16 @@ * 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 { 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { BreakTypes } from "../resources/breakTypes/client/Client.js"; +import { EmployeeWages } from "../resources/employeeWages/client/Client.js"; +import { Shifts } from "../resources/shifts/client/Client.js"; +import { TeamMemberWages } from "../resources/teamMemberWages/client/Client.js"; +import { WorkweekConfigs } from "../resources/workweekConfigs/client/Client.js"; export declare namespace Labor { export interface Options { @@ -22,6 +21,8 @@ export declare namespace Labor { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -35,18 +36,21 @@ export declare namespace Labor { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Labor { + protected readonly _options: Labor.Options; 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 = {}) {} + constructor(_options: Labor.Options = {}) { + this._options = _options; + } public get breakTypes(): BreakTypes { return (this._breakTypes ??= new BreakTypes(this._options)); @@ -83,67 +87,63 @@ export class Labor { * * @example * await client.labor.createScheduledShift({ - * idempotencyKey: "HIDSNG5KS478L", - * scheduledShift: { - * draftShiftDetails: { - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * locationId: "PAA1RJZZKXBFG", - * jobId: "FzbJAtt9qEWncK1BWgVCxQ6M", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * idempotency_key: "HIDSNG5KS478L", + * scheduled_shift: { + * draft_shift_details: { + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * location_id: "PAA1RJZZKXBFG", + * job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * notes: "Dont forget to prep the vegetables", - * isDeleted: false + * is_deleted: false * } * } * }) */ - public async createScheduledShift( + public createScheduledShift( + request: Square.CreateScheduledShiftRequest, + requestOptions?: Labor.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createScheduledShift(request, requestOptions)); + } + + private async __createScheduledShift( request: Square.CreateScheduledShiftRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, "v2/labor/scheduled-shifts", ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateScheduledShiftRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateScheduledShiftResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.CreateScheduledShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -152,12 +152,14 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/labor/scheduled-shifts."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -175,59 +177,58 @@ export class Labor { * * @example * await client.labor.bulkPublishScheduledShifts({ - * scheduledShifts: { + * scheduled_shifts: { * "key": {} * }, - * scheduledShiftNotificationAudience: "AFFECTED" + * scheduled_shift_notification_audience: "AFFECTED" * }) */ - public async bulkPublishScheduledShifts( + public bulkPublishScheduledShifts( request: Square.BulkPublishScheduledShiftsRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__bulkPublishScheduledShifts(request, requestOptions)); + } + + private async __bulkPublishScheduledShifts( + request: Square.BulkPublishScheduledShiftsRequest, + requestOptions?: Labor.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, "v2/labor/scheduled-shifts/bulk-publish", ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkPublishScheduledShiftsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.BulkPublishScheduledShiftsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Square.BulkPublishScheduledShiftsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -236,6 +237,7 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -244,6 +246,7 @@ export class Labor { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -259,7 +262,7 @@ export class Labor { * await client.labor.searchScheduledShifts({ * query: { * filter: { - * assignmentStatus: "ASSIGNED" + * assignment_status: "ASSIGNED" * }, * sort: { * field: "CREATED_AT", @@ -270,53 +273,49 @@ export class Labor { * cursor: "xoxp-1234-5678-90123" * }) */ - public async searchScheduledShifts( + public searchScheduledShifts( request: Square.SearchScheduledShiftsRequest = {}, requestOptions?: Labor.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchScheduledShifts(request, requestOptions)); + } + + private async __searchScheduledShifts( + request: Square.SearchScheduledShiftsRequest = {}, + requestOptions?: Labor.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, "v2/labor/scheduled-shifts/search", ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchScheduledShiftsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.SearchScheduledShiftsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.SearchScheduledShiftsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -325,6 +324,7 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -333,6 +333,7 @@ export class Labor { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -348,50 +349,50 @@ export class Labor { * id: "id" * }) */ - public async retrieveScheduledShift( + public retrieveScheduledShift( request: Square.RetrieveScheduledShiftRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveScheduledShift(request, requestOptions)); + } + + private async __retrieveScheduledShift( + request: Square.RetrieveScheduledShiftRequest, + requestOptions?: Labor.RequestOptions, + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, `v2/labor/scheduled-shifts/${encodeURIComponent(id)}`, ), method: "GET", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.RetrieveScheduledShiftResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { + data: _response.body as Square.RetrieveScheduledShiftResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -400,6 +401,7 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -408,6 +410,7 @@ export class Labor { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -430,68 +433,64 @@ export class Labor { * @example * await client.labor.updateScheduledShift({ * id: "id", - * scheduledShift: { - * draftShiftDetails: { - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * locationId: "PAA1RJZZKXBFG", - * jobId: "FzbJAtt9qEWncK1BWgVCxQ6M", - * startAt: "2019-03-25T03:11:00-05:00", - * endAt: "2019-03-25T13:18:00-05:00", + * scheduled_shift: { + * draft_shift_details: { + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * location_id: "PAA1RJZZKXBFG", + * job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + * start_at: "2019-03-25T03:11:00-05:00", + * end_at: "2019-03-25T13:18:00-05:00", * notes: "Dont forget to prep the vegetables", - * isDeleted: false + * is_deleted: false * }, * version: 1 * } * }) */ - public async updateScheduledShift( + public updateScheduledShift( + request: Square.UpdateScheduledShiftRequest, + requestOptions?: Labor.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateScheduledShift(request, requestOptions)); + } + + private async __updateScheduledShift( request: Square.UpdateScheduledShiftRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): Promise> { const { id, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, `v2/labor/scheduled-shifts/${encodeURIComponent(id)}`, ), method: "PUT", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateScheduledShiftRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.UpdateScheduledShiftResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.UpdateScheduledShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -500,6 +499,7 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -508,6 +508,7 @@ export class Labor { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -522,59 +523,55 @@ export class Labor { * @example * await client.labor.publishScheduledShift({ * id: "id", - * idempotencyKey: "HIDSNG5KS478L", + * idempotency_key: "HIDSNG5KS478L", * version: 2, - * scheduledShiftNotificationAudience: "ALL" + * scheduled_shift_notification_audience: "ALL" * }) */ - public async publishScheduledShift( + public publishScheduledShift( + request: Square.PublishScheduledShiftRequest, + requestOptions?: Labor.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__publishScheduledShift(request, requestOptions)); + } + + private async __publishScheduledShift( request: Square.PublishScheduledShiftRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): Promise> { const { id, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, `v2/labor/scheduled-shifts/${encodeURIComponent(id)}/publish`, ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.PublishScheduledShiftRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.PublishScheduledShiftResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.PublishScheduledShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -583,6 +580,7 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -591,6 +589,7 @@ export class Labor { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -620,82 +619,78 @@ export class Labor { * * @example * await client.labor.createTimecard({ - * idempotencyKey: "HIDSNG5KS478L", + * idempotency_key: "HIDSNG5KS478L", * timecard: { - * locationId: "PAA1RJZZKXBFG", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Barista", - * hourlyRate: { - * amount: 1100, + * hourly_rate: { + * amount: BigInt("1100"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } * }) */ - public async createTimecard( + public createTimecard( request: Square.CreateTimecardRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createTimecard(request, requestOptions)); + } + + private async __createTimecard( + request: Square.CreateTimecardRequest, + requestOptions?: Labor.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, "v2/labor/timecards", ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateTimecardRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateTimecardResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.CreateTimecardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -704,12 +699,14 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/labor/timecards."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -738,65 +735,61 @@ export class Labor { * query: { * filter: { * workday: { - * dateRange: { - * startDate: "2019-01-20", - * endDate: "2019-02-03" + * date_range: { + * start_date: "2019-01-20", + * end_date: "2019-02-03" * }, - * matchTimecardsBy: "START_AT", - * defaultTimezone: "America/Los_Angeles" + * match_timecards_by: "START_AT", + * default_timezone: "America/Los_Angeles" * } * } * }, * limit: 100 * }) */ - public async searchTimecards( + public searchTimecards( + request: Square.SearchTimecardsRequest = {}, + requestOptions?: Labor.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchTimecards(request, requestOptions)); + } + + private async __searchTimecards( request: Square.SearchTimecardsRequest = {}, requestOptions?: Labor.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, "v2/labor/timecards/search", ), method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchTimecardsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.SearchTimecardsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.SearchTimecardsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -805,12 +798,14 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/labor/timecards/search."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -826,50 +821,47 @@ export class Labor { * id: "id" * }) */ - public async retrieveTimecard( + public retrieveTimecard( + request: Square.RetrieveTimecardRequest, + requestOptions?: Labor.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveTimecard(request, requestOptions)); + } + + private async __retrieveTimecard( request: Square.RetrieveTimecardRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, `v2/labor/timecards/${encodeURIComponent(id)}`, ), method: "GET", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.RetrieveTimecardResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.RetrieveTimecardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -878,12 +870,14 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/labor/timecards/{id}."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -904,84 +898,80 @@ export class Labor { * await client.labor.updateTimecard({ * id: "id", * timecard: { - * locationId: "PAA1RJZZKXBFG", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Bartender", - * hourlyRate: { - * amount: 1500, + * hourly_rate: { + * amount: BigInt("1500"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ * id: "X7GAQYVVRRG6P", - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], * status: "CLOSED", * version: 1, - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } * }) */ - public async updateTimecard( + public updateTimecard( request: Square.UpdateTimecardRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateTimecard(request, requestOptions)); + } + + private async __updateTimecard( + request: Square.UpdateTimecardRequest, + requestOptions?: Labor.RequestOptions, + ): Promise> { const { id, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, `v2/labor/timecards/${encodeURIComponent(id)}`, ), method: "PUT", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateTimecardRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.UpdateTimecardResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.UpdateTimecardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -990,12 +980,14 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/labor/timecards/{id}."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -1011,50 +1003,47 @@ export class Labor { * id: "id" * }) */ - public async deleteTimecard( + public deleteTimecard( + request: Square.DeleteTimecardRequest, + requestOptions?: Labor.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteTimecard(request, requestOptions)); + } + + private async __deleteTimecard( request: Square.DeleteTimecardRequest, requestOptions?: Labor.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SquareEnvironment.Production, `v2/labor/timecards/${encodeURIComponent(id)}`, ), method: "DELETE", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.DeleteTimecardResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); + return { data: _response.body as Square.DeleteTimecardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -1063,12 +1052,14 @@ export class Labor { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling DELETE /v2/labor/timecards/{id}."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/labor/client/index.ts b/src/api/resources/labor/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/labor/client/index.ts +++ b/src/api/resources/labor/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/labor/client/requests/BulkPublishScheduledShiftsRequest.ts b/src/api/resources/labor/client/requests/BulkPublishScheduledShiftsRequest.ts index a2082ab1d..f2f2e3426 100644 --- a/src/api/resources/labor/client/requests/BulkPublishScheduledShiftsRequest.ts +++ b/src/api/resources/labor/client/requests/BulkPublishScheduledShiftsRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * scheduledShifts: { + * scheduled_shifts: { * "key": {} * }, - * scheduledShiftNotificationAudience: "AFFECTED" + * scheduled_shift_notification_audience: "AFFECTED" * } */ export interface BulkPublishScheduledShiftsRequest { @@ -21,12 +21,12 @@ export interface BulkPublishScheduledShiftsRequest { * - Each value is a `BulkPublishScheduledShiftsData` object that contains the * `version` field or is an empty object. */ - scheduledShifts: Record; + scheduled_shifts: Record; /** * Indicates whether Square should send email notifications to team members and * which team members should receive the notifications. This setting applies to all shifts * specified in the bulk operation. The default value is `AFFECTED`. * See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values */ - scheduledShiftNotificationAudience?: Square.ScheduledShiftNotificationAudience; + scheduled_shift_notification_audience?: Square.ScheduledShiftNotificationAudience; } diff --git a/src/api/resources/labor/client/requests/CreateScheduledShiftRequest.ts b/src/api/resources/labor/client/requests/CreateScheduledShiftRequest.ts index b17585939..14dab2988 100644 --- a/src/api/resources/labor/client/requests/CreateScheduledShiftRequest.ts +++ b/src/api/resources/labor/client/requests/CreateScheduledShiftRequest.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "HIDSNG5KS478L", - * scheduledShift: { - * draftShiftDetails: { - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * locationId: "PAA1RJZZKXBFG", - * jobId: "FzbJAtt9qEWncK1BWgVCxQ6M", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * idempotency_key: "HIDSNG5KS478L", + * scheduled_shift: { + * draft_shift_details: { + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * location_id: "PAA1RJZZKXBFG", + * job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * notes: "Dont forget to prep the vegetables", - * isDeleted: false + * is_deleted: false * } * } * } @@ -27,7 +27,7 @@ export interface CreateScheduledShiftRequest { * [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) * of the operation. */ - idempotencyKey?: string; + idempotency_key?: string; /** * The scheduled shift with `draft_shift_details`. * If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs, @@ -37,5 +37,5 @@ export interface CreateScheduledShiftRequest { * The `start_at` and `end_at` timestamps must be provided in the time zone + offset of the * shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00 */ - scheduledShift: Square.ScheduledShift; + scheduled_shift: Square.ScheduledShift; } diff --git a/src/api/resources/labor/client/requests/CreateTimecardRequest.ts b/src/api/resources/labor/client/requests/CreateTimecardRequest.ts index 27fb8ebbf..c3054012f 100644 --- a/src/api/resources/labor/client/requests/CreateTimecardRequest.ts +++ b/src/api/resources/labor/client/requests/CreateTimecardRequest.ts @@ -2,35 +2,35 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "HIDSNG5KS478L", + * idempotency_key: "HIDSNG5KS478L", * timecard: { - * locationId: "PAA1RJZZKXBFG", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Barista", - * hourlyRate: { - * amount: 1100, + * hourly_rate: { + * amount: BigInt("1100"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } @@ -38,7 +38,7 @@ import * as Square from "../../../../index"; */ export interface CreateTimecardRequest { /** A unique string value to ensure the idempotency of the operation. */ - idempotencyKey?: string; + idempotency_key?: string; /** The `Timecard` to be created. */ timecard: Square.Timecard; } diff --git a/src/api/resources/labor/client/requests/PublishScheduledShiftRequest.ts b/src/api/resources/labor/client/requests/PublishScheduledShiftRequest.ts index 4d3be81fb..95d3d6988 100644 --- a/src/api/resources/labor/client/requests/PublishScheduledShiftRequest.ts +++ b/src/api/resources/labor/client/requests/PublishScheduledShiftRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * id: "id", - * idempotencyKey: "HIDSNG5KS478L", + * idempotency_key: "HIDSNG5KS478L", * version: 2, - * scheduledShiftNotificationAudience: "ALL" + * scheduled_shift_notification_audience: "ALL" * } */ export interface PublishScheduledShiftRequest { @@ -23,7 +23,7 @@ export interface PublishScheduledShiftRequest { * [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) * of the operation. */ - idempotencyKey: string; + idempotency_key: string; /** * The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) * control. If the provided version doesn't match the server version, the request fails. @@ -35,5 +35,5 @@ export interface PublishScheduledShiftRequest { * which team members should receive the notification. The default value is `AFFECTED`. * See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values */ - scheduledShiftNotificationAudience?: Square.ScheduledShiftNotificationAudience; + scheduled_shift_notification_audience?: Square.ScheduledShiftNotificationAudience; } diff --git a/src/api/resources/labor/client/requests/SearchScheduledShiftsRequest.ts b/src/api/resources/labor/client/requests/SearchScheduledShiftsRequest.ts index ff557cd35..9201c054c 100644 --- a/src/api/resources/labor/client/requests/SearchScheduledShiftsRequest.ts +++ b/src/api/resources/labor/client/requests/SearchScheduledShiftsRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * query: { * filter: { - * assignmentStatus: "ASSIGNED" + * assignment_status: "ASSIGNED" * }, * sort: { * field: "CREATED_AT", diff --git a/src/api/resources/labor/client/requests/SearchTimecardsRequest.ts b/src/api/resources/labor/client/requests/SearchTimecardsRequest.ts index 7cb06c2dc..889a58cb0 100644 --- a/src/api/resources/labor/client/requests/SearchTimecardsRequest.ts +++ b/src/api/resources/labor/client/requests/SearchTimecardsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -10,12 +10,12 @@ import * as Square from "../../../../index"; * query: { * filter: { * workday: { - * dateRange: { - * startDate: "2019-01-20", - * endDate: "2019-02-03" + * date_range: { + * start_date: "2019-01-20", + * end_date: "2019-02-03" * }, - * matchTimecardsBy: "START_AT", - * defaultTimezone: "America/Los_Angeles" + * match_timecards_by: "START_AT", + * default_timezone: "America/Los_Angeles" * } * } * }, diff --git a/src/api/resources/labor/client/requests/UpdateScheduledShiftRequest.ts b/src/api/resources/labor/client/requests/UpdateScheduledShiftRequest.ts index 748947023..712a5e831 100644 --- a/src/api/resources/labor/client/requests/UpdateScheduledShiftRequest.ts +++ b/src/api/resources/labor/client/requests/UpdateScheduledShiftRequest.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * id: "id", - * scheduledShift: { - * draftShiftDetails: { - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * locationId: "PAA1RJZZKXBFG", - * jobId: "FzbJAtt9qEWncK1BWgVCxQ6M", - * startAt: "2019-03-25T03:11:00-05:00", - * endAt: "2019-03-25T13:18:00-05:00", + * scheduled_shift: { + * draft_shift_details: { + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * location_id: "PAA1RJZZKXBFG", + * job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + * start_at: "2019-03-25T03:11:00-05:00", + * end_at: "2019-03-25T13:18:00-05:00", * notes: "Dont forget to prep the vegetables", - * isDeleted: false + * is_deleted: false * }, * version: 1 * } @@ -42,5 +42,5 @@ export interface UpdateScheduledShiftRequest { * If the provided version doesn't match the server version, the request fails. If `version` is * omitted, Square executes a blind write, potentially overwriting data from another publish request. */ - scheduledShift: Square.ScheduledShift; + scheduled_shift: Square.ScheduledShift; } diff --git a/src/api/resources/labor/client/requests/UpdateTimecardRequest.ts b/src/api/resources/labor/client/requests/UpdateTimecardRequest.ts index 2dd76467d..bb91c91ce 100644 --- a/src/api/resources/labor/client/requests/UpdateTimecardRequest.ts +++ b/src/api/resources/labor/client/requests/UpdateTimecardRequest.ts @@ -2,38 +2,38 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * id: "id", * timecard: { - * locationId: "PAA1RJZZKXBFG", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Bartender", - * hourlyRate: { - * amount: 1500, + * hourly_rate: { + * amount: BigInt("1500"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ * id: "X7GAQYVVRRG6P", - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], * status: "CLOSED", * version: 1, - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } diff --git a/src/api/resources/labor/client/requests/index.ts b/src/api/resources/labor/client/requests/index.ts index 8b8e6d675..eeed2c07b 100644 --- a/src/api/resources/labor/client/requests/index.ts +++ b/src/api/resources/labor/client/requests/index.ts @@ -1,11 +1,11 @@ -export { type CreateScheduledShiftRequest } from "./CreateScheduledShiftRequest"; -export { type BulkPublishScheduledShiftsRequest } from "./BulkPublishScheduledShiftsRequest"; -export { type SearchScheduledShiftsRequest } from "./SearchScheduledShiftsRequest"; -export { type RetrieveScheduledShiftRequest } from "./RetrieveScheduledShiftRequest"; -export { type UpdateScheduledShiftRequest } from "./UpdateScheduledShiftRequest"; -export { type PublishScheduledShiftRequest } from "./PublishScheduledShiftRequest"; -export { type CreateTimecardRequest } from "./CreateTimecardRequest"; -export { type SearchTimecardsRequest } from "./SearchTimecardsRequest"; -export { type RetrieveTimecardRequest } from "./RetrieveTimecardRequest"; -export { type UpdateTimecardRequest } from "./UpdateTimecardRequest"; -export { type DeleteTimecardRequest } from "./DeleteTimecardRequest"; +export { type CreateScheduledShiftRequest } from "./CreateScheduledShiftRequest.js"; +export { type BulkPublishScheduledShiftsRequest } from "./BulkPublishScheduledShiftsRequest.js"; +export { type SearchScheduledShiftsRequest } from "./SearchScheduledShiftsRequest.js"; +export { type RetrieveScheduledShiftRequest } from "./RetrieveScheduledShiftRequest.js"; +export { type UpdateScheduledShiftRequest } from "./UpdateScheduledShiftRequest.js"; +export { type PublishScheduledShiftRequest } from "./PublishScheduledShiftRequest.js"; +export { type CreateTimecardRequest } from "./CreateTimecardRequest.js"; +export { type SearchTimecardsRequest } from "./SearchTimecardsRequest.js"; +export { type RetrieveTimecardRequest } from "./RetrieveTimecardRequest.js"; +export { type UpdateTimecardRequest } from "./UpdateTimecardRequest.js"; +export { type DeleteTimecardRequest } from "./DeleteTimecardRequest.js"; diff --git a/src/api/resources/labor/index.ts b/src/api/resources/labor/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/labor/index.ts +++ b/src/api/resources/labor/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/labor/resources/breakTypes/client/Client.ts b/src/api/resources/labor/resources/breakTypes/client/Client.ts index a6b51ee7a..6ba5c8788 100644 --- a/src/api/resources/labor/resources/breakTypes/client/Client.ts +++ b/src/api/resources/labor/resources/breakTypes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace BreakTypes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace BreakTypes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace BreakTypes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class BreakTypes { - constructor(protected readonly _options: BreakTypes.Options = {}) {} + protected readonly _options: BreakTypes.Options; + + constructor(_options: BreakTypes.Options = {}) { + this._options = _options; + } /** * Returns a paginated list of `BreakType` instances for a business. @@ -50,77 +55,80 @@ export class BreakTypes { request: Square.labor.ListBreakTypesRequest = {}, requestOptions?: BreakTypes.RequestOptions, ): Promise> { - const list = async (request: Square.labor.ListBreakTypesRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.labor.ListBreakTypesRequest, + ): Promise> => { + const { location_id: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/break-types", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListBreakTypesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.breakTypes ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.break_types ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -148,62 +156,58 @@ export class BreakTypes { * * @example * await client.labor.breakTypes.create({ - * idempotencyKey: "PAD3NG5KSN2GL", - * breakType: { - * locationId: "CGJN03P1D08GF", - * breakName: "Lunch Break", - * expectedDuration: "PT30M", - * isPaid: true + * idempotency_key: "PAD3NG5KSN2GL", + * break_type: { + * location_id: "CGJN03P1D08GF", + * break_name: "Lunch Break", + * expected_duration: "PT30M", + * is_paid: true * } * }) */ - public async create( + public create( request: Square.labor.CreateBreakTypeRequest, requestOptions?: BreakTypes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.labor.CreateBreakTypeRequest, + requestOptions?: BreakTypes.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.labor.CreateBreakTypeRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateBreakTypeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -212,12 +216,14 @@ export class BreakTypes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -233,50 +239,47 @@ export class BreakTypes { * id: "id" * }) */ - public async get( + public get( request: Square.labor.GetBreakTypesRequest, requestOptions?: BreakTypes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.labor.GetBreakTypesRequest, + requestOptions?: BreakTypes.RequestOptions, + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetBreakTypeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -285,12 +288,14 @@ export class BreakTypes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -304,63 +309,59 @@ export class BreakTypes { * @example * await client.labor.breakTypes.update({ * id: "id", - * breakType: { - * locationId: "26M7H24AZ9N6R", - * breakName: "Lunch", - * expectedDuration: "PT50M", - * isPaid: true, + * break_type: { + * location_id: "26M7H24AZ9N6R", + * break_name: "Lunch", + * expected_duration: "PT50M", + * is_paid: true, * version: 1 * } * }) */ - public async update( + public update( + request: Square.labor.UpdateBreakTypeRequest, + requestOptions?: BreakTypes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.labor.UpdateBreakTypeRequest, requestOptions?: BreakTypes.RequestOptions, - ): Promise { + ): Promise> { const { id, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.labor.UpdateBreakTypeRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateBreakTypeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -369,12 +370,14 @@ export class BreakTypes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -392,50 +395,47 @@ export class BreakTypes { * id: "id" * }) */ - public async delete( + public delete( + request: Square.labor.DeleteBreakTypesRequest, + requestOptions?: BreakTypes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.labor.DeleteBreakTypesRequest, requestOptions?: BreakTypes.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteBreakTypeResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -444,12 +444,14 @@ export class BreakTypes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/labor/resources/breakTypes/client/index.ts b/src/api/resources/labor/resources/breakTypes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/labor/resources/breakTypes/client/index.ts +++ b/src/api/resources/labor/resources/breakTypes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts index f79298188..b95b81748 100644 --- a/src/api/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts +++ b/src/api/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "PAD3NG5KSN2GL", - * breakType: { - * locationId: "CGJN03P1D08GF", - * breakName: "Lunch Break", - * expectedDuration: "PT30M", - * isPaid: true + * idempotency_key: "PAD3NG5KSN2GL", + * break_type: { + * location_id: "CGJN03P1D08GF", + * break_name: "Lunch Break", + * expected_duration: "PT30M", + * is_paid: true * } * } */ export interface CreateBreakTypeRequest { /** A unique string value to ensure the idempotency of the operation. */ - idempotencyKey?: string; + idempotency_key?: string; /** The `BreakType` to be created. */ - breakType: Square.BreakType; + break_type: Square.BreakType; } diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/ListBreakTypesRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/ListBreakTypesRequest.ts index 8786dd752..166e44d54 100644 --- a/src/api/resources/labor/resources/breakTypes/client/requests/ListBreakTypesRequest.ts +++ b/src/api/resources/labor/resources/breakTypes/client/requests/ListBreakTypesRequest.ts @@ -11,7 +11,7 @@ export interface ListBreakTypesRequest { * Filter the returned `BreakType` results to only those that are associated with the * specified location. */ - locationId?: string | null; + location_id?: string | null; /** * The maximum number of `BreakType` results to return per page. The number can range between 1 * and 200. The default is 200. diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts index 57ed0b0f5..cef7f2f5c 100644 --- a/src/api/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts +++ b/src/api/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts @@ -2,17 +2,17 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * id: "id", - * breakType: { - * locationId: "26M7H24AZ9N6R", - * breakName: "Lunch", - * expectedDuration: "PT50M", - * isPaid: true, + * break_type: { + * location_id: "26M7H24AZ9N6R", + * break_name: "Lunch", + * expected_duration: "PT50M", + * is_paid: true, * version: 1 * } * } @@ -23,5 +23,5 @@ export interface UpdateBreakTypeRequest { */ id: string; /** The updated `BreakType`. */ - breakType: Square.BreakType; + break_type: 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 index 12addd0f2..f1b3a3da7 100644 --- a/src/api/resources/labor/resources/breakTypes/client/requests/index.ts +++ b/src/api/resources/labor/resources/breakTypes/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type ListBreakTypesRequest } from "./ListBreakTypesRequest"; -export { type CreateBreakTypeRequest } from "./CreateBreakTypeRequest"; -export { type GetBreakTypesRequest } from "./GetBreakTypesRequest"; -export { type UpdateBreakTypeRequest } from "./UpdateBreakTypeRequest"; -export { type DeleteBreakTypesRequest } from "./DeleteBreakTypesRequest"; +export { type ListBreakTypesRequest } from "./ListBreakTypesRequest.js"; +export { type CreateBreakTypeRequest } from "./CreateBreakTypeRequest.js"; +export { type GetBreakTypesRequest } from "./GetBreakTypesRequest.js"; +export { type UpdateBreakTypeRequest } from "./UpdateBreakTypeRequest.js"; +export { type DeleteBreakTypesRequest } from "./DeleteBreakTypesRequest.js"; diff --git a/src/api/resources/labor/resources/breakTypes/index.ts b/src/api/resources/labor/resources/breakTypes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/labor/resources/breakTypes/index.ts +++ b/src/api/resources/labor/resources/breakTypes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/labor/resources/employeeWages/client/Client.ts b/src/api/resources/labor/resources/employeeWages/client/Client.ts index ec461c6e0..3d5c41f41 100644 --- a/src/api/resources/labor/resources/employeeWages/client/Client.ts +++ b/src/api/resources/labor/resources/employeeWages/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace EmployeeWages { export interface Options { @@ -17,6 +16,8 @@ export declare namespace EmployeeWages { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace EmployeeWages { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class EmployeeWages { - constructor(protected readonly _options: EmployeeWages.Options = {}) {} + protected readonly _options: EmployeeWages.Options; + + constructor(_options: EmployeeWages.Options = {}) { + this._options = _options; + } /** * Returns a paginated list of `EmployeeWage` instances for a business. @@ -50,79 +55,82 @@ export class EmployeeWages { request: Square.labor.ListEmployeeWagesRequest = {}, requestOptions?: EmployeeWages.RequestOptions, ): Promise> { - const list = async ( - request: Square.labor.ListEmployeeWagesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.labor.ListEmployeeWagesRequest, + ): Promise> => { + const { employee_id: 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/employee-wages", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListEmployeeWagesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.employeeWages ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.employee_wages ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -140,50 +148,47 @@ export class EmployeeWages { * id: "id" * }) */ - public async get( + public get( + request: Square.labor.GetEmployeeWagesRequest, + requestOptions?: EmployeeWages.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.labor.GetEmployeeWagesRequest, requestOptions?: EmployeeWages.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetEmployeeWageResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -192,12 +197,14 @@ export class EmployeeWages { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/labor/resources/employeeWages/client/index.ts b/src/api/resources/labor/resources/employeeWages/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/labor/resources/employeeWages/client/index.ts +++ b/src/api/resources/labor/resources/employeeWages/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/labor/resources/employeeWages/client/requests/ListEmployeeWagesRequest.ts b/src/api/resources/labor/resources/employeeWages/client/requests/ListEmployeeWagesRequest.ts index cf1e2232d..632e02354 100644 --- a/src/api/resources/labor/resources/employeeWages/client/requests/ListEmployeeWagesRequest.ts +++ b/src/api/resources/labor/resources/employeeWages/client/requests/ListEmployeeWagesRequest.ts @@ -10,7 +10,7 @@ export interface ListEmployeeWagesRequest { /** * Filter the returned wages to only those that are associated with the specified employee. */ - employeeId?: string | null; + employee_id?: string | null; /** * The maximum number of `EmployeeWage` results to return per page. The number can range between * 1 and 200. The default is 200. diff --git a/src/api/resources/labor/resources/employeeWages/client/requests/index.ts b/src/api/resources/labor/resources/employeeWages/client/requests/index.ts index eb9a9e67e..1c0efd061 100644 --- a/src/api/resources/labor/resources/employeeWages/client/requests/index.ts +++ b/src/api/resources/labor/resources/employeeWages/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListEmployeeWagesRequest } from "./ListEmployeeWagesRequest"; -export { type GetEmployeeWagesRequest } from "./GetEmployeeWagesRequest"; +export { type ListEmployeeWagesRequest } from "./ListEmployeeWagesRequest.js"; +export { type GetEmployeeWagesRequest } from "./GetEmployeeWagesRequest.js"; diff --git a/src/api/resources/labor/resources/employeeWages/index.ts b/src/api/resources/labor/resources/employeeWages/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/labor/resources/employeeWages/index.ts +++ b/src/api/resources/labor/resources/employeeWages/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/labor/resources/index.ts b/src/api/resources/labor/resources/index.ts index e0b60d0eb..5a1e4f41f 100644 --- a/src/api/resources/labor/resources/index.ts +++ b/src/api/resources/labor/resources/index.ts @@ -1,10 +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"; +export * as breakTypes from "./breakTypes/index.js"; +export * as employeeWages from "./employeeWages/index.js"; +export * as shifts from "./shifts/index.js"; +export * as teamMemberWages from "./teamMemberWages/index.js"; +export * as workweekConfigs from "./workweekConfigs/index.js"; +export * from "./breakTypes/client/requests/index.js"; +export * from "./employeeWages/client/requests/index.js"; +export * from "./shifts/client/requests/index.js"; +export * from "./teamMemberWages/client/requests/index.js"; +export * from "./workweekConfigs/client/requests/index.js"; diff --git a/src/api/resources/labor/resources/shifts/client/Client.ts b/src/api/resources/labor/resources/shifts/client/Client.ts index c2dd3a5f5..195fd7af8 100644 --- a/src/api/resources/labor/resources/shifts/client/Client.ts +++ b/src/api/resources/labor/resources/shifts/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Shifts { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Shifts { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Shifts { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Shifts { - constructor(protected readonly _options: Shifts.Options = {}) {} + protected readonly _options: Shifts.Options; + + constructor(_options: Shifts.Options = {}) { + this._options = _options; + } /** * Creates a new `Shift`. @@ -62,82 +67,78 @@ export class Shifts { * * @example * await client.labor.shifts.create({ - * idempotencyKey: "HIDSNG5KS478L", + * idempotency_key: "HIDSNG5KS478L", * shift: { - * locationId: "PAA1RJZZKXBFG", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Barista", - * hourlyRate: { - * amount: 1100, + * hourly_rate: { + * amount: BigInt("1100"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } * }) */ - public async create( + public create( request: Square.labor.CreateShiftRequest, requestOptions?: Shifts.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.labor.CreateShiftRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.labor.CreateShiftRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -146,12 +147,14 @@ export class Shifts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/labor/shifts."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -180,65 +183,61 @@ export class Shifts { * query: { * filter: { * workday: { - * dateRange: { - * startDate: "2019-01-20", - * endDate: "2019-02-03" + * date_range: { + * start_date: "2019-01-20", + * end_date: "2019-02-03" * }, - * matchShiftsBy: "START_AT", - * defaultTimezone: "America/Los_Angeles" + * match_shifts_by: "START_AT", + * default_timezone: "America/Los_Angeles" * } * } * }, * limit: 100 * }) */ - public async search( + public search( + request: Square.labor.SearchShiftsRequest = {}, + requestOptions?: Shifts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( request: Square.labor.SearchShiftsRequest = {}, requestOptions?: Shifts.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.labor.SearchShiftsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchShiftsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -247,12 +246,14 @@ export class Shifts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -268,50 +269,47 @@ export class Shifts { * id: "id" * }) */ - public async get( + public get( + request: Square.labor.GetShiftsRequest, + requestOptions?: Shifts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.labor.GetShiftsRequest, requestOptions?: Shifts.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -320,12 +318,14 @@ export class Shifts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -346,83 +346,79 @@ export class Shifts { * 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", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Bartender", - * hourlyRate: { - * amount: 1500, + * hourly_rate: { + * amount: BigInt("1500"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ * id: "X7GAQYVVRRG6P", - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], * version: 1, - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } * }) */ - public async update( + public update( request: Square.labor.UpdateShiftRequest, requestOptions?: Shifts.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.labor.UpdateShiftRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise> { const { id, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.labor.UpdateShiftRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -431,12 +427,14 @@ export class Shifts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -452,50 +450,47 @@ export class Shifts { * id: "id" * }) */ - public async delete( + public delete( + request: Square.labor.DeleteShiftsRequest, + requestOptions?: Shifts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.labor.DeleteShiftsRequest, requestOptions?: Shifts.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteShiftResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -504,12 +499,14 @@ export class Shifts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/labor/resources/shifts/client/index.ts b/src/api/resources/labor/resources/shifts/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/labor/resources/shifts/client/index.ts +++ b/src/api/resources/labor/resources/shifts/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts b/src/api/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts index c887a2938..5ca6e4971 100644 --- a/src/api/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts +++ b/src/api/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts @@ -2,35 +2,35 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "HIDSNG5KS478L", + * idempotency_key: "HIDSNG5KS478L", * shift: { - * locationId: "PAA1RJZZKXBFG", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Barista", - * hourlyRate: { - * amount: 1100, + * hourly_rate: { + * amount: BigInt("1100"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } @@ -38,7 +38,7 @@ import * as Square from "../../../../../../index"; */ export interface CreateShiftRequest { /** A unique string value to ensure the idempotency of the operation. */ - idempotencyKey?: string; + idempotency_key?: 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 index 17caa5167..a64b99eb5 100644 --- a/src/api/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts +++ b/src/api/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -10,12 +10,12 @@ import * as Square from "../../../../../../index"; * query: { * filter: { * workday: { - * dateRange: { - * startDate: "2019-01-20", - * endDate: "2019-02-03" + * date_range: { + * start_date: "2019-01-20", + * end_date: "2019-02-03" * }, - * matchShiftsBy: "START_AT", - * defaultTimezone: "America/Los_Angeles" + * match_shifts_by: "START_AT", + * default_timezone: "America/Los_Angeles" * } * } * }, diff --git a/src/api/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts b/src/api/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts index cb078e7b0..0d3d457b1 100644 --- a/src/api/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts +++ b/src/api/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts @@ -2,37 +2,37 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * id: "id", * shift: { - * locationId: "PAA1RJZZKXBFG", - * startAt: "2019-01-25T03:11:00-05:00", - * endAt: "2019-01-25T13:11:00-05:00", + * location_id: "PAA1RJZZKXBFG", + * start_at: "2019-01-25T03:11:00-05:00", + * end_at: "2019-01-25T13:11:00-05:00", * wage: { * title: "Bartender", - * hourlyRate: { - * amount: 1500, + * hourly_rate: { + * amount: BigInt("1500"), * currency: "USD" * }, - * tipEligible: true + * tip_eligible: true * }, * breaks: [{ * id: "X7GAQYVVRRG6P", - * startAt: "2019-01-25T06:11:00-05:00", - * endAt: "2019-01-25T06:16:00-05:00", - * breakTypeId: "REGS1EQR1TPZ5", + * start_at: "2019-01-25T06:11:00-05:00", + * end_at: "2019-01-25T06:16:00-05:00", + * break_type_id: "REGS1EQR1TPZ5", * name: "Tea Break", - * expectedDuration: "PT5M", - * isPaid: true + * expected_duration: "PT5M", + * is_paid: true * }], * version: 1, - * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - * declaredCashTipMoney: { - * amount: 500, + * team_member_id: "ormj0jJJZ5OZIzxrZYJI", + * declared_cash_tip_money: { + * amount: BigInt("500"), * currency: "USD" * } * } diff --git a/src/api/resources/labor/resources/shifts/client/requests/index.ts b/src/api/resources/labor/resources/shifts/client/requests/index.ts index 49df3318e..2b6bfa892 100644 --- a/src/api/resources/labor/resources/shifts/client/requests/index.ts +++ b/src/api/resources/labor/resources/shifts/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type CreateShiftRequest } from "./CreateShiftRequest"; -export { type SearchShiftsRequest } from "./SearchShiftsRequest"; -export { type GetShiftsRequest } from "./GetShiftsRequest"; -export { type UpdateShiftRequest } from "./UpdateShiftRequest"; -export { type DeleteShiftsRequest } from "./DeleteShiftsRequest"; +export { type CreateShiftRequest } from "./CreateShiftRequest.js"; +export { type SearchShiftsRequest } from "./SearchShiftsRequest.js"; +export { type GetShiftsRequest } from "./GetShiftsRequest.js"; +export { type UpdateShiftRequest } from "./UpdateShiftRequest.js"; +export { type DeleteShiftsRequest } from "./DeleteShiftsRequest.js"; diff --git a/src/api/resources/labor/resources/shifts/index.ts b/src/api/resources/labor/resources/shifts/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/labor/resources/shifts/index.ts +++ b/src/api/resources/labor/resources/shifts/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/labor/resources/teamMemberWages/client/Client.ts b/src/api/resources/labor/resources/teamMemberWages/client/Client.ts index 2291a6bc2..4904afa9b 100644 --- a/src/api/resources/labor/resources/teamMemberWages/client/Client.ts +++ b/src/api/resources/labor/resources/teamMemberWages/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace TeamMemberWages { export interface Options { @@ -17,6 +16,8 @@ export declare namespace TeamMemberWages { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace TeamMemberWages { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class TeamMemberWages { - constructor(protected readonly _options: TeamMemberWages.Options = {}) {} + protected readonly _options: TeamMemberWages.Options; + + constructor(_options: TeamMemberWages.Options = {}) { + this._options = _options; + } /** * Returns a paginated list of `TeamMemberWage` instances for a business. @@ -50,81 +55,82 @@ export class TeamMemberWages { request: Square.labor.ListTeamMemberWagesRequest = {}, requestOptions?: TeamMemberWages.RequestOptions, ): Promise> { - const list = async ( - request: Square.labor.ListTeamMemberWagesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.labor.ListTeamMemberWagesRequest, + ): Promise> => { + const { team_member_id: 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListTeamMemberWagesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.teamMemberWages ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.team_member_wages ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -142,50 +148,47 @@ export class TeamMemberWages { * id: "id" * }) */ - public async get( + public get( + request: Square.labor.GetTeamMemberWagesRequest, + requestOptions?: TeamMemberWages.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.labor.GetTeamMemberWagesRequest, requestOptions?: TeamMemberWages.RequestOptions, - ): Promise { + ): Promise> { const { id } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetTeamMemberWageResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -194,6 +197,7 @@ export class TeamMemberWages { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -202,6 +206,7 @@ export class TeamMemberWages { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/labor/resources/teamMemberWages/client/index.ts b/src/api/resources/labor/resources/teamMemberWages/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/labor/resources/teamMemberWages/client/index.ts +++ b/src/api/resources/labor/resources/teamMemberWages/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/labor/resources/teamMemberWages/client/requests/ListTeamMemberWagesRequest.ts b/src/api/resources/labor/resources/teamMemberWages/client/requests/ListTeamMemberWagesRequest.ts index df32649b6..5c39e5391 100644 --- a/src/api/resources/labor/resources/teamMemberWages/client/requests/ListTeamMemberWagesRequest.ts +++ b/src/api/resources/labor/resources/teamMemberWages/client/requests/ListTeamMemberWagesRequest.ts @@ -11,7 +11,7 @@ export interface ListTeamMemberWagesRequest { * Filter the returned wages to only those that are associated with the * specified team member. */ - teamMemberId?: string | null; + team_member_id?: string | null; /** * The maximum number of `TeamMemberWage` results to return per page. The number can range between * 1 and 200. The default is 200. diff --git a/src/api/resources/labor/resources/teamMemberWages/client/requests/index.ts b/src/api/resources/labor/resources/teamMemberWages/client/requests/index.ts index 97313ff47..cb8091193 100644 --- a/src/api/resources/labor/resources/teamMemberWages/client/requests/index.ts +++ b/src/api/resources/labor/resources/teamMemberWages/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListTeamMemberWagesRequest } from "./ListTeamMemberWagesRequest"; -export { type GetTeamMemberWagesRequest } from "./GetTeamMemberWagesRequest"; +export { type ListTeamMemberWagesRequest } from "./ListTeamMemberWagesRequest.js"; +export { type GetTeamMemberWagesRequest } from "./GetTeamMemberWagesRequest.js"; diff --git a/src/api/resources/labor/resources/teamMemberWages/index.ts b/src/api/resources/labor/resources/teamMemberWages/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/labor/resources/teamMemberWages/index.ts +++ b/src/api/resources/labor/resources/teamMemberWages/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/labor/resources/workweekConfigs/client/Client.ts b/src/api/resources/labor/resources/workweekConfigs/client/Client.ts index 668269098..7b6af29a4 100644 --- a/src/api/resources/labor/resources/workweekConfigs/client/Client.ts +++ b/src/api/resources/labor/resources/workweekConfigs/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace WorkweekConfigs { export interface Options { @@ -17,6 +16,8 @@ export declare namespace WorkweekConfigs { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace WorkweekConfigs { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class WorkweekConfigs { - constructor(protected readonly _options: WorkweekConfigs.Options = {}) {} + protected readonly _options: WorkweekConfigs.Options; + + constructor(_options: WorkweekConfigs.Options = {}) { + this._options = _options; + } /** * Returns a list of `WorkweekConfig` instances for a business. @@ -50,78 +55,79 @@ export class WorkweekConfigs { request: Square.labor.ListWorkweekConfigsRequest = {}, requestOptions?: WorkweekConfigs.RequestOptions, ): Promise> { - const list = async ( - request: Square.labor.ListWorkweekConfigsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.labor.ListWorkweekConfigsRequest, + ): 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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/workweek-configs", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListWorkweekConfigsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.workweekConfigs ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.workweek_configs ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -137,61 +143,57 @@ export class WorkweekConfigs { * @example * await client.labor.workweekConfigs.get({ * id: "id", - * workweekConfig: { - * startOfWeek: "MON", - * startOfDayLocalTime: "10:00", + * workweek_config: { + * start_of_week: "MON", + * start_of_day_local_time: "10:00", * version: 10 * } * }) */ - public async get( + public get( + request: Square.labor.UpdateWorkweekConfigRequest, + requestOptions?: WorkweekConfigs.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.labor.UpdateWorkweekConfigRequest, requestOptions?: WorkweekConfigs.RequestOptions, - ): Promise { + ): Promise> { const { id, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.labor.UpdateWorkweekConfigRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateWorkweekConfigResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -200,6 +202,7 @@ export class WorkweekConfigs { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -208,6 +211,7 @@ export class WorkweekConfigs { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/labor/resources/workweekConfigs/client/index.ts b/src/api/resources/labor/resources/workweekConfigs/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/labor/resources/workweekConfigs/client/index.ts +++ b/src/api/resources/labor/resources/workweekConfigs/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts b/src/api/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts index b9a85bb7c..41f6e28e3 100644 --- a/src/api/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts +++ b/src/api/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * id: "id", - * workweekConfig: { - * startOfWeek: "MON", - * startOfDayLocalTime: "10:00", + * workweek_config: { + * start_of_week: "MON", + * start_of_day_local_time: "10:00", * version: 10 * } * } @@ -21,5 +21,5 @@ export interface UpdateWorkweekConfigRequest { */ id: string; /** The updated `WorkweekConfig` object. */ - workweekConfig: Square.WorkweekConfig; + workweek_config: Square.WorkweekConfig; } diff --git a/src/api/resources/labor/resources/workweekConfigs/client/requests/index.ts b/src/api/resources/labor/resources/workweekConfigs/client/requests/index.ts index 04fe60b23..975fb8e83 100644 --- a/src/api/resources/labor/resources/workweekConfigs/client/requests/index.ts +++ b/src/api/resources/labor/resources/workweekConfigs/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListWorkweekConfigsRequest } from "./ListWorkweekConfigsRequest"; -export { type UpdateWorkweekConfigRequest } from "./UpdateWorkweekConfigRequest"; +export { type ListWorkweekConfigsRequest } from "./ListWorkweekConfigsRequest.js"; +export { type UpdateWorkweekConfigRequest } from "./UpdateWorkweekConfigRequest.js"; diff --git a/src/api/resources/labor/resources/workweekConfigs/index.ts b/src/api/resources/labor/resources/workweekConfigs/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/labor/resources/workweekConfigs/index.ts +++ b/src/api/resources/labor/resources/workweekConfigs/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/locations/client/Client.ts b/src/api/resources/locations/client/Client.ts index 36804519d..74c936c7e 100644 --- a/src/api/resources/locations/client/Client.ts +++ b/src/api/resources/locations/client/Client.ts @@ -2,15 +2,14 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client.js"; +import { CustomAttributes } from "../resources/customAttributes/client/Client.js"; +import { Transactions } from "../resources/transactions/client/Client.js"; export declare namespace Locations { export interface Options { @@ -20,6 +19,8 @@ export declare namespace Locations { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -33,16 +34,19 @@ export declare namespace Locations { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Locations { + protected readonly _options: Locations.Options; protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; protected _customAttributes: CustomAttributes | undefined; protected _transactions: Transactions | undefined; - constructor(protected readonly _options: Locations.Options = {}) {} + constructor(_options: Locations.Options = {}) { + this._options = _options; + } public get customAttributeDefinitions(): CustomAttributeDefinitions { return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); @@ -65,46 +69,42 @@ export class Locations { * @example * await client.locations.list() */ - public async list(requestOptions?: Locations.RequestOptions): Promise { + public list(requestOptions?: Locations.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(requestOptions)); + } + + private async __list( + requestOptions?: Locations.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.ListLocationsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -113,12 +113,14 @@ export class Locations { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/locations."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -140,62 +142,58 @@ export class Locations { * location: { * name: "Midtown", * address: { - * addressLine1: "1234 Peachtree St. NE", + * address_line_1: "1234 Peachtree St. NE", * locality: "Atlanta", - * administrativeDistrictLevel1: "GA", - * postalCode: "30309" + * administrative_district_level_1: "GA", + * postal_code: "30309" * }, * description: "Midtown Atlanta store" * } * }) */ - public async create( + public create( request: Square.CreateLocationRequest = {}, requestOptions?: Locations.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.CreateLocationRequest = {}, + requestOptions?: Locations.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateLocationRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateLocationResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -204,12 +202,14 @@ export class Locations { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/locations."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -223,53 +223,50 @@ export class Locations { * * @example * await client.locations.get({ - * locationId: "location_id" + * location_id: "location_id" * }) */ - public async get( + public get( + request: Square.GetLocationsRequest, + requestOptions?: Locations.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetLocationsRequest, requestOptions?: Locations.RequestOptions, - ): Promise { - const { locationId } = request; + ): Promise> { + const { location_id: locationId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetLocationResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -278,12 +275,14 @@ export class Locations { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -296,75 +295,71 @@ export class Locations { * * @example * await client.locations.update({ - * locationId: "location_id", + * location_id: "location_id", * location: { - * businessHours: { + * business_hours: { * periods: [{ - * dayOfWeek: "FRI", - * startLocalTime: "07:00", - * endLocalTime: "18:00" + * day_of_week: "FRI", + * start_local_time: "07:00", + * end_local_time: "18:00" * }, { - * dayOfWeek: "SAT", - * startLocalTime: "07:00", - * endLocalTime: "18:00" + * day_of_week: "SAT", + * start_local_time: "07:00", + * end_local_time: "18:00" * }, { - * dayOfWeek: "SUN", - * startLocalTime: "09:00", - * endLocalTime: "15:00" + * day_of_week: "SUN", + * start_local_time: "09:00", + * end_local_time: "15:00" * }] * }, * description: "Midtown Atlanta store - Open weekends" * } * }) */ - public async update( + public update( + request: Square.UpdateLocationRequest, + requestOptions?: Locations.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.UpdateLocationRequest, requestOptions?: Locations.RequestOptions, - ): Promise { - const { locationId, ..._body } = request; + ): Promise> { + const { location_id: locationId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateLocationRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateLocationResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -373,12 +368,14 @@ export class Locations { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -397,38 +394,38 @@ export class Locations { * * @example * await client.locations.checkouts({ - * locationId: "location_id", - * idempotencyKey: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + * location_id: "location_id", + * idempotency_key: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", * order: { * order: { - * locationId: "location_id", - * referenceId: "reference_id", - * customerId: "customer_id", - * lineItems: [{ + * location_id: "location_id", + * reference_id: "reference_id", + * customer_id: "customer_id", + * line_items: [{ * name: "Printed T Shirt", * quantity: "2", - * appliedTaxes: [{ - * taxUid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3" + * applied_taxes: [{ + * tax_uid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3" * }], - * appliedDiscounts: [{ - * discountUid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4" + * applied_discounts: [{ + * discount_uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4" * }], - * basePriceMoney: { - * amount: 1500, + * base_price_money: { + * amount: BigInt("1500"), * currency: "USD" * } * }, { * name: "Slim Jeans", * quantity: "1", - * basePriceMoney: { - * amount: 2500, + * base_price_money: { + * amount: BigInt("2500"), * currency: "USD" * } * }, { * name: "Woven Sweater", * quantity: "3", - * basePriceMoney: { - * amount: 3500, + * base_price_money: { + * amount: BigInt("3500"), * currency: "USD" * } * }], @@ -441,87 +438,83 @@ export class Locations { * discounts: [{ * uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", * type: "FIXED_AMOUNT", - * amountMoney: { - * amount: 100, + * amount_money: { + * amount: BigInt("100"), * currency: "USD" * }, * scope: "LINE_ITEM" * }] * }, - * idempotencyKey: "12ae1696-z1e3-4328-af6d-f1e04d947gd4" + * idempotency_key: "12ae1696-z1e3-4328-af6d-f1e04d947gd4" * }, - * askForShippingAddress: true, - * merchantSupportEmail: "merchant+support@website.com", - * prePopulateBuyerEmail: "example@email.com", - * prePopulateShippingAddress: { - * addressLine1: "1455 Market St.", - * addressLine2: "Suite 600", + * ask_for_shipping_address: true, + * merchant_support_email: "merchant+support@website.com", + * pre_populate_buyer_email: "example@email.com", + * pre_populate_shipping_address: { + * address_line_1: "1455 Market St.", + * address_line_2: "Suite 600", * locality: "San Francisco", - * administrativeDistrictLevel1: "CA", - * postalCode: "94103", + * administrative_district_level_1: "CA", + * postal_code: "94103", * country: "US", - * firstName: "Jane", - * lastName: "Doe" + * first_name: "Jane", + * last_name: "Doe" * }, - * redirectUrl: "https://merchant.website.com/order-confirm", - * additionalRecipients: [{ - * locationId: "057P5VYJ4A5X1", + * redirect_url: "https://merchant.website.com/order-confirm", + * additional_recipients: [{ + * location_id: "057P5VYJ4A5X1", * description: "Application fees", - * amountMoney: { - * amount: 60, + * amount_money: { + * amount: BigInt("60"), * currency: "USD" * } * }] * }) */ - public async checkouts( + public checkouts( + request: Square.CreateCheckoutRequest, + requestOptions?: Locations.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__checkouts(request, requestOptions)); + } + + private async __checkouts( request: Square.CreateCheckoutRequest, requestOptions?: Locations.RequestOptions, - ): Promise { - const { locationId, ..._body } = request; + ): Promise> { + const { location_id: locationId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateCheckoutRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.CreateCheckoutResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -530,6 +523,7 @@ export class Locations { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -538,6 +532,7 @@ export class Locations { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/locations/client/index.ts b/src/api/resources/locations/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/locations/client/index.ts +++ b/src/api/resources/locations/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/locations/client/requests/CreateCheckoutRequest.ts b/src/api/resources/locations/client/requests/CreateCheckoutRequest.ts index cd6a62f0a..9a428994d 100644 --- a/src/api/resources/locations/client/requests/CreateCheckoutRequest.ts +++ b/src/api/resources/locations/client/requests/CreateCheckoutRequest.ts @@ -2,43 +2,43 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * locationId: "location_id", - * idempotencyKey: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + * location_id: "location_id", + * idempotency_key: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", * order: { * order: { - * locationId: "location_id", - * referenceId: "reference_id", - * customerId: "customer_id", - * lineItems: [{ + * location_id: "location_id", + * reference_id: "reference_id", + * customer_id: "customer_id", + * line_items: [{ * name: "Printed T Shirt", * quantity: "2", - * appliedTaxes: [{ - * taxUid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3" + * applied_taxes: [{ + * tax_uid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3" * }], - * appliedDiscounts: [{ - * discountUid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4" + * applied_discounts: [{ + * discount_uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4" * }], - * basePriceMoney: { - * amount: 1500, + * base_price_money: { + * amount: BigInt("1500"), * currency: "USD" * } * }, { * name: "Slim Jeans", * quantity: "1", - * basePriceMoney: { - * amount: 2500, + * base_price_money: { + * amount: BigInt("2500"), * currency: "USD" * } * }, { * name: "Woven Sweater", * quantity: "3", - * basePriceMoney: { - * amount: 3500, + * base_price_money: { + * amount: BigInt("3500"), * currency: "USD" * } * }], @@ -51,34 +51,34 @@ import * as Square from "../../../../index"; * discounts: [{ * uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", * type: "FIXED_AMOUNT", - * amountMoney: { - * amount: 100, + * amount_money: { + * amount: BigInt("100"), * currency: "USD" * }, * scope: "LINE_ITEM" * }] * }, - * idempotencyKey: "12ae1696-z1e3-4328-af6d-f1e04d947gd4" + * idempotency_key: "12ae1696-z1e3-4328-af6d-f1e04d947gd4" * }, - * askForShippingAddress: true, - * merchantSupportEmail: "merchant+support@website.com", - * prePopulateBuyerEmail: "example@email.com", - * prePopulateShippingAddress: { - * addressLine1: "1455 Market St.", - * addressLine2: "Suite 600", + * ask_for_shipping_address: true, + * merchant_support_email: "merchant+support@website.com", + * pre_populate_buyer_email: "example@email.com", + * pre_populate_shipping_address: { + * address_line_1: "1455 Market St.", + * address_line_2: "Suite 600", * locality: "San Francisco", - * administrativeDistrictLevel1: "CA", - * postalCode: "94103", + * administrative_district_level_1: "CA", + * postal_code: "94103", * country: "US", - * firstName: "Jane", - * lastName: "Doe" + * first_name: "Jane", + * last_name: "Doe" * }, - * redirectUrl: "https://merchant.website.com/order-confirm", - * additionalRecipients: [{ - * locationId: "057P5VYJ4A5X1", + * redirect_url: "https://merchant.website.com/order-confirm", + * additional_recipients: [{ + * location_id: "057P5VYJ4A5X1", * description: "Application fees", - * amountMoney: { - * amount: 60, + * amount_money: { + * amount: BigInt("60"), * currency: "USD" * } * }] @@ -88,7 +88,7 @@ export interface CreateCheckoutRequest { /** * The ID of the business location to associate the checkout with. */ - locationId: string; + location_id: 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. @@ -102,7 +102,7 @@ export interface CreateCheckoutRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; + idempotency_key: string; /** The order including line items to be checked out. */ order: Square.CreateOrderRequest; /** @@ -111,7 +111,7 @@ export interface CreateCheckoutRequest { * * Default: `false`. */ - askForShippingAddress?: boolean; + ask_for_shipping_address?: boolean; /** * The email address to display on the Square Checkout confirmation page * and confirmation email that the buyer can use to contact the seller. @@ -121,21 +121,21 @@ export interface CreateCheckoutRequest { * * Default: none; only exists if explicitly set. */ - merchantSupportEmail?: string; + merchant_support_email?: 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; + pre_populate_buyer_email?: 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; + pre_populate_shipping_address?: Square.Address; /** * The URL to redirect to after the checkout is completed with `checkoutId`, * `transactionId`, and `referenceId` appended as URL parameters. For example, @@ -151,7 +151,7 @@ export interface CreateCheckoutRequest { * * Default: none; only exists if explicitly set. */ - redirectUrl?: string; + redirect_url?: string; /** * The basic primitive of a multi-party transaction. The value is optional. * The transaction facilitated by you can be split from here. @@ -164,7 +164,7 @@ export interface CreateCheckoutRequest { * * This field is currently not supported in the Square Sandbox. */ - additionalRecipients?: Square.ChargeRequestAdditionalRecipient[]; + additional_recipients?: Square.ChargeRequestAdditionalRecipient[]; /** * An optional note to associate with the `checkout` object. * diff --git a/src/api/resources/locations/client/requests/CreateLocationRequest.ts b/src/api/resources/locations/client/requests/CreateLocationRequest.ts index d51a6483b..39870dc68 100644 --- a/src/api/resources/locations/client/requests/CreateLocationRequest.ts +++ b/src/api/resources/locations/client/requests/CreateLocationRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -10,10 +10,10 @@ import * as Square from "../../../../index"; * location: { * name: "Midtown", * address: { - * addressLine1: "1234 Peachtree St. NE", + * address_line_1: "1234 Peachtree St. NE", * locality: "Atlanta", - * administrativeDistrictLevel1: "GA", - * postalCode: "30309" + * administrative_district_level_1: "GA", + * postal_code: "30309" * }, * description: "Midtown Atlanta store" * } diff --git a/src/api/resources/locations/client/requests/GetLocationsRequest.ts b/src/api/resources/locations/client/requests/GetLocationsRequest.ts index 06f3a0e38..70bdf6a89 100644 --- a/src/api/resources/locations/client/requests/GetLocationsRequest.ts +++ b/src/api/resources/locations/client/requests/GetLocationsRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface GetLocationsRequest { @@ -13,5 +13,5 @@ export interface GetLocationsRequest { * The ID of the location to retrieve. Specify the string * "main" to return the main location. */ - locationId: string; + location_id: string; } diff --git a/src/api/resources/locations/client/requests/UpdateLocationRequest.ts b/src/api/resources/locations/client/requests/UpdateLocationRequest.ts index 328c18b39..e96b056d4 100644 --- a/src/api/resources/locations/client/requests/UpdateLocationRequest.ts +++ b/src/api/resources/locations/client/requests/UpdateLocationRequest.ts @@ -2,26 +2,26 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * locationId: "location_id", + * location_id: "location_id", * location: { - * businessHours: { + * business_hours: { * periods: [{ - * dayOfWeek: "FRI", - * startLocalTime: "07:00", - * endLocalTime: "18:00" + * day_of_week: "FRI", + * start_local_time: "07:00", + * end_local_time: "18:00" * }, { - * dayOfWeek: "SAT", - * startLocalTime: "07:00", - * endLocalTime: "18:00" + * day_of_week: "SAT", + * start_local_time: "07:00", + * end_local_time: "18:00" * }, { - * dayOfWeek: "SUN", - * startLocalTime: "09:00", - * endLocalTime: "15:00" + * day_of_week: "SUN", + * start_local_time: "09:00", + * end_local_time: "15:00" * }] * }, * description: "Midtown Atlanta store - Open weekends" @@ -32,7 +32,7 @@ export interface UpdateLocationRequest { /** * The ID of the location to update. */ - locationId: string; + location_id: 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 index 4b7f7c91c..ca5ceafcf 100644 --- a/src/api/resources/locations/client/requests/index.ts +++ b/src/api/resources/locations/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type CreateLocationRequest } from "./CreateLocationRequest"; -export { type GetLocationsRequest } from "./GetLocationsRequest"; -export { type UpdateLocationRequest } from "./UpdateLocationRequest"; -export { type CreateCheckoutRequest } from "./CreateCheckoutRequest"; +export { type CreateLocationRequest } from "./CreateLocationRequest.js"; +export { type GetLocationsRequest } from "./GetLocationsRequest.js"; +export { type UpdateLocationRequest } from "./UpdateLocationRequest.js"; +export { type CreateCheckoutRequest } from "./CreateCheckoutRequest.js"; diff --git a/src/api/resources/locations/index.ts b/src/api/resources/locations/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/locations/index.ts +++ b/src/api/resources/locations/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts index 2f767d953..ac48332f6 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributeDefinitions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributeDefinitions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributeDefinitions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributeDefinitions { - constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + protected readonly _options: CustomAttributeDefinitions.Options; + + constructor(_options: CustomAttributeDefinitions.Options = {}) { + this._options = _options; + } /** * Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. @@ -53,87 +58,85 @@ export class CustomAttributeDefinitions { request: Square.locations.ListCustomAttributeDefinitionsRequest = {}, requestOptions?: CustomAttributeDefinitions.RequestOptions, ): Promise> { - const list = async ( - request: Square.locations.ListCustomAttributeDefinitionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.locations.ListCustomAttributeDefinitionsRequest, + ): Promise> => { + const { visibility_filter: visibilityFilter, limit, cursor } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = visibilityFilter; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListLocationCustomAttributeDefinitionsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable< Square.ListLocationCustomAttributeDefinitionsResponse, Square.CustomAttributeDefinition >({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributeDefinitions ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attribute_definitions ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -154,7 +157,7 @@ export class CustomAttributeDefinitions { * * @example * await client.locations.customAttributeDefinitions.create({ - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "bestseller", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" @@ -165,53 +168,52 @@ export class CustomAttributeDefinitions { * } * }) */ - public async create( + public create( + request: Square.locations.CreateLocationCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.locations.CreateLocationCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.locations.CreateLocationCustomAttributeDefinitionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateLocationCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -220,6 +222,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -228,6 +231,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -245,10 +249,17 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async get( + public get( + request: Square.locations.GetCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.locations.GetCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key, version } = request; const _queryParams: Record = {}; if (version !== undefined) { @@ -256,45 +267,38 @@ export class CustomAttributeDefinitions { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveLocationCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -303,6 +307,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -311,6 +316,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -327,60 +333,59 @@ export class CustomAttributeDefinitions { * @example * await client.locations.customAttributeDefinitions.update({ * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * description: "Update the description as desired.", * visibility: "VISIBILITY_READ_ONLY" * } * }) */ - public async update( + public update( + request: Square.locations.UpdateLocationCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.locations.UpdateLocationCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.locations.UpdateLocationCustomAttributeDefinitionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateLocationCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -389,6 +394,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -397,6 +403,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -415,50 +422,50 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async delete( + public delete( + request: Square.locations.DeleteCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.locations.DeleteCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteLocationCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -467,6 +474,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -475,6 +483,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/index.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts index 10231ace2..082875bd7 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "bestseller", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" @@ -26,10 +26,10 @@ export interface CreateLocationCustomAttributeDefinitionRequest { * [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; + custom_attribute_definition: 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; + idempotency_key?: string; } diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts index 313ea4854..e4fb2f3be 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -12,7 +12,7 @@ export interface ListCustomAttributeDefinitionsRequest { /** * Filters the `CustomAttributeDefinition` results by their `visibility` values. */ - visibilityFilter?: Square.VisibilityFilter | null; + visibility_filter?: 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. diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts index b1178a8df..d76212c54 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * description: "Update the description as desired.", * visibility: "VISIBILITY_READ_ONLY" * } @@ -35,10 +35,10 @@ export interface UpdateLocationCustomAttributeDefinitionRequest { * 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; + custom_attribute_definition: 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; + idempotency_key?: 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 index 04a383e3e..f4c565be7 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest"; -export { type CreateLocationCustomAttributeDefinitionRequest } from "./CreateLocationCustomAttributeDefinitionRequest"; -export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest"; -export { type UpdateLocationCustomAttributeDefinitionRequest } from "./UpdateLocationCustomAttributeDefinitionRequest"; -export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest"; +export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest.js"; +export { type CreateLocationCustomAttributeDefinitionRequest } from "./CreateLocationCustomAttributeDefinitionRequest.js"; +export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest.js"; +export { type UpdateLocationCustomAttributeDefinitionRequest } from "./UpdateLocationCustomAttributeDefinitionRequest.js"; +export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest.js"; diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/index.ts b/src/api/resources/locations/resources/customAttributeDefinitions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/index.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/locations/resources/customAttributes/client/Client.ts b/src/api/resources/locations/resources/customAttributes/client/Client.ts index 94c0c63c2..77a53748c 100644 --- a/src/api/resources/locations/resources/customAttributes/client/Client.ts +++ b/src/api/resources/locations/resources/customAttributes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributes { - constructor(protected readonly _options: CustomAttributes.Options = {}) {} + protected readonly _options: CustomAttributes.Options; + + constructor(_options: CustomAttributes.Options = {}) { + this._options = _options; + } /** * Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation. @@ -60,53 +65,52 @@ export class CustomAttributes { * } * }) */ - public async batchDelete( + public batchDelete( request: Square.locations.BulkDeleteLocationCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchDelete(request, requestOptions)); + } + + private async __batchDelete( + request: Square.locations.BulkDeleteLocationCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.locations.BulkDeleteLocationCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkDeleteLocationCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -115,6 +119,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -123,6 +128,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -146,22 +152,22 @@ export class CustomAttributes { * await client.locations.customAttributes.batchUpsert({ * values: { * "id1": { - * locationId: "L0TBCBTB7P8RQ", - * customAttribute: { + * location_id: "L0TBCBTB7P8RQ", + * custom_attribute: { * key: "bestseller", * value: "hot cocoa" * } * }, * "id2": { - * locationId: "L9XMD04V3STJX", - * customAttribute: { + * location_id: "L9XMD04V3STJX", + * custom_attribute: { * key: "bestseller", * value: "berry smoothie" * } * }, * "id3": { - * locationId: "L0TBCBTB7P8RQ", - * customAttribute: { + * location_id: "L0TBCBTB7P8RQ", + * custom_attribute: { * key: "phone-number", * value: "+12223334444" * } @@ -169,53 +175,52 @@ export class CustomAttributes { * } * }) */ - public async batchUpsert( + public batchUpsert( + request: Square.locations.BulkUpsertLocationCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpsert(request, requestOptions)); + } + + private async __batchUpsert( request: Square.locations.BulkUpsertLocationCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.locations.BulkUpsertLocationCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkUpsertLocationCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -224,6 +229,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -232,6 +238,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -249,94 +256,98 @@ export class CustomAttributes { * * @example * await client.locations.customAttributes.list({ - * locationId: "location_id" + * location_id: "location_id" * }) */ public async list( request: Square.locations.ListCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, ): Promise> { - const list = async ( - request: Square.locations.ListCustomAttributesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.locations.ListCustomAttributesRequest, + ): Promise> => { + const { + location_id: locationId, + visibility_filter: visibilityFilter, + limit, + cursor, + with_definitions: withDefinitions, + } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = visibilityFilter; + } + 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListLocationCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributes ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attributes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -355,15 +366,22 @@ export class CustomAttributes { * * @example * await client.locations.customAttributes.get({ - * locationId: "location_id", + * location_id: "location_id", * key: "key" * }) */ - public async get( + public get( request: Square.locations.GetCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { locationId, key, withDefinition, version } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.locations.GetCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { location_id: locationId, key, with_definition: withDefinition, version } = request; const _queryParams: Record = {}; if (withDefinition !== undefined) { _queryParams["with_definition"] = withDefinition?.toString() ?? null; @@ -374,45 +392,38 @@ export class CustomAttributes { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveLocationCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -421,6 +432,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -429,6 +441,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -446,61 +459,60 @@ export class CustomAttributes { * * @example * await client.locations.customAttributes.upsert({ - * locationId: "location_id", + * location_id: "location_id", * key: "key", - * customAttribute: { + * custom_attribute: { * value: "hot cocoa" * } * }) */ - public async upsert( + public upsert( request: Square.locations.UpsertLocationCustomAttributeRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { locationId, key, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions)); + } + + private async __upsert( + request: Square.locations.UpsertLocationCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { location_id: locationId, key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.locations.UpsertLocationCustomAttributeRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpsertLocationCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -509,6 +521,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -517,6 +530,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -531,54 +545,54 @@ export class CustomAttributes { * * @example * await client.locations.customAttributes.delete({ - * locationId: "location_id", + * location_id: "location_id", * key: "key" * }) */ - public async delete( + public delete( + request: Square.locations.DeleteCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.locations.DeleteCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { locationId, key } = request; + ): Promise> { + const { location_id: locationId, key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteLocationCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -587,6 +601,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -595,6 +610,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/locations/resources/customAttributes/client/index.ts b/src/api/resources/locations/resources/customAttributes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/locations/resources/customAttributes/client/index.ts +++ b/src/api/resources/locations/resources/customAttributes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts index b7bca236d..a1a57400f 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts index c45d120fb..71bf2d917 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts @@ -2,29 +2,29 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * values: { * "id1": { - * locationId: "L0TBCBTB7P8RQ", - * customAttribute: { + * location_id: "L0TBCBTB7P8RQ", + * custom_attribute: { * key: "bestseller", * value: "hot cocoa" * } * }, * "id2": { - * locationId: "L9XMD04V3STJX", - * customAttribute: { + * location_id: "L9XMD04V3STJX", + * custom_attribute: { * key: "bestseller", * value: "berry smoothie" * } * }, * "id3": { - * locationId: "L0TBCBTB7P8RQ", - * customAttribute: { + * location_id: "L0TBCBTB7P8RQ", + * custom_attribute: { * key: "phone-number", * value: "+12223334444" * } diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts index 466967e90..938545d5b 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * locationId: "location_id", + * location_id: "location_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface DeleteCustomAttributesRequest { /** * The ID of the target [location](entity:Location). */ - locationId: string; + location_id: 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 diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts index da1c7c505..f8790349b 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * locationId: "location_id", + * location_id: "location_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface GetCustomAttributesRequest { /** * The ID of the target [location](entity:Location). */ - locationId: string; + location_id: 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 @@ -25,7 +25,7 @@ export interface GetCustomAttributesRequest { * 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; + with_definition?: 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 diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts index f573b8c2e..a586641ee 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface ListCustomAttributesRequest { /** * The ID of the target [location](entity:Location). */ - locationId: string; + location_id: string; /** * Filters the `CustomAttributeDefinition` results by their `visibility` values. */ - visibilityFilter?: Square.VisibilityFilter | null; + visibility_filter?: 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. @@ -36,5 +36,5 @@ export interface ListCustomAttributesRequest { * 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; + with_definitions?: 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 index fd3393039..839b871a2 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * locationId: "location_id", + * location_id: "location_id", * key: "key", - * customAttribute: { + * custom_attribute: { * value: "hot cocoa" * } * } @@ -18,7 +18,7 @@ export interface UpsertLocationCustomAttributeRequest { /** * The ID of the target [location](entity:Location). */ - locationId: string; + location_id: 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 @@ -33,10 +33,10 @@ export interface UpsertLocationCustomAttributeRequest { * 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; + custom_attribute: 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; + idempotency_key?: 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 index 5fa631d1f..a296f391b 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/index.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type BulkDeleteLocationCustomAttributesRequest } from "./BulkDeleteLocationCustomAttributesRequest"; -export { type BulkUpsertLocationCustomAttributesRequest } from "./BulkUpsertLocationCustomAttributesRequest"; -export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest"; -export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest"; -export { type UpsertLocationCustomAttributeRequest } from "./UpsertLocationCustomAttributeRequest"; -export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest"; +export { type BulkDeleteLocationCustomAttributesRequest } from "./BulkDeleteLocationCustomAttributesRequest.js"; +export { type BulkUpsertLocationCustomAttributesRequest } from "./BulkUpsertLocationCustomAttributesRequest.js"; +export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest.js"; +export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest.js"; +export { type UpsertLocationCustomAttributeRequest } from "./UpsertLocationCustomAttributeRequest.js"; +export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest.js"; diff --git a/src/api/resources/locations/resources/customAttributes/index.ts b/src/api/resources/locations/resources/customAttributes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/locations/resources/customAttributes/index.ts +++ b/src/api/resources/locations/resources/customAttributes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/locations/resources/index.ts b/src/api/resources/locations/resources/index.ts index 6322f4066..2cfe40243 100644 --- a/src/api/resources/locations/resources/index.ts +++ b/src/api/resources/locations/resources/index.ts @@ -1,6 +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"; +export * as customAttributeDefinitions from "./customAttributeDefinitions/index.js"; +export * as customAttributes from "./customAttributes/index.js"; +export * as transactions from "./transactions/index.js"; +export * from "./customAttributeDefinitions/client/requests/index.js"; +export * from "./customAttributes/client/requests/index.js"; +export * from "./transactions/client/requests/index.js"; diff --git a/src/api/resources/locations/resources/transactions/client/Client.ts b/src/api/resources/locations/resources/transactions/client/Client.ts index a2ad8caae..2891ab795 100644 --- a/src/api/resources/locations/resources/transactions/client/Client.ts +++ b/src/api/resources/locations/resources/transactions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Transactions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Transactions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Transactions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Transactions { - constructor(protected readonly _options: Transactions.Options = {}) {} + protected readonly _options: Transactions.Options; + + constructor(_options: Transactions.Options = {}) { + this._options = _options; + } /** * Lists transactions for a particular location. @@ -50,14 +55,27 @@ export class Transactions { * * @example * await client.locations.transactions.list({ - * locationId: "location_id" + * location_id: "location_id" * }) */ - public async list( + public list( request: Square.locations.ListTransactionsRequest, requestOptions?: Transactions.RequestOptions, - ): Promise { - const { locationId, beginTime, endTime, sortOrder, cursor } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( + request: Square.locations.ListTransactionsRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise> { + const { + location_id: locationId, + begin_time: beginTime, + end_time: endTime, + sort_order: sortOrder, + cursor, + } = request; const _queryParams: Record = {}; if (beginTime !== undefined) { _queryParams["begin_time"] = beginTime; @@ -68,10 +86,7 @@ export class Transactions { } if (sortOrder !== undefined) { - _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }); + _queryParams["sort_order"] = sortOrder; } if (cursor !== undefined) { @@ -79,45 +94,35 @@ export class Transactions { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.ListTransactionsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -126,6 +131,7 @@ export class Transactions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -134,6 +140,7 @@ export class Transactions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -146,54 +153,51 @@ export class Transactions { * * @example * await client.locations.transactions.get({ - * locationId: "location_id", - * transactionId: "transaction_id" + * location_id: "location_id", + * transaction_id: "transaction_id" * }) */ - public async get( + public get( request: Square.locations.GetTransactionsRequest, requestOptions?: Transactions.RequestOptions, - ): Promise { - const { locationId, transactionId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.locations.GetTransactionsRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise> { + const { location_id: locationId, transaction_id: transactionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetTransactionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -202,6 +206,7 @@ export class Transactions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -210,6 +215,7 @@ export class Transactions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -227,54 +233,51 @@ export class Transactions { * * @example * await client.locations.transactions.capture({ - * locationId: "location_id", - * transactionId: "transaction_id" + * location_id: "location_id", + * transaction_id: "transaction_id" * }) */ - public async capture( + public capture( request: Square.locations.CaptureTransactionsRequest, requestOptions?: Transactions.RequestOptions, - ): Promise { - const { locationId, transactionId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__capture(request, requestOptions)); + } + + private async __capture( + request: Square.locations.CaptureTransactionsRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise> { + const { location_id: locationId, transaction_id: transactionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.CaptureTransactionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -283,6 +286,7 @@ export class Transactions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -291,6 +295,7 @@ export class Transactions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -308,54 +313,51 @@ export class Transactions { * * @example * await client.locations.transactions.void({ - * locationId: "location_id", - * transactionId: "transaction_id" + * location_id: "location_id", + * transaction_id: "transaction_id" * }) */ - public async void( + public void( request: Square.locations.VoidTransactionsRequest, requestOptions?: Transactions.RequestOptions, - ): Promise { - const { locationId, transactionId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__void(request, requestOptions)); + } + + private async __void( + request: Square.locations.VoidTransactionsRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise> { + const { location_id: locationId, transaction_id: transactionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.VoidTransactionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -364,6 +366,7 @@ export class Transactions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -372,6 +375,7 @@ export class Transactions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/locations/resources/transactions/client/index.ts b/src/api/resources/locations/resources/transactions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/locations/resources/transactions/client/index.ts +++ b/src/api/resources/locations/resources/transactions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/locations/resources/transactions/client/requests/CaptureTransactionsRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/CaptureTransactionsRequest.ts index cf21b4087..591d73fe5 100644 --- a/src/api/resources/locations/resources/transactions/client/requests/CaptureTransactionsRequest.ts +++ b/src/api/resources/locations/resources/transactions/client/requests/CaptureTransactionsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * locationId: "location_id", - * transactionId: "transaction_id" + * location_id: "location_id", + * transaction_id: "transaction_id" * } */ export interface CaptureTransactionsRequest { /** * */ - locationId: string; + location_id: string; /** * */ - transactionId: string; + transaction_id: string; } diff --git a/src/api/resources/locations/resources/transactions/client/requests/GetTransactionsRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/GetTransactionsRequest.ts index fb2c20d13..413b46526 100644 --- a/src/api/resources/locations/resources/transactions/client/requests/GetTransactionsRequest.ts +++ b/src/api/resources/locations/resources/transactions/client/requests/GetTransactionsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * locationId: "location_id", - * transactionId: "transaction_id" + * location_id: "location_id", + * transaction_id: "transaction_id" * } */ export interface GetTransactionsRequest { /** * The ID of the transaction's associated location. */ - locationId: string; + location_id: string; /** * The ID of the transaction to retrieve. */ - transactionId: string; + transaction_id: string; } diff --git a/src/api/resources/locations/resources/transactions/client/requests/ListTransactionsRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/ListTransactionsRequest.ts index db18e708a..0ed586275 100644 --- a/src/api/resources/locations/resources/transactions/client/requests/ListTransactionsRequest.ts +++ b/src/api/resources/locations/resources/transactions/client/requests/ListTransactionsRequest.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface ListTransactionsRequest { /** * The ID of the location to list transactions for. */ - locationId: string; + location_id: string; /** * The beginning of the requested reporting period, in RFC 3339 format. * @@ -22,7 +22,7 @@ export interface ListTransactionsRequest { * * Default value: The current time minus one year. */ - beginTime?: string | null; + begin_time?: string | null; /** * The end of the requested reporting period, in RFC 3339 format. * @@ -30,14 +30,14 @@ export interface ListTransactionsRequest { * * Default value: The current time. */ - endTime?: string | null; + end_time?: 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; + sort_order?: 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. diff --git a/src/api/resources/locations/resources/transactions/client/requests/VoidTransactionsRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/VoidTransactionsRequest.ts index 6c73f8655..69e3928bd 100644 --- a/src/api/resources/locations/resources/transactions/client/requests/VoidTransactionsRequest.ts +++ b/src/api/resources/locations/resources/transactions/client/requests/VoidTransactionsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * locationId: "location_id", - * transactionId: "transaction_id" + * location_id: "location_id", + * transaction_id: "transaction_id" * } */ export interface VoidTransactionsRequest { /** * */ - locationId: string; + location_id: string; /** * */ - transactionId: string; + transaction_id: 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 index 71ae1bc2c..a1927fdd8 100644 --- a/src/api/resources/locations/resources/transactions/client/requests/index.ts +++ b/src/api/resources/locations/resources/transactions/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type ListTransactionsRequest } from "./ListTransactionsRequest"; -export { type GetTransactionsRequest } from "./GetTransactionsRequest"; -export { type CaptureTransactionsRequest } from "./CaptureTransactionsRequest"; -export { type VoidTransactionsRequest } from "./VoidTransactionsRequest"; +export { type ListTransactionsRequest } from "./ListTransactionsRequest.js"; +export { type GetTransactionsRequest } from "./GetTransactionsRequest.js"; +export { type CaptureTransactionsRequest } from "./CaptureTransactionsRequest.js"; +export { type VoidTransactionsRequest } from "./VoidTransactionsRequest.js"; diff --git a/src/api/resources/locations/resources/transactions/index.ts b/src/api/resources/locations/resources/transactions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/locations/resources/transactions/index.ts +++ b/src/api/resources/locations/resources/transactions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/loyalty/client/Client.ts b/src/api/resources/loyalty/client/Client.ts index 0278e1036..aad7d3d52 100644 --- a/src/api/resources/loyalty/client/Client.ts +++ b/src/api/resources/loyalty/client/Client.ts @@ -2,15 +2,14 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { Accounts } from "../resources/accounts/client/Client.js"; +import { Programs } from "../resources/programs/client/Client.js"; +import { Rewards } from "../resources/rewards/client/Client.js"; export declare namespace Loyalty { export interface Options { @@ -20,6 +19,8 @@ export declare namespace Loyalty { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -33,16 +34,19 @@ export declare namespace Loyalty { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Loyalty { + protected readonly _options: Loyalty.Options; protected _accounts: Accounts | undefined; protected _programs: Programs | undefined; protected _rewards: Rewards | undefined; - constructor(protected readonly _options: Loyalty.Options = {}) {} + constructor(_options: Loyalty.Options = {}) { + this._options = _options; + } public get accounts(): Accounts { return (this._accounts ??= new Accounts(this._options)); @@ -73,61 +77,57 @@ export class Loyalty { * await client.loyalty.searchEvents({ * query: { * filter: { - * orderFilter: { - * orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY" + * order_filter: { + * order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY" * } * } * }, * limit: 30 * }) */ - public async searchEvents( + public searchEvents( request: Square.SearchLoyaltyEventsRequest = {}, requestOptions?: Loyalty.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchEvents(request, requestOptions)); + } + + private async __searchEvents( + request: Square.SearchLoyaltyEventsRequest = {}, + requestOptions?: Loyalty.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchLoyaltyEventsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchLoyaltyEventsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -136,12 +136,14 @@ export class Loyalty { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/loyalty/client/index.ts b/src/api/resources/loyalty/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/loyalty/client/index.ts +++ b/src/api/resources/loyalty/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts b/src/api/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts index 2b1bc0f10..fcd44ed3a 100644 --- a/src/api/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts +++ b/src/api/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * query: { * filter: { - * orderFilter: { - * orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY" + * order_filter: { + * order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY" * } * } * }, diff --git a/src/api/resources/loyalty/client/requests/index.ts b/src/api/resources/loyalty/client/requests/index.ts index 119b5f36e..d930649bc 100644 --- a/src/api/resources/loyalty/client/requests/index.ts +++ b/src/api/resources/loyalty/client/requests/index.ts @@ -1 +1 @@ -export { type SearchLoyaltyEventsRequest } from "./SearchLoyaltyEventsRequest"; +export { type SearchLoyaltyEventsRequest } from "./SearchLoyaltyEventsRequest.js"; diff --git a/src/api/resources/loyalty/index.ts b/src/api/resources/loyalty/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/loyalty/index.ts +++ b/src/api/resources/loyalty/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/loyalty/resources/accounts/client/Client.ts b/src/api/resources/loyalty/resources/accounts/client/Client.ts index 5066aad99..e08d02b41 100644 --- a/src/api/resources/loyalty/resources/accounts/client/Client.ts +++ b/src/api/resources/loyalty/resources/accounts/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Accounts { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Accounts { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Accounts { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Accounts { - constructor(protected readonly _options: Accounts.Options = {}) {} + protected readonly _options: Accounts.Options; + + constructor(_options: Accounts.Options = {}) { + this._options = _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. @@ -45,62 +50,58 @@ export class Accounts { * * @example * await client.loyalty.accounts.create({ - * loyaltyAccount: { - * programId: "d619f755-2d17-41f3-990d-c04ecedd64dd", + * loyalty_account: { + * program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", * mapping: { - * phoneNumber: "+14155551234" + * phone_number: "+14155551234" * } * }, - * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996" * }) */ - public async create( + public create( request: Square.loyalty.CreateLoyaltyAccountRequest, requestOptions?: Accounts.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.loyalty.CreateLoyaltyAccountRequest, + requestOptions?: Accounts.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.CreateLoyaltyAccountRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateLoyaltyAccountResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -109,12 +110,14 @@ export class Accounts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/loyalty/accounts."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -133,59 +136,55 @@ export class Accounts { * await client.loyalty.accounts.search({ * query: { * mappings: [{ - * phoneNumber: "+14155551234" + * phone_number: "+14155551234" * }] * }, * limit: 10 * }) */ - public async search( + public search( request: Square.loyalty.SearchLoyaltyAccountsRequest = {}, requestOptions?: Accounts.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.loyalty.SearchLoyaltyAccountsRequest = {}, + requestOptions?: Accounts.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.SearchLoyaltyAccountsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchLoyaltyAccountsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -194,12 +193,14 @@ export class Accounts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -212,53 +213,50 @@ export class Accounts { * * @example * await client.loyalty.accounts.get({ - * accountId: "account_id" + * account_id: "account_id" * }) */ - public async get( + public get( + request: Square.loyalty.GetAccountsRequest, + requestOptions?: Accounts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.loyalty.GetAccountsRequest, requestOptions?: Accounts.RequestOptions, - ): Promise { - const { accountId } = request; + ): Promise> { + const { account_id: accountId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetLoyaltyAccountResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -267,6 +265,7 @@ export class Accounts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -275,6 +274,7 @@ export class Accounts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -300,62 +300,61 @@ export class Accounts { * * @example * await client.loyalty.accounts.accumulatePoints({ - * accountId: "account_id", - * accumulatePoints: { - * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * account_id: "account_id", + * accumulate_points: { + * order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" * }, - * idempotencyKey: "58b90739-c3e8-4b11-85f7-e636d48d72cb", - * locationId: "P034NEENMD09F" + * idempotency_key: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + * location_id: "P034NEENMD09F" * }) */ - public async accumulatePoints( + public accumulatePoints( + request: Square.loyalty.AccumulateLoyaltyPointsRequest, + requestOptions?: Accounts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__accumulatePoints(request, requestOptions)); + } + + private async __accumulatePoints( request: Square.loyalty.AccumulateLoyaltyPointsRequest, requestOptions?: Accounts.RequestOptions, - ): Promise { - const { accountId, ..._body } = request; + ): Promise> { + const { account_id: accountId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.AccumulateLoyaltyPointsRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.AccumulateLoyaltyPointsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -364,6 +363,7 @@ export class Accounts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -372,6 +372,7 @@ export class Accounts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -388,62 +389,58 @@ export class Accounts { * * @example * await client.loyalty.accounts.adjust({ - * accountId: "account_id", - * idempotencyKey: "bc29a517-3dc9-450e-aa76-fae39ee849d1", - * adjustPoints: { + * account_id: "account_id", + * idempotency_key: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + * adjust_points: { * points: 10, * reason: "Complimentary points" * } * }) */ - public async adjust( + public adjust( + request: Square.loyalty.AdjustLoyaltyPointsRequest, + requestOptions?: Accounts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__adjust(request, requestOptions)); + } + + private async __adjust( request: Square.loyalty.AdjustLoyaltyPointsRequest, requestOptions?: Accounts.RequestOptions, - ): Promise { - const { accountId, ..._body } = request; + ): Promise> { + const { account_id: accountId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.AdjustLoyaltyPointsRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.AdjustLoyaltyPointsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -452,6 +449,7 @@ export class Accounts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -460,6 +458,7 @@ export class Accounts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/loyalty/resources/accounts/client/index.ts b/src/api/resources/loyalty/resources/accounts/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/loyalty/resources/accounts/client/index.ts +++ b/src/api/resources/loyalty/resources/accounts/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts b/src/api/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts index 88c4285f2..14ce0f9ca 100644 --- a/src/api/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts +++ b/src/api/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts @@ -2,35 +2,35 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * accountId: "account_id", - * accumulatePoints: { - * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * account_id: "account_id", + * accumulate_points: { + * order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" * }, - * idempotencyKey: "58b90739-c3e8-4b11-85f7-e636d48d72cb", - * locationId: "P034NEENMD09F" + * idempotency_key: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + * location_id: "P034NEENMD09F" * } */ export interface AccumulateLoyaltyPointsRequest { /** * The ID of the target [loyalty account](entity:LoyaltyAccount). */ - accountId: string; + account_id: 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; + accumulate_points: 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; + idempotency_key: string; /** The [location](entity:Location) where the purchase was made. */ - locationId: string; + location_id: 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 index 6243e046b..ddeb64898 100644 --- a/src/api/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts +++ b/src/api/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * accountId: "account_id", - * idempotencyKey: "bc29a517-3dc9-450e-aa76-fae39ee849d1", - * adjustPoints: { + * account_id: "account_id", + * idempotency_key: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + * adjust_points: { * points: 10, * reason: "Complimentary points" * } @@ -19,21 +19,21 @@ export interface AdjustLoyaltyPointsRequest { /** * The ID of the target [loyalty account](entity:LoyaltyAccount). */ - accountId: string; + account_id: string; /** * A unique string that identifies this `AdjustLoyaltyPoints` request. * Keys can be any valid string, but must be unique for every request. */ - idempotencyKey: string; + idempotency_key: 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; + adjust_points: 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; + allow_negative_balance?: 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 index b9301ffc1..0706e2515 100644 --- a/src/api/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts +++ b/src/api/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts @@ -2,26 +2,26 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * loyaltyAccount: { - * programId: "d619f755-2d17-41f3-990d-c04ecedd64dd", + * loyalty_account: { + * program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", * mapping: { - * phoneNumber: "+14155551234" + * phone_number: "+14155551234" * } * }, - * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996" * } */ export interface CreateLoyaltyAccountRequest { /** The loyalty account to create. */ - loyaltyAccount: Square.LoyaltyAccount; + loyalty_account: 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; + idempotency_key: string; } diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/GetAccountsRequest.ts b/src/api/resources/loyalty/resources/accounts/client/requests/GetAccountsRequest.ts index 1037dbb90..04c7690fb 100644 --- a/src/api/resources/loyalty/resources/accounts/client/requests/GetAccountsRequest.ts +++ b/src/api/resources/loyalty/resources/accounts/client/requests/GetAccountsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * accountId: "account_id" + * account_id: "account_id" * } */ export interface GetAccountsRequest { /** * The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve. */ - accountId: string; + account_id: 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 index b5b095842..8a06d3b80 100644 --- a/src/api/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts +++ b/src/api/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * query: { * mappings: [{ - * phoneNumber: "+14155551234" + * phone_number: "+14155551234" * }] * }, * limit: 10 diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/index.ts b/src/api/resources/loyalty/resources/accounts/client/requests/index.ts index d6efd2ba6..37bf702db 100644 --- a/src/api/resources/loyalty/resources/accounts/client/requests/index.ts +++ b/src/api/resources/loyalty/resources/accounts/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type CreateLoyaltyAccountRequest } from "./CreateLoyaltyAccountRequest"; -export { type SearchLoyaltyAccountsRequest } from "./SearchLoyaltyAccountsRequest"; -export { type GetAccountsRequest } from "./GetAccountsRequest"; -export { type AccumulateLoyaltyPointsRequest } from "./AccumulateLoyaltyPointsRequest"; -export { type AdjustLoyaltyPointsRequest } from "./AdjustLoyaltyPointsRequest"; +export { type CreateLoyaltyAccountRequest } from "./CreateLoyaltyAccountRequest.js"; +export { type SearchLoyaltyAccountsRequest } from "./SearchLoyaltyAccountsRequest.js"; +export { type GetAccountsRequest } from "./GetAccountsRequest.js"; +export { type AccumulateLoyaltyPointsRequest } from "./AccumulateLoyaltyPointsRequest.js"; +export { type AdjustLoyaltyPointsRequest } from "./AdjustLoyaltyPointsRequest.js"; diff --git a/src/api/resources/loyalty/resources/accounts/index.ts b/src/api/resources/loyalty/resources/accounts/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/loyalty/resources/accounts/index.ts +++ b/src/api/resources/loyalty/resources/accounts/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/loyalty/resources/index.ts b/src/api/resources/loyalty/resources/index.ts index e335fa8c9..910584b34 100644 --- a/src/api/resources/loyalty/resources/index.ts +++ b/src/api/resources/loyalty/resources/index.ts @@ -1,6 +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"; +export * as accounts from "./accounts/index.js"; +export * as programs from "./programs/index.js"; +export * as rewards from "./rewards/index.js"; +export * from "./accounts/client/requests/index.js"; +export * from "./programs/client/requests/index.js"; +export * from "./rewards/client/requests/index.js"; diff --git a/src/api/resources/loyalty/resources/programs/client/Client.ts b/src/api/resources/loyalty/resources/programs/client/Client.ts index d4cb23dd2..03aaa461c 100644 --- a/src/api/resources/loyalty/resources/programs/client/Client.ts +++ b/src/api/resources/loyalty/resources/programs/client/Client.ts @@ -2,13 +2,12 @@ * 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"; +import * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; +import { Promotions } from "../resources/promotions/client/Client.js"; export declare namespace Programs { export interface Options { @@ -18,6 +17,8 @@ export declare namespace Programs { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -31,14 +32,17 @@ export declare namespace Programs { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Programs { + protected readonly _options: Programs.Options; protected _promotions: Promotions | undefined; - constructor(protected readonly _options: Programs.Options = {}) {} + constructor(_options: Programs.Options = {}) { + this._options = _options; + } public get promotions(): Promotions { return (this._promotions ??= new Promotions(this._options)); @@ -56,46 +60,44 @@ export class Programs { * @example * await client.loyalty.programs.list() */ - public async list(requestOptions?: Programs.RequestOptions): Promise { + public list( + requestOptions?: Programs.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(requestOptions)); + } + + private async __list( + requestOptions?: Programs.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.ListLoyaltyProgramsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -104,12 +106,14 @@ export class Programs { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/loyalty/programs."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -124,53 +128,50 @@ export class Programs { * * @example * await client.loyalty.programs.get({ - * programId: "program_id" + * program_id: "program_id" * }) */ - public async get( + public get( request: Square.loyalty.GetProgramsRequest, requestOptions?: Programs.RequestOptions, - ): Promise { - const { programId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.loyalty.GetProgramsRequest, + requestOptions?: Programs.RequestOptions, + ): Promise> { + const { program_id: programId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetLoyaltyProgramResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -179,6 +180,7 @@ export class Programs { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -187,6 +189,7 @@ export class Programs { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -213,59 +216,58 @@ export class Programs { * * @example * await client.loyalty.programs.calculate({ - * programId: "program_id", - * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - * loyaltyAccountId: "79b807d2-d786-46a9-933b-918028d7a8c5" + * program_id: "program_id", + * order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + * loyalty_account_id: "79b807d2-d786-46a9-933b-918028d7a8c5" * }) */ - public async calculate( + public calculate( request: Square.loyalty.CalculateLoyaltyPointsRequest, requestOptions?: Programs.RequestOptions, - ): Promise { - const { programId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__calculate(request, requestOptions)); + } + + private async __calculate( + request: Square.loyalty.CalculateLoyaltyPointsRequest, + requestOptions?: Programs.RequestOptions, + ): Promise> { + const { program_id: programId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.CalculateLoyaltyPointsRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.CalculateLoyaltyPointsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -274,6 +276,7 @@ export class Programs { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -282,6 +285,7 @@ export class Programs { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/loyalty/resources/programs/client/index.ts b/src/api/resources/loyalty/resources/programs/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/loyalty/resources/programs/client/index.ts +++ b/src/api/resources/loyalty/resources/programs/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts b/src/api/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts index ce71619a8..dc3d21b6a 100644 --- a/src/api/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts +++ b/src/api/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts @@ -2,33 +2,33 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * programId: "program_id", - * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - * loyaltyAccountId: "79b807d2-d786-46a9-933b-918028d7a8c5" + * program_id: "program_id", + * order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + * loyalty_account_id: "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; + program_id: 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; + order_id?: 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; + transaction_amount_money?: 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. @@ -39,5 +39,5 @@ export interface CalculateLoyaltyPointsRequest { * If not specified, the `promotion_points` field shows the number of points the purchase qualifies * for regardless of the trigger limit. */ - loyaltyAccountId?: string | null; + loyalty_account_id?: string | null; } diff --git a/src/api/resources/loyalty/resources/programs/client/requests/GetProgramsRequest.ts b/src/api/resources/loyalty/resources/programs/client/requests/GetProgramsRequest.ts index 21b4fcc20..cfe3400ab 100644 --- a/src/api/resources/loyalty/resources/programs/client/requests/GetProgramsRequest.ts +++ b/src/api/resources/loyalty/resources/programs/client/requests/GetProgramsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * programId: "program_id" + * program_id: "program_id" * } */ export interface GetProgramsRequest { /** * 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; + program_id: 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 index c6b8d4f6f..cd38d1622 100644 --- a/src/api/resources/loyalty/resources/programs/client/requests/index.ts +++ b/src/api/resources/loyalty/resources/programs/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type GetProgramsRequest } from "./GetProgramsRequest"; -export { type CalculateLoyaltyPointsRequest } from "./CalculateLoyaltyPointsRequest"; +export { type GetProgramsRequest } from "./GetProgramsRequest.js"; +export { type CalculateLoyaltyPointsRequest } from "./CalculateLoyaltyPointsRequest.js"; diff --git a/src/api/resources/loyalty/resources/programs/index.ts b/src/api/resources/loyalty/resources/programs/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/loyalty/resources/programs/index.ts +++ b/src/api/resources/loyalty/resources/programs/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/loyalty/resources/programs/resources/index.ts b/src/api/resources/loyalty/resources/programs/resources/index.ts index 0da7d5f94..e15de5462 100644 --- a/src/api/resources/loyalty/resources/programs/resources/index.ts +++ b/src/api/resources/loyalty/resources/programs/resources/index.ts @@ -1,2 +1,2 @@ -export * as promotions from "./promotions"; -export * from "./promotions/client/requests"; +export * as promotions from "./promotions/index.js"; +export * from "./promotions/client/requests/index.js"; 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 index 37eb4e388..79c7758c9 100644 --- a/src/api/resources/loyalty/resources/programs/resources/promotions/client/Client.ts +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../../../environments.js"; +import * as core from "../../../../../../../../core/index.js"; +import * as Square from "../../../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../../../core/headers.js"; +import * as errors from "../../../../../../../../errors/index.js"; export declare namespace Promotions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Promotions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Promotions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Promotions { - constructor(protected readonly _options: Promotions.Options = {}) {} + protected readonly _options: Promotions.Options; + + constructor(_options: Promotions.Options = {}) { + this._options = _options; + } /** * Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram). @@ -46,91 +51,89 @@ export class Promotions { * * @example * await client.loyalty.programs.promotions.list({ - * programId: "program_id" + * program_id: "program_id" * }) */ public async list( request: Square.loyalty.programs.ListPromotionsRequest, requestOptions?: Promotions.RequestOptions, ): Promise> { - const list = async ( - request: Square.loyalty.programs.ListPromotionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.loyalty.programs.ListPromotionsRequest, + ): Promise> => { + const { program_id: programId, status, cursor, limit } = request; + const _queryParams: Record = {}; + if (status !== undefined) { + _queryParams["status"] = status; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListLoyaltyPromotionsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.loyaltyPromotions ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.loyalty_promotions ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -150,79 +153,78 @@ export class Promotions { * * @example * await client.loyalty.programs.promotions.create({ - * programId: "program_id", - * loyaltyPromotion: { + * program_id: "program_id", + * loyalty_promotion: { * name: "Tuesday Happy Hour Promo", * incentive: { * type: "POINTS_MULTIPLIER", - * pointsMultiplierData: { + * points_multiplier_data: { * multiplier: "3.0" * } * }, - * availableTime: { - * timePeriods: ["BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"] + * available_time: { + * time_periods: ["BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"] * }, - * triggerLimit: { + * trigger_limit: { * times: 1, * interval: "DAY" * }, - * minimumSpendAmountMoney: { - * amount: 2000, + * minimum_spend_amount_money: { + * amount: BigInt("2000"), * currency: "USD" * }, - * qualifyingCategoryIds: ["XTQPYLR3IIU9C44VRCB3XD12"] + * qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"] * }, - * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996" * }) */ - public async create( + public create( + request: Square.loyalty.programs.CreateLoyaltyPromotionRequest, + requestOptions?: Promotions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.loyalty.programs.CreateLoyaltyPromotionRequest, requestOptions?: Promotions.RequestOptions, - ): Promise { - const { programId, ..._body } = request; + ): Promise> { + const { program_id: programId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.programs.CreateLoyaltyPromotionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.CreateLoyaltyPromotionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -231,6 +233,7 @@ export class Promotions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -239,6 +242,7 @@ export class Promotions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -251,54 +255,51 @@ export class Promotions { * * @example * await client.loyalty.programs.promotions.get({ - * promotionId: "promotion_id", - * programId: "program_id" + * promotion_id: "promotion_id", + * program_id: "program_id" * }) */ - public async get( + public get( request: Square.loyalty.programs.GetPromotionsRequest, requestOptions?: Promotions.RequestOptions, - ): Promise { - const { promotionId, programId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.loyalty.programs.GetPromotionsRequest, + requestOptions?: Promotions.RequestOptions, + ): Promise> { + const { promotion_id: promotionId, program_id: programId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetLoyaltyPromotionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -307,6 +308,7 @@ export class Promotions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -315,6 +317,7 @@ export class Promotions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -332,54 +335,54 @@ export class Promotions { * * @example * await client.loyalty.programs.promotions.cancel({ - * promotionId: "promotion_id", - * programId: "program_id" + * promotion_id: "promotion_id", + * program_id: "program_id" * }) */ - public async cancel( + public cancel( request: Square.loyalty.programs.CancelPromotionsRequest, requestOptions?: Promotions.RequestOptions, - ): Promise { - const { promotionId, programId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( + request: Square.loyalty.programs.CancelPromotionsRequest, + requestOptions?: Promotions.RequestOptions, + ): Promise> { + const { promotion_id: promotionId, program_id: programId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.CancelLoyaltyPromotionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -388,6 +391,7 @@ export class Promotions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -396,6 +400,7 @@ export class Promotions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } 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 index 415726b7f..82648c6ff 100644 --- a/src/api/resources/loyalty/resources/programs/resources/promotions/client/index.ts +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/CancelPromotionsRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/CancelPromotionsRequest.ts index 691ada4c3..e6070a5fc 100644 --- a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/CancelPromotionsRequest.ts +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/CancelPromotionsRequest.ts @@ -5,8 +5,8 @@ /** * @example * { - * promotionId: "promotion_id", - * programId: "program_id" + * promotion_id: "promotion_id", + * program_id: "program_id" * } */ export interface CancelPromotionsRequest { @@ -14,9 +14,9 @@ export interface CancelPromotionsRequest { * The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a * promotion that has an `ACTIVE` or `SCHEDULED` status. */ - promotionId: string; + promotion_id: string; /** * The ID of the base [loyalty program](entity:LoyaltyProgram). */ - programId: string; + program_id: string; } 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 index fb8e389ed..a735a7615 100644 --- 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 @@ -2,34 +2,34 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../../../index"; +import * as Square from "../../../../../../../../index.js"; /** * @example * { - * programId: "program_id", - * loyaltyPromotion: { + * program_id: "program_id", + * loyalty_promotion: { * name: "Tuesday Happy Hour Promo", * incentive: { * type: "POINTS_MULTIPLIER", - * pointsMultiplierData: { + * points_multiplier_data: { * multiplier: "3.0" * } * }, - * availableTime: { - * timePeriods: ["BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"] + * available_time: { + * time_periods: ["BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"] * }, - * triggerLimit: { + * trigger_limit: { * times: 1, * interval: "DAY" * }, - * minimumSpendAmountMoney: { - * amount: 2000, + * minimum_spend_amount_money: { + * amount: BigInt("2000"), * currency: "USD" * }, - * qualifyingCategoryIds: ["XTQPYLR3IIU9C44VRCB3XD12"] + * qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"] * }, - * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996" * } */ export interface CreateLoyaltyPromotionRequest { @@ -38,12 +38,12 @@ export interface CreateLoyaltyPromotionRequest { * To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) * using the `main` keyword. */ - programId: string; + program_id: string; /** The loyalty promotion to create. */ - loyaltyPromotion: Square.LoyaltyPromotion; + loyalty_promotion: 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; + idempotency_key: string; } diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/GetPromotionsRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/GetPromotionsRequest.ts index 5138a2719..24e170cee 100644 --- a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/GetPromotionsRequest.ts +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/GetPromotionsRequest.ts @@ -5,18 +5,18 @@ /** * @example * { - * promotionId: "promotion_id", - * programId: "program_id" + * promotion_id: "promotion_id", + * program_id: "program_id" * } */ export interface GetPromotionsRequest { /** * The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve. */ - promotionId: string; + promotion_id: 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; + program_id: string; } diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/ListPromotionsRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/ListPromotionsRequest.ts index d1ec23846..16bc75a9f 100644 --- a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/ListPromotionsRequest.ts +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/ListPromotionsRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../../../index"; +import * as Square from "../../../../../../../../index.js"; /** * @example * { - * programId: "program_id" + * program_id: "program_id" * } */ export interface ListPromotionsRequest { @@ -15,7 +15,7 @@ export interface ListPromotionsRequest { * 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; + program_id: 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 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 index 123564dd0..e1cdf0eae 100644 --- 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 @@ -1,4 +1,4 @@ -export { type ListPromotionsRequest } from "./ListPromotionsRequest"; -export { type CreateLoyaltyPromotionRequest } from "./CreateLoyaltyPromotionRequest"; -export { type GetPromotionsRequest } from "./GetPromotionsRequest"; -export { type CancelPromotionsRequest } from "./CancelPromotionsRequest"; +export { type ListPromotionsRequest } from "./ListPromotionsRequest.js"; +export { type CreateLoyaltyPromotionRequest } from "./CreateLoyaltyPromotionRequest.js"; +export { type GetPromotionsRequest } from "./GetPromotionsRequest.js"; +export { type CancelPromotionsRequest } from "./CancelPromotionsRequest.js"; diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/index.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/loyalty/resources/programs/resources/promotions/index.ts +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/loyalty/resources/rewards/client/Client.ts b/src/api/resources/loyalty/resources/rewards/client/Client.ts index 0834e79fb..43858c11c 100644 --- a/src/api/resources/loyalty/resources/rewards/client/Client.ts +++ b/src/api/resources/loyalty/resources/rewards/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Rewards { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Rewards { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Rewards { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Rewards { - constructor(protected readonly _options: Rewards.Options = {}) {} + protected readonly _options: Rewards.Options; + + constructor(_options: Rewards.Options = {}) { + this._options = _options; + } /** * Creates a loyalty reward. In the process, the endpoint does following: @@ -53,60 +58,56 @@ export class Rewards { * @example * await client.loyalty.rewards.create({ * reward: { - * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - * rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + * reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + * order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" * }, - * idempotencyKey: "18c2e5ea-a620-4b1f-ad60-7b167285e451" + * idempotency_key: "18c2e5ea-a620-4b1f-ad60-7b167285e451" * }) */ - public async create( + public create( request: Square.loyalty.CreateLoyaltyRewardRequest, requestOptions?: Rewards.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.loyalty.CreateLoyaltyRewardRequest, + requestOptions?: Rewards.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.CreateLoyaltyRewardRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateLoyaltyRewardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -115,12 +116,14 @@ export class Rewards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/loyalty/rewards."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -140,58 +143,54 @@ export class Rewards { * @example * await client.loyalty.rewards.search({ * query: { - * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd" + * loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd" * }, * limit: 10 * }) */ - public async search( + public search( + request: Square.loyalty.SearchLoyaltyRewardsRequest = {}, + requestOptions?: Rewards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( request: Square.loyalty.SearchLoyaltyRewardsRequest = {}, requestOptions?: Rewards.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.SearchLoyaltyRewardsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchLoyaltyRewardsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -200,12 +199,14 @@ export class Rewards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -218,53 +219,50 @@ export class Rewards { * * @example * await client.loyalty.rewards.get({ - * rewardId: "reward_id" + * reward_id: "reward_id" * }) */ - public async get( + public get( + request: Square.loyalty.GetRewardsRequest, + requestOptions?: Rewards.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.loyalty.GetRewardsRequest, requestOptions?: Rewards.RequestOptions, - ): Promise { - const { rewardId } = request; + ): Promise> { + const { reward_id: rewardId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetLoyaltyRewardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -273,6 +271,7 @@ export class Rewards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -281,6 +280,7 @@ export class Rewards { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -301,53 +301,50 @@ export class Rewards { * * @example * await client.loyalty.rewards.delete({ - * rewardId: "reward_id" + * reward_id: "reward_id" * }) */ - public async delete( + public delete( request: Square.loyalty.DeleteRewardsRequest, requestOptions?: Rewards.RequestOptions, - ): Promise { - const { rewardId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.loyalty.DeleteRewardsRequest, + requestOptions?: Rewards.RequestOptions, + ): Promise> { + const { reward_id: rewardId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteLoyaltyRewardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -356,6 +353,7 @@ export class Rewards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -364,6 +362,7 @@ export class Rewards { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -386,59 +385,55 @@ export class Rewards { * * @example * await client.loyalty.rewards.redeem({ - * rewardId: "reward_id", - * idempotencyKey: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", - * locationId: "P034NEENMD09F" + * reward_id: "reward_id", + * idempotency_key: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + * location_id: "P034NEENMD09F" * }) */ - public async redeem( + public redeem( request: Square.loyalty.RedeemLoyaltyRewardRequest, requestOptions?: Rewards.RequestOptions, - ): Promise { - const { rewardId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__redeem(request, requestOptions)); + } + + private async __redeem( + request: Square.loyalty.RedeemLoyaltyRewardRequest, + requestOptions?: Rewards.RequestOptions, + ): Promise> { + const { reward_id: rewardId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.loyalty.RedeemLoyaltyRewardRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.RedeemLoyaltyRewardResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -447,6 +442,7 @@ export class Rewards { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -455,6 +451,7 @@ export class Rewards { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/loyalty/resources/rewards/client/index.ts b/src/api/resources/loyalty/resources/rewards/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/loyalty/resources/rewards/client/index.ts +++ b/src/api/resources/loyalty/resources/rewards/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts index ae271caac..8e61d9179 100644 --- a/src/api/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts +++ b/src/api/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts @@ -2,17 +2,17 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * reward: { - * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - * rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + * reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + * order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" * }, - * idempotencyKey: "18c2e5ea-a620-4b1f-ad60-7b167285e451" + * idempotency_key: "18c2e5ea-a620-4b1f-ad60-7b167285e451" * } */ export interface CreateLoyaltyRewardRequest { @@ -22,5 +22,5 @@ export interface CreateLoyaltyRewardRequest { * A unique string that identifies this `CreateLoyaltyReward` request. * Keys can be any valid string, but must be unique for every request. */ - idempotencyKey: string; + idempotency_key: string; } diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/DeleteRewardsRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/DeleteRewardsRequest.ts index 4d0f60bd3..abf29b4dd 100644 --- a/src/api/resources/loyalty/resources/rewards/client/requests/DeleteRewardsRequest.ts +++ b/src/api/resources/loyalty/resources/rewards/client/requests/DeleteRewardsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * rewardId: "reward_id" + * reward_id: "reward_id" * } */ export interface DeleteRewardsRequest { /** * The ID of the [loyalty reward](entity:LoyaltyReward) to delete. */ - rewardId: string; + reward_id: string; } diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/GetRewardsRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/GetRewardsRequest.ts index 4eaaed693..51b04d253 100644 --- a/src/api/resources/loyalty/resources/rewards/client/requests/GetRewardsRequest.ts +++ b/src/api/resources/loyalty/resources/rewards/client/requests/GetRewardsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * rewardId: "reward_id" + * reward_id: "reward_id" * } */ export interface GetRewardsRequest { /** * The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve. */ - rewardId: string; + reward_id: 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 index ee713cc43..0ca609e13 100644 --- a/src/api/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts +++ b/src/api/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts @@ -5,21 +5,21 @@ /** * @example * { - * rewardId: "reward_id", - * idempotencyKey: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", - * locationId: "P034NEENMD09F" + * reward_id: "reward_id", + * idempotency_key: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + * location_id: "P034NEENMD09F" * } */ export interface RedeemLoyaltyRewardRequest { /** * The ID of the [loyalty reward](entity:LoyaltyReward) to redeem. */ - rewardId: string; + reward_id: string; /** * A unique string that identifies this `RedeemLoyaltyReward` request. * Keys can be any valid string, but must be unique for every request. */ - idempotencyKey: string; + idempotency_key: string; /** The ID of the [location](entity:Location) where the reward is redeemed. */ - locationId: string; + location_id: 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 index 17ef09df2..a7812dc46 100644 --- a/src/api/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts +++ b/src/api/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * query: { - * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd" + * loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd" * }, * limit: 10 * } diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/index.ts b/src/api/resources/loyalty/resources/rewards/client/requests/index.ts index 387da86cf..ac42af675 100644 --- a/src/api/resources/loyalty/resources/rewards/client/requests/index.ts +++ b/src/api/resources/loyalty/resources/rewards/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type CreateLoyaltyRewardRequest } from "./CreateLoyaltyRewardRequest"; -export { type SearchLoyaltyRewardsRequest } from "./SearchLoyaltyRewardsRequest"; -export { type GetRewardsRequest } from "./GetRewardsRequest"; -export { type DeleteRewardsRequest } from "./DeleteRewardsRequest"; -export { type RedeemLoyaltyRewardRequest } from "./RedeemLoyaltyRewardRequest"; +export { type CreateLoyaltyRewardRequest } from "./CreateLoyaltyRewardRequest.js"; +export { type SearchLoyaltyRewardsRequest } from "./SearchLoyaltyRewardsRequest.js"; +export { type GetRewardsRequest } from "./GetRewardsRequest.js"; +export { type DeleteRewardsRequest } from "./DeleteRewardsRequest.js"; +export { type RedeemLoyaltyRewardRequest } from "./RedeemLoyaltyRewardRequest.js"; diff --git a/src/api/resources/loyalty/resources/rewards/index.ts b/src/api/resources/loyalty/resources/rewards/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/loyalty/resources/rewards/index.ts +++ b/src/api/resources/loyalty/resources/rewards/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/merchants/client/Client.ts b/src/api/resources/merchants/client/Client.ts index c10549417..8647e67b9 100644 --- a/src/api/resources/merchants/client/Client.ts +++ b/src/api/resources/merchants/client/Client.ts @@ -2,14 +2,13 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client.js"; +import { CustomAttributes } from "../resources/customAttributes/client/Client.js"; export declare namespace Merchants { export interface Options { @@ -19,6 +18,8 @@ export declare namespace Merchants { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -32,15 +33,18 @@ export declare namespace Merchants { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Merchants { + protected readonly _options: Merchants.Options; protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; protected _customAttributes: CustomAttributes | undefined; - constructor(protected readonly _options: Merchants.Options = {}) {} + constructor(_options: Merchants.Options = {}) { + this._options = _options; + } public get customAttributeDefinitions(): CustomAttributeDefinitions { return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); @@ -72,70 +76,70 @@ export class Merchants { request: Square.ListMerchantsRequest = {}, requestOptions?: Merchants.RequestOptions, ): Promise> { - const list = async (request: Square.ListMerchantsRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListMerchantsRequest, + ): Promise> => { + const { cursor } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/merchants", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListMerchantsResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/merchants."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.merchant ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -151,53 +155,50 @@ export class Merchants { * * @example * await client.merchants.get({ - * merchantId: "merchant_id" + * merchant_id: "merchant_id" * }) */ - public async get( + public get( request: Square.GetMerchantsRequest, requestOptions?: Merchants.RequestOptions, - ): Promise { - const { merchantId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetMerchantsRequest, + requestOptions?: Merchants.RequestOptions, + ): Promise> { + const { merchant_id: merchantId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetMerchantResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -206,12 +207,14 @@ export class Merchants { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/merchants/client/index.ts b/src/api/resources/merchants/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/merchants/client/index.ts +++ b/src/api/resources/merchants/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/merchants/client/requests/GetMerchantsRequest.ts b/src/api/resources/merchants/client/requests/GetMerchantsRequest.ts index 9c1ccaa5d..cff2d3316 100644 --- a/src/api/resources/merchants/client/requests/GetMerchantsRequest.ts +++ b/src/api/resources/merchants/client/requests/GetMerchantsRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * merchantId: "merchant_id" + * merchant_id: "merchant_id" * } */ export interface GetMerchantsRequest { @@ -13,5 +13,5 @@ export interface GetMerchantsRequest { * 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; + merchant_id: string; } diff --git a/src/api/resources/merchants/client/requests/index.ts b/src/api/resources/merchants/client/requests/index.ts index 0569efc51..2c86cf4b3 100644 --- a/src/api/resources/merchants/client/requests/index.ts +++ b/src/api/resources/merchants/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type ListMerchantsRequest } from "./ListMerchantsRequest"; -export { type GetMerchantsRequest } from "./GetMerchantsRequest"; +export { type ListMerchantsRequest } from "./ListMerchantsRequest.js"; +export { type GetMerchantsRequest } from "./GetMerchantsRequest.js"; diff --git a/src/api/resources/merchants/index.ts b/src/api/resources/merchants/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/merchants/index.ts +++ b/src/api/resources/merchants/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts index c70924e65..c5c24fda8 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributeDefinitions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributeDefinitions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributeDefinitions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributeDefinitions { - constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + protected readonly _options: CustomAttributeDefinitions.Options; + + constructor(_options: CustomAttributeDefinitions.Options = {}) { + this._options = _options; + } /** * Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. @@ -53,87 +58,85 @@ export class CustomAttributeDefinitions { request: Square.merchants.ListCustomAttributeDefinitionsRequest = {}, requestOptions?: CustomAttributeDefinitions.RequestOptions, ): Promise> { - const list = async ( - request: Square.merchants.ListCustomAttributeDefinitionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.merchants.ListCustomAttributeDefinitionsRequest, + ): Promise> => { + const { visibility_filter: visibilityFilter, limit, cursor } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = visibilityFilter; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListMerchantCustomAttributeDefinitionsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable< Square.ListMerchantCustomAttributeDefinitionsResponse, Square.CustomAttributeDefinition >({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributeDefinitions ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attribute_definitions ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -154,7 +157,7 @@ export class CustomAttributeDefinitions { * * @example * await client.merchants.customAttributeDefinitions.create({ - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "alternative_seller_name", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" @@ -165,53 +168,52 @@ export class CustomAttributeDefinitions { * } * }) */ - public async create( + public create( + request: Square.merchants.CreateMerchantCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.merchants.CreateMerchantCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.merchants.CreateMerchantCustomAttributeDefinitionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateMerchantCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -220,6 +222,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -228,6 +231,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -245,10 +249,17 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async get( + public get( + request: Square.merchants.GetCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.merchants.GetCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key, version } = request; const _queryParams: Record = {}; if (version !== undefined) { @@ -256,45 +267,38 @@ export class CustomAttributeDefinitions { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveMerchantCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -303,6 +307,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -311,6 +316,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -327,60 +333,59 @@ export class CustomAttributeDefinitions { * @example * await client.merchants.customAttributeDefinitions.update({ * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * description: "Update the description as desired.", * visibility: "VISIBILITY_READ_ONLY" * } * }) */ - public async update( + public update( + request: Square.merchants.UpdateMerchantCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.merchants.UpdateMerchantCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.merchants.UpdateMerchantCustomAttributeDefinitionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateMerchantCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -389,6 +394,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -397,6 +403,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -415,50 +422,50 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async delete( + public delete( + request: Square.merchants.DeleteCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.merchants.DeleteCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteMerchantCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -467,6 +474,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -475,6 +483,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/index.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts index 023957369..05b8f3542 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "alternative_seller_name", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" @@ -26,10 +26,10 @@ export interface CreateMerchantCustomAttributeDefinitionRequest { * [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; + custom_attribute_definition: 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; + idempotency_key?: string; } diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts index 313ea4854..e4fb2f3be 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -12,7 +12,7 @@ export interface ListCustomAttributeDefinitionsRequest { /** * Filters the `CustomAttributeDefinition` results by their `visibility` values. */ - visibilityFilter?: Square.VisibilityFilter | null; + visibility_filter?: 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. diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts index 16bfd1215..7461ce2fc 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * description: "Update the description as desired.", * visibility: "VISIBILITY_READ_ONLY" * } @@ -34,10 +34,10 @@ export interface UpdateMerchantCustomAttributeDefinitionRequest { * [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; + custom_attribute_definition: 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; + idempotency_key?: 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 index eb8078803..01dc038ab 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest"; -export { type CreateMerchantCustomAttributeDefinitionRequest } from "./CreateMerchantCustomAttributeDefinitionRequest"; -export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest"; -export { type UpdateMerchantCustomAttributeDefinitionRequest } from "./UpdateMerchantCustomAttributeDefinitionRequest"; -export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest"; +export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest.js"; +export { type CreateMerchantCustomAttributeDefinitionRequest } from "./CreateMerchantCustomAttributeDefinitionRequest.js"; +export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest.js"; +export { type UpdateMerchantCustomAttributeDefinitionRequest } from "./UpdateMerchantCustomAttributeDefinitionRequest.js"; +export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest.js"; diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/index.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/index.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/merchants/resources/customAttributes/client/Client.ts b/src/api/resources/merchants/resources/customAttributes/client/Client.ts index a65584f2b..b3ee15094 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/Client.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributes { - constructor(protected readonly _options: CustomAttributes.Options = {}) {} + protected readonly _options: CustomAttributes.Options; + + constructor(_options: CustomAttributes.Options = {}) { + this._options = _options; + } /** * Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. @@ -57,53 +62,52 @@ export class CustomAttributes { * } * }) */ - public async batchDelete( + public batchDelete( request: Square.merchants.BulkDeleteMerchantCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchDelete(request, requestOptions)); + } + + private async __batchDelete( + request: Square.merchants.BulkDeleteMerchantCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.merchants.BulkDeleteMerchantCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkDeleteMerchantCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -112,6 +116,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -120,6 +125,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -143,15 +149,15 @@ export class CustomAttributes { * await client.merchants.customAttributes.batchUpsert({ * values: { * "id1": { - * merchantId: "DM7VKY8Q63GNP", - * customAttribute: { + * merchant_id: "DM7VKY8Q63GNP", + * custom_attribute: { * key: "alternative_seller_name", * value: "Ultimate Sneaker Store" * } * }, * "id2": { - * merchantId: "DM7VKY8Q63GNP", - * customAttribute: { + * merchant_id: "DM7VKY8Q63GNP", + * custom_attribute: { * key: "has_seen_tutorial", * value: true * } @@ -159,53 +165,52 @@ export class CustomAttributes { * } * }) */ - public async batchUpsert( + public batchUpsert( + request: Square.merchants.BulkUpsertMerchantCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpsert(request, requestOptions)); + } + + private async __batchUpsert( request: Square.merchants.BulkUpsertMerchantCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.merchants.BulkUpsertMerchantCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkUpsertMerchantCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -214,6 +219,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -222,6 +228,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -239,94 +246,98 @@ export class CustomAttributes { * * @example * await client.merchants.customAttributes.list({ - * merchantId: "merchant_id" + * merchant_id: "merchant_id" * }) */ public async list( request: Square.merchants.ListCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, ): Promise> { - const list = async ( - request: Square.merchants.ListCustomAttributesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.merchants.ListCustomAttributesRequest, + ): Promise> => { + const { + merchant_id: merchantId, + visibility_filter: visibilityFilter, + limit, + cursor, + with_definitions: withDefinitions, + } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = visibilityFilter; + } + 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListMerchantCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributes ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attributes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -345,15 +356,22 @@ export class CustomAttributes { * * @example * await client.merchants.customAttributes.get({ - * merchantId: "merchant_id", + * merchant_id: "merchant_id", * key: "key" * }) */ - public async get( + public get( request: Square.merchants.GetCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { merchantId, key, withDefinition, version } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.merchants.GetCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { merchant_id: merchantId, key, with_definition: withDefinition, version } = request; const _queryParams: Record = {}; if (withDefinition !== undefined) { _queryParams["with_definition"] = withDefinition?.toString() ?? null; @@ -364,45 +382,38 @@ export class CustomAttributes { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveMerchantCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -411,6 +422,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -419,6 +431,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -436,61 +449,60 @@ export class CustomAttributes { * * @example * await client.merchants.customAttributes.upsert({ - * merchantId: "merchant_id", + * merchant_id: "merchant_id", * key: "key", - * customAttribute: { + * custom_attribute: { * value: "Ultimate Sneaker Store" * } * }) */ - public async upsert( + public upsert( request: Square.merchants.UpsertMerchantCustomAttributeRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { merchantId, key, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions)); + } + + private async __upsert( + request: Square.merchants.UpsertMerchantCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { merchant_id: merchantId, key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.merchants.UpsertMerchantCustomAttributeRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpsertMerchantCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -499,6 +511,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -507,6 +520,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -521,54 +535,54 @@ export class CustomAttributes { * * @example * await client.merchants.customAttributes.delete({ - * merchantId: "merchant_id", + * merchant_id: "merchant_id", * key: "key" * }) */ - public async delete( + public delete( + request: Square.merchants.DeleteCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.merchants.DeleteCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { merchantId, key } = request; + ): Promise> { + const { merchant_id: merchantId, key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteMerchantCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -577,6 +591,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -585,6 +600,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/merchants/resources/customAttributes/client/index.ts b/src/api/resources/merchants/resources/customAttributes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/index.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts index 08cb2ddaf..0d52e952e 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts index 2c267173d..1fbb31afe 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * values: { * "id1": { - * merchantId: "DM7VKY8Q63GNP", - * customAttribute: { + * merchant_id: "DM7VKY8Q63GNP", + * custom_attribute: { * key: "alternative_seller_name", * value: "Ultimate Sneaker Store" * } * }, * "id2": { - * merchantId: "DM7VKY8Q63GNP", - * customAttribute: { + * merchant_id: "DM7VKY8Q63GNP", + * custom_attribute: { * key: "has_seen_tutorial", * value: true * } diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts index ad30e0e56..fab446031 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * merchantId: "merchant_id", + * merchant_id: "merchant_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface DeleteCustomAttributesRequest { /** * The ID of the target [merchant](entity:Merchant). */ - merchantId: string; + merchant_id: 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 diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts index b2a5f6471..d15cbadea 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * merchantId: "merchant_id", + * merchant_id: "merchant_id", * key: "key" * } */ @@ -13,7 +13,7 @@ export interface GetCustomAttributesRequest { /** * The ID of the target [merchant](entity:Merchant). */ - merchantId: string; + merchant_id: 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 @@ -25,7 +25,7 @@ export interface GetCustomAttributesRequest { * 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; + with_definition?: 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 diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts index 0a4615f85..ba2fc3121 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * merchantId: "merchant_id" + * merchant_id: "merchant_id" * } */ export interface ListCustomAttributesRequest { /** * The ID of the target [merchant](entity:Merchant). */ - merchantId: string; + merchant_id: string; /** * Filters the `CustomAttributeDefinition` results by their `visibility` values. */ - visibilityFilter?: Square.VisibilityFilter | null; + visibility_filter?: 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. @@ -36,5 +36,5 @@ export interface ListCustomAttributesRequest { * 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; + with_definitions?: 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 index b798742bf..84a5b6ec9 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * merchantId: "merchant_id", + * merchant_id: "merchant_id", * key: "key", - * customAttribute: { + * custom_attribute: { * value: "Ultimate Sneaker Store" * } * } @@ -18,7 +18,7 @@ export interface UpsertMerchantCustomAttributeRequest { /** * The ID of the target [merchant](entity:Merchant). */ - merchantId: string; + merchant_id: 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 @@ -33,10 +33,10 @@ export interface UpsertMerchantCustomAttributeRequest { * [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; + custom_attribute: 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; + idempotency_key?: 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 index 0f91a2b02..9cabfaf61 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/index.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type BulkDeleteMerchantCustomAttributesRequest } from "./BulkDeleteMerchantCustomAttributesRequest"; -export { type BulkUpsertMerchantCustomAttributesRequest } from "./BulkUpsertMerchantCustomAttributesRequest"; -export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest"; -export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest"; -export { type UpsertMerchantCustomAttributeRequest } from "./UpsertMerchantCustomAttributeRequest"; -export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest"; +export { type BulkDeleteMerchantCustomAttributesRequest } from "./BulkDeleteMerchantCustomAttributesRequest.js"; +export { type BulkUpsertMerchantCustomAttributesRequest } from "./BulkUpsertMerchantCustomAttributesRequest.js"; +export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest.js"; +export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest.js"; +export { type UpsertMerchantCustomAttributeRequest } from "./UpsertMerchantCustomAttributeRequest.js"; +export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest.js"; diff --git a/src/api/resources/merchants/resources/customAttributes/index.ts b/src/api/resources/merchants/resources/customAttributes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/merchants/resources/customAttributes/index.ts +++ b/src/api/resources/merchants/resources/customAttributes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/merchants/resources/index.ts b/src/api/resources/merchants/resources/index.ts index bfa7c90b7..72d9ddae6 100644 --- a/src/api/resources/merchants/resources/index.ts +++ b/src/api/resources/merchants/resources/index.ts @@ -1,4 +1,4 @@ -export * as customAttributeDefinitions from "./customAttributeDefinitions"; -export * as customAttributes from "./customAttributes"; -export * from "./customAttributeDefinitions/client/requests"; -export * from "./customAttributes/client/requests"; +export * as customAttributeDefinitions from "./customAttributeDefinitions/index.js"; +export * as customAttributes from "./customAttributes/index.js"; +export * from "./customAttributeDefinitions/client/requests/index.js"; +export * from "./customAttributes/client/requests/index.js"; diff --git a/src/api/resources/mobile/client/Client.ts b/src/api/resources/mobile/client/Client.ts index 2bf815085..b891acc3c 100644 --- a/src/api/resources/mobile/client/Client.ts +++ b/src/api/resources/mobile/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Mobile { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Mobile { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Mobile { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Mobile { - constructor(protected readonly _options: Mobile.Options = {}) {} + protected readonly _options: Mobile.Options; + + constructor(_options: Mobile.Options = {}) { + this._options = _options; + } /** * __Note:__ This endpoint is used by the deprecated Reader SDK. @@ -59,56 +64,55 @@ export class Mobile { * * @example * await client.mobile.authorizationCode({ - * locationId: "YOUR_LOCATION_ID" + * location_id: "YOUR_LOCATION_ID" * }) */ - public async authorizationCode( + public authorizationCode( + request: Square.CreateMobileAuthorizationCodeRequest = {}, + requestOptions?: Mobile.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__authorizationCode(request, requestOptions)); + } + + private async __authorizationCode( request: Square.CreateMobileAuthorizationCodeRequest = {}, requestOptions?: Mobile.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateMobileAuthorizationCodeRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateMobileAuthorizationCodeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -117,12 +121,14 @@ export class Mobile { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /mobile/authorization-code."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/mobile/client/index.ts b/src/api/resources/mobile/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/mobile/client/index.ts +++ b/src/api/resources/mobile/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts b/src/api/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts index 3620d5786..ca78705b7 100644 --- a/src/api/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts +++ b/src/api/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * locationId: "YOUR_LOCATION_ID" + * location_id: "YOUR_LOCATION_ID" * } */ export interface CreateMobileAuthorizationCodeRequest { /** The Square location ID that the authorization code should be tied to. */ - locationId?: string; + location_id?: string; } diff --git a/src/api/resources/mobile/client/requests/index.ts b/src/api/resources/mobile/client/requests/index.ts index 1d310fdf0..e45a42fee 100644 --- a/src/api/resources/mobile/client/requests/index.ts +++ b/src/api/resources/mobile/client/requests/index.ts @@ -1 +1 @@ -export { type CreateMobileAuthorizationCodeRequest } from "./CreateMobileAuthorizationCodeRequest"; +export { type CreateMobileAuthorizationCodeRequest } from "./CreateMobileAuthorizationCodeRequest.js"; diff --git a/src/api/resources/mobile/index.ts b/src/api/resources/mobile/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/mobile/index.ts +++ b/src/api/resources/mobile/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/oAuth/client/Client.ts b/src/api/resources/oAuth/client/Client.ts index 780776144..a4cf79ad4 100644 --- a/src/api/resources/oAuth/client/Client.ts +++ b/src/api/resources/oAuth/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace OAuth { export interface Options { @@ -17,6 +16,8 @@ export declare namespace OAuth { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace OAuth { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class OAuth { - constructor(protected readonly _options: OAuth.Options = {}) {} + protected readonly _options: OAuth.Options; + + constructor(_options: OAuth.Options = {}) { + this._options = _options; + } /** * Revokes an access token generated with the OAuth flow. @@ -58,57 +63,53 @@ export class OAuth { * * @example * await client.oAuth.revokeToken({ - * clientId: "CLIENT_ID", - * accessToken: "ACCESS_TOKEN" + * client_id: "CLIENT_ID", + * access_token: "ACCESS_TOKEN" * }) */ - public async revokeToken( + public revokeToken( request: Square.RevokeTokenRequest = {}, requestOptions?: OAuth.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__revokeToken(request, requestOptions)); + } + + private async __revokeToken( + request: Square.RevokeTokenRequest = {}, + requestOptions?: OAuth.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.RevokeTokenRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.RevokeTokenResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -117,12 +118,14 @@ export class OAuth { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /oauth2/revoke."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -155,59 +158,55 @@ export class OAuth { * * @example * await client.oAuth.obtainToken({ - * clientId: "sq0idp-uaPHILoPzWZk3tlJqlML0g", - * clientSecret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", + * client_id: "sq0idp-uaPHILoPzWZk3tlJqlML0g", + * client_secret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", * code: "sq0cgb-l0SBqxs4uwxErTVyYOdemg", - * grantType: "authorization_code" + * grant_type: "authorization_code" * }) */ - public async obtainToken( + public obtainToken( + request: Square.ObtainTokenRequest, + requestOptions?: OAuth.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__obtainToken(request, requestOptions)); + } + + private async __obtainToken( request: Square.ObtainTokenRequest, requestOptions?: OAuth.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.ObtainTokenRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.ObtainTokenResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -216,12 +215,14 @@ export class OAuth { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /oauth2/token."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -247,48 +248,44 @@ export class OAuth { * @example * await client.oAuth.retrieveTokenStatus() */ - public async retrieveTokenStatus( + public retrieveTokenStatus( + requestOptions?: OAuth.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveTokenStatus(requestOptions)); + } + + private async __retrieveTokenStatus( requestOptions?: OAuth.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.RetrieveTokenStatusResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -297,12 +294,14 @@ export class OAuth { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /oauth2/token/status."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -313,40 +312,40 @@ export class OAuth { * @example * await client.oAuth.authorize() */ - public async authorize(requestOptions?: OAuth.RequestOptions): Promise { + public authorize(requestOptions?: OAuth.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__authorize(requestOptions)); + } + + private async __authorize(requestOptions?: OAuth.RequestOptions): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return; + return { data: undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -355,12 +354,14 @@ export class OAuth { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /oauth2/authorize."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/oAuth/client/index.ts b/src/api/resources/oAuth/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/oAuth/client/index.ts +++ b/src/api/resources/oAuth/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/oAuth/client/requests/ObtainTokenRequest.ts b/src/api/resources/oAuth/client/requests/ObtainTokenRequest.ts index 3d744b592..0e75ef6b9 100644 --- a/src/api/resources/oAuth/client/requests/ObtainTokenRequest.ts +++ b/src/api/resources/oAuth/client/requests/ObtainTokenRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * clientId: "sq0idp-uaPHILoPzWZk3tlJqlML0g", - * clientSecret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", + * client_id: "sq0idp-uaPHILoPzWZk3tlJqlML0g", + * client_secret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", * code: "sq0cgb-l0SBqxs4uwxErTVyYOdemg", - * grantType: "authorization_code" + * grant_type: "authorization_code" * } */ export interface ObtainTokenRequest { @@ -18,7 +18,7 @@ export interface ObtainTokenRequest { * * Required for the code flow and PKCE flow for any grant type. */ - clientId: string; + client_id: string; /** * The secret key for your application, which is available as the **Application secret** * on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps). @@ -26,7 +26,7 @@ export interface ObtainTokenRequest { * Required for the code flow for any grant type. Don't confuse your client secret with your * personal access token. */ - clientSecret?: string | null; + client_secret?: string | null; /** * The authorization code to exchange for an OAuth access token. This is the `code` * value that Square sent to your redirect URL in the authorization response. @@ -41,7 +41,7 @@ export interface ObtainTokenRequest { * Required for the code flow and PKCE flow if `grant_type` is `authorization_code` and * you provided the `redirect_uri` parameter in your authorization URL. */ - redirectUri?: string | null; + redirect_uri?: string | null; /** * The method used to obtain an OAuth access token. The request must include the * credential that corresponds to the specified grant type. Valid values are: @@ -50,14 +50,14 @@ export interface ObtainTokenRequest { * - `migration_token` - LEGACY for access tokens obtained using a Square API version prior * to 2019-03-13. Requires the `migration_token` field. */ - grantType: string; + grant_type: string; /** * A valid refresh token used to generate a new OAuth access token. This is a * refresh token that was returned in a previous `ObtainToken` response. * * Required for the code flow and PKCE flow if `grant_type` is `refresh_token`. */ - refreshToken?: string | null; + refresh_token?: string | null; /** * __LEGACY__ A valid access token (obtained using a Square API version prior to 2019-03-13) * used to generate a new OAuth access token. @@ -65,7 +65,7 @@ export interface ObtainTokenRequest { * Required if `grant_type` is `migration_token`. For more information, see * [Migrate to Using Refresh Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens). */ - migrationToken?: string | null; + migration_token?: string | null; /** * The list of permissions that are explicitly requested for the access token. * For example, ["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"]. @@ -81,7 +81,7 @@ export interface ObtainTokenRequest { * * Optional for the code flow and PKCE flow for any grant type. The default value is `false`. */ - shortLived?: boolean | null; + short_lived?: boolean | null; /** * The secret your application generated for the authorization request used to * obtain the authorization code. This is the source of the `code_challenge` hash you @@ -89,5 +89,5 @@ export interface ObtainTokenRequest { * * Required for the PKCE flow if `grant_type` is `authorization_code`. */ - codeVerifier?: string | null; + code_verifier?: string | null; } diff --git a/src/api/resources/oAuth/client/requests/RevokeTokenRequest.ts b/src/api/resources/oAuth/client/requests/RevokeTokenRequest.ts index 206891192..4bc2f56c8 100644 --- a/src/api/resources/oAuth/client/requests/RevokeTokenRequest.ts +++ b/src/api/resources/oAuth/client/requests/RevokeTokenRequest.ts @@ -5,8 +5,8 @@ /** * @example * { - * clientId: "CLIENT_ID", - * accessToken: "ACCESS_TOKEN" + * client_id: "CLIENT_ID", + * access_token: "ACCESS_TOKEN" * } */ export interface RevokeTokenRequest { @@ -14,21 +14,21 @@ 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; + client_id?: 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; + access_token?: 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; + merchant_id?: string | null; /** * If `true`, terminate the given single access token, but do not * terminate the entire authorization. * Default: `false` */ - revokeOnlyAccessToken?: boolean | null; + revoke_only_access_token?: boolean | null; } diff --git a/src/api/resources/oAuth/client/requests/index.ts b/src/api/resources/oAuth/client/requests/index.ts index b92160be5..af95f6c5c 100644 --- a/src/api/resources/oAuth/client/requests/index.ts +++ b/src/api/resources/oAuth/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type RevokeTokenRequest } from "./RevokeTokenRequest"; -export { type ObtainTokenRequest } from "./ObtainTokenRequest"; +export { type RevokeTokenRequest } from "./RevokeTokenRequest.js"; +export { type ObtainTokenRequest } from "./ObtainTokenRequest.js"; diff --git a/src/api/resources/oAuth/index.ts b/src/api/resources/oAuth/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/oAuth/index.ts +++ b/src/api/resources/oAuth/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/orders/client/Client.ts b/src/api/resources/orders/client/Client.ts index 573bb05a3..c4713f678 100644 --- a/src/api/resources/orders/client/Client.ts +++ b/src/api/resources/orders/client/Client.ts @@ -2,14 +2,13 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client.js"; +import { CustomAttributes } from "../resources/customAttributes/client/Client.js"; export declare namespace Orders { export interface Options { @@ -19,6 +18,8 @@ export declare namespace Orders { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -32,15 +33,18 @@ export declare namespace Orders { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Orders { + protected readonly _options: Orders.Options; protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; protected _customAttributes: CustomAttributes | undefined; - constructor(protected readonly _options: Orders.Options = {}) {} + constructor(_options: Orders.Options = {}) { + this._options = _options; + } public get customAttributeDefinitions(): CustomAttributeDefinitions { return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); @@ -65,23 +69,23 @@ export class Orders { * @example * await client.orders.create({ * order: { - * locationId: "057P5VYJ4A5X1", - * referenceId: "my-order-001", - * lineItems: [{ + * location_id: "057P5VYJ4A5X1", + * reference_id: "my-order-001", + * line_items: [{ * name: "New York Strip Steak", * quantity: "1", - * basePriceMoney: { - * amount: 1599, + * base_price_money: { + * amount: BigInt("1599"), * currency: "USD" * } * }, { * quantity: "2", - * catalogObjectId: "BEMYCSMIJL46OCDV4KYIKXIB", + * catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", * modifiers: [{ - * catalogObjectId: "CHQX7Y4KY6N5KINJKZCFURPZ" + * catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ" * }], - * appliedDiscounts: [{ - * discountUid: "one-dollar-off" + * applied_discounts: [{ + * discount_uid: "one-dollar-off" * }] * }], * taxes: [{ @@ -97,68 +101,64 @@ export class Orders { * scope: "ORDER" * }, { * uid: "membership-discount", - * catalogObjectId: "DB7L55ZH2BGWI4H23ULIWOQ7", + * catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", * scope: "ORDER" * }, { * uid: "one-dollar-off", * name: "Sale - $1.00 off", - * amountMoney: { - * amount: 100, + * amount_money: { + * amount: BigInt("100"), * currency: "USD" * }, * scope: "LINE_ITEM" * }] * }, - * idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf" + * idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf" * }) */ - public async create( + public create( request: Square.CreateOrderRequest, requestOptions?: Orders.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.CreateOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateOrderRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateOrderResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -167,12 +167,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -187,57 +189,53 @@ export class Orders { * * @example * await client.orders.batchGet({ - * locationId: "057P5VYJ4A5X1", - * orderIds: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"] + * location_id: "057P5VYJ4A5X1", + * order_ids: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"] * }) */ - public async batchGet( + public batchGet( request: Square.BatchGetOrdersRequest, requestOptions?: Orders.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchGet(request, requestOptions)); + } + + private async __batchGet( + request: Square.BatchGetOrdersRequest, + requestOptions?: Orders.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchGetOrdersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BatchGetOrdersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -246,12 +244,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -265,19 +265,19 @@ export class Orders { * @example * await client.orders.calculate({ * order: { - * locationId: "D7AVYMEAPJ3A3", - * lineItems: [{ + * location_id: "D7AVYMEAPJ3A3", + * line_items: [{ * name: "Item 1", * quantity: "1", - * basePriceMoney: { - * amount: 500, + * base_price_money: { + * amount: BigInt("500"), * currency: "USD" * } * }, { * name: "Item 2", * quantity: "2", - * basePriceMoney: { - * amount: 300, + * base_price_money: { + * amount: BigInt("300"), * currency: "USD" * } * }], @@ -289,53 +289,49 @@ export class Orders { * } * }) */ - public async calculate( + public calculate( request: Square.CalculateOrderRequest, requestOptions?: Orders.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__calculate(request, requestOptions)); + } + + private async __calculate( + request: Square.CalculateOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CalculateOrderRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CalculateOrderResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -344,12 +340,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/calculate."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -363,58 +361,54 @@ export class Orders { * * @example * await client.orders.clone({ - * orderId: "ZAISEM52YcpmcWAzERDOyiWS123", + * order_id: "ZAISEM52YcpmcWAzERDOyiWS123", * version: 3, - * idempotencyKey: "UNIQUE_STRING" + * idempotency_key: "UNIQUE_STRING" * }) */ - public async clone( + public clone( request: Square.CloneOrderRequest, requestOptions?: Orders.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__clone(request, requestOptions)); + } + + private async __clone( + request: Square.CloneOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CloneOrderRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CloneOrderResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -423,12 +417,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/clone."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -457,75 +453,71 @@ export class Orders { * * @example * await client.orders.search({ - * locationIds: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], + * location_ids: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], * query: { * filter: { - * stateFilter: { + * state_filter: { * states: ["COMPLETED"] * }, - * dateTimeFilter: { - * closedAt: { - * startAt: "2018-03-03T20:00:00+00:00", - * endAt: "2019-03-04T21:54:45+00:00" + * date_time_filter: { + * closed_at: { + * start_at: "2018-03-03T20:00:00+00:00", + * end_at: "2019-03-04T21:54:45+00:00" * } * } * }, * sort: { - * sortField: "CLOSED_AT", - * sortOrder: "DESC" + * sort_field: "CLOSED_AT", + * sort_order: "DESC" * } * }, * limit: 3, - * returnEntries: true + * return_entries: true * }) */ - public async search( + public search( request: Square.SearchOrdersRequest = {}, requestOptions?: Orders.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.SearchOrdersRequest = {}, + requestOptions?: Orders.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchOrdersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchOrdersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -534,12 +526,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/search."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -552,53 +546,50 @@ export class Orders { * * @example * await client.orders.get({ - * orderId: "order_id" + * order_id: "order_id" * }) */ - public async get( + public get( request: Square.GetOrdersRequest, requestOptions?: Orders.RequestOptions, - ): Promise { - const { orderId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetOrdersRequest, + requestOptions?: Orders.RequestOptions, + ): Promise> { + const { order_id: orderId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetOrderResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -607,12 +598,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -639,72 +632,68 @@ export class Orders { * * @example * await client.orders.update({ - * orderId: "order_id", + * order_id: "order_id", * order: { - * locationId: "location_id", - * lineItems: [{ + * location_id: "location_id", + * line_items: [{ * uid: "cookie_uid", * name: "COOKIE", * quantity: "2", - * basePriceMoney: { - * amount: 200, + * base_price_money: { + * amount: BigInt("200"), * currency: "USD" * } * }], * version: 1 * }, - * fieldsToClear: ["discounts"], - * idempotencyKey: "UNIQUE_STRING" + * fields_to_clear: ["discounts"], + * idempotency_key: "UNIQUE_STRING" * }) */ - public async update( + public update( request: Square.UpdateOrderRequest, requestOptions?: Orders.RequestOptions, - ): Promise { - const { orderId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.UpdateOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise> { + const { order_id: orderId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateOrderRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateOrderResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -713,12 +702,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -744,59 +735,55 @@ export class Orders { * * @example * await client.orders.pay({ - * orderId: "order_id", - * idempotencyKey: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", - * paymentIds: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"] + * order_id: "order_id", + * idempotency_key: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + * payment_ids: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"] * }) */ - public async pay( + public pay( request: Square.PayOrderRequest, requestOptions?: Orders.RequestOptions, - ): Promise { - const { orderId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__pay(request, requestOptions)); + } + + private async __pay( + request: Square.PayOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise> { + const { order_id: orderId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.PayOrderRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.PayOrderResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -805,12 +792,14 @@ export class Orders { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/orders/client/index.ts b/src/api/resources/orders/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/orders/client/index.ts +++ b/src/api/resources/orders/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/orders/client/requests/BatchGetOrdersRequest.ts b/src/api/resources/orders/client/requests/BatchGetOrdersRequest.ts index 96c31a8df..2d8a1acad 100644 --- a/src/api/resources/orders/client/requests/BatchGetOrdersRequest.ts +++ b/src/api/resources/orders/client/requests/BatchGetOrdersRequest.ts @@ -5,8 +5,8 @@ /** * @example * { - * locationId: "057P5VYJ4A5X1", - * orderIds: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"] + * location_id: "057P5VYJ4A5X1", + * order_ids: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"] * } */ export interface BatchGetOrdersRequest { @@ -14,7 +14,7 @@ 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; + location_id?: string | null; /** The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request. */ - orderIds: string[]; + order_ids: string[]; } diff --git a/src/api/resources/orders/client/requests/CalculateOrderRequest.ts b/src/api/resources/orders/client/requests/CalculateOrderRequest.ts index 416893d0b..e4dbe591f 100644 --- a/src/api/resources/orders/client/requests/CalculateOrderRequest.ts +++ b/src/api/resources/orders/client/requests/CalculateOrderRequest.ts @@ -2,25 +2,25 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * order: { - * locationId: "D7AVYMEAPJ3A3", - * lineItems: [{ + * location_id: "D7AVYMEAPJ3A3", + * line_items: [{ * name: "Item 1", * quantity: "1", - * basePriceMoney: { - * amount: 500, + * base_price_money: { + * amount: BigInt("500"), * currency: "USD" * } * }, { * name: "Item 2", * quantity: "2", - * basePriceMoney: { - * amount: 300, + * base_price_money: { + * amount: BigInt("300"), * currency: "USD" * } * }], @@ -42,5 +42,5 @@ export interface CalculateOrderRequest { * 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; + proposed_rewards?: Square.OrderReward[] | null; } diff --git a/src/api/resources/orders/client/requests/CloneOrderRequest.ts b/src/api/resources/orders/client/requests/CloneOrderRequest.ts index e246451d0..f78f9d7ec 100644 --- a/src/api/resources/orders/client/requests/CloneOrderRequest.ts +++ b/src/api/resources/orders/client/requests/CloneOrderRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * orderId: "ZAISEM52YcpmcWAzERDOyiWS123", + * order_id: "ZAISEM52YcpmcWAzERDOyiWS123", * version: 3, - * idempotencyKey: "UNIQUE_STRING" + * idempotency_key: "UNIQUE_STRING" * } */ export interface CloneOrderRequest { /** The ID of the order to clone. */ - orderId: string; + order_id: string; /** * An optional order version for concurrency protection. * @@ -30,5 +30,5 @@ export interface CloneOrderRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string | null; + idempotency_key?: string | null; } diff --git a/src/api/resources/orders/client/requests/GetOrdersRequest.ts b/src/api/resources/orders/client/requests/GetOrdersRequest.ts index 9d225211b..92a78b180 100644 --- a/src/api/resources/orders/client/requests/GetOrdersRequest.ts +++ b/src/api/resources/orders/client/requests/GetOrdersRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * orderId: "order_id" + * order_id: "order_id" * } */ export interface GetOrdersRequest { /** * The ID of the order to retrieve. */ - orderId: string; + order_id: string; } diff --git a/src/api/resources/orders/client/requests/PayOrderRequest.ts b/src/api/resources/orders/client/requests/PayOrderRequest.ts index 3d74c7950..34042c66d 100644 --- a/src/api/resources/orders/client/requests/PayOrderRequest.ts +++ b/src/api/resources/orders/client/requests/PayOrderRequest.ts @@ -5,16 +5,16 @@ /** * @example * { - * orderId: "order_id", - * idempotencyKey: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", - * paymentIds: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"] + * order_id: "order_id", + * idempotency_key: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + * payment_ids: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"] * } */ export interface PayOrderRequest { /** * The ID of the order being paid. */ - orderId: string; + order_id: 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 @@ -22,12 +22,12 @@ export interface PayOrderRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; + idempotency_key: string; /** The version of the order being paid. If not supplied, the latest version will be paid. */ - orderVersion?: number | null; + order_version?: number | null; /** * The IDs of the [payments](entity:Payment) to collect. * The payment total must match the order total. */ - paymentIds?: string[] | null; + payment_ids?: string[] | null; } diff --git a/src/api/resources/orders/client/requests/SearchOrdersRequest.ts b/src/api/resources/orders/client/requests/SearchOrdersRequest.ts index 5313f9d5d..d155a413e 100644 --- a/src/api/resources/orders/client/requests/SearchOrdersRequest.ts +++ b/src/api/resources/orders/client/requests/SearchOrdersRequest.ts @@ -2,31 +2,31 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * locationIds: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], + * location_ids: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], * query: { * filter: { - * stateFilter: { + * state_filter: { * states: ["COMPLETED"] * }, - * dateTimeFilter: { - * closedAt: { - * startAt: "2018-03-03T20:00:00+00:00", - * endAt: "2019-03-04T21:54:45+00:00" + * date_time_filter: { + * closed_at: { + * start_at: "2018-03-03T20:00:00+00:00", + * end_at: "2019-03-04T21:54:45+00:00" * } * } * }, * sort: { - * sortField: "CLOSED_AT", - * sortOrder: "DESC" + * sort_field: "CLOSED_AT", + * sort_order: "DESC" * } * }, * limit: 3, - * returnEntries: true + * return_entries: true * } */ export interface SearchOrdersRequest { @@ -36,7 +36,7 @@ export interface SearchOrdersRequest { * * Max: 10 location IDs. */ - locationIds?: string[]; + location_ids?: 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. @@ -62,5 +62,5 @@ export interface SearchOrdersRequest { * * Default: `false`. */ - returnEntries?: boolean; + return_entries?: boolean; } diff --git a/src/api/resources/orders/client/requests/UpdateOrderRequest.ts b/src/api/resources/orders/client/requests/UpdateOrderRequest.ts index ae35505ad..b3959db49 100644 --- a/src/api/resources/orders/client/requests/UpdateOrderRequest.ts +++ b/src/api/resources/orders/client/requests/UpdateOrderRequest.ts @@ -2,34 +2,34 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * orderId: "order_id", + * order_id: "order_id", * order: { - * locationId: "location_id", - * lineItems: [{ + * location_id: "location_id", + * line_items: [{ * uid: "cookie_uid", * name: "COOKIE", * quantity: "2", - * basePriceMoney: { - * amount: 200, + * base_price_money: { + * amount: BigInt("200"), * currency: "USD" * } * }], * version: 1 * }, - * fieldsToClear: ["discounts"], - * idempotencyKey: "UNIQUE_STRING" + * fields_to_clear: ["discounts"], + * idempotency_key: "UNIQUE_STRING" * } */ export interface UpdateOrderRequest { /** * The ID of the order to update. */ - orderId: string; + order_id: 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 @@ -41,7 +41,7 @@ export interface UpdateOrderRequest { * 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; + fields_to_clear?: string[] | null; /** * A value you specify that uniquely identifies this update request. * @@ -52,5 +52,5 @@ export interface UpdateOrderRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string | null; + idempotency_key?: string | null; } diff --git a/src/api/resources/orders/client/requests/index.ts b/src/api/resources/orders/client/requests/index.ts index f9f9976ef..1aed4cffb 100644 --- a/src/api/resources/orders/client/requests/index.ts +++ b/src/api/resources/orders/client/requests/index.ts @@ -1,7 +1,7 @@ -export { type BatchGetOrdersRequest } from "./BatchGetOrdersRequest"; -export { type CalculateOrderRequest } from "./CalculateOrderRequest"; -export { type CloneOrderRequest } from "./CloneOrderRequest"; -export { type SearchOrdersRequest } from "./SearchOrdersRequest"; -export { type GetOrdersRequest } from "./GetOrdersRequest"; -export { type UpdateOrderRequest } from "./UpdateOrderRequest"; -export { type PayOrderRequest } from "./PayOrderRequest"; +export { type BatchGetOrdersRequest } from "./BatchGetOrdersRequest.js"; +export { type CalculateOrderRequest } from "./CalculateOrderRequest.js"; +export { type CloneOrderRequest } from "./CloneOrderRequest.js"; +export { type SearchOrdersRequest } from "./SearchOrdersRequest.js"; +export { type GetOrdersRequest } from "./GetOrdersRequest.js"; +export { type UpdateOrderRequest } from "./UpdateOrderRequest.js"; +export { type PayOrderRequest } from "./PayOrderRequest.js"; diff --git a/src/api/resources/orders/index.ts b/src/api/resources/orders/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/orders/index.ts +++ b/src/api/resources/orders/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts index 37644f68d..20a8c9af5 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributeDefinitions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributeDefinitions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributeDefinitions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributeDefinitions { - constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + protected readonly _options: CustomAttributeDefinitions.Options; + + constructor(_options: CustomAttributeDefinitions.Options = {}) { + this._options = _options; + } /** * Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. @@ -55,84 +60,82 @@ export class CustomAttributeDefinitions { request: Square.orders.ListCustomAttributeDefinitionsRequest = {}, requestOptions?: CustomAttributeDefinitions.RequestOptions, ): Promise> { - const list = async ( - request: Square.orders.ListCustomAttributeDefinitionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.orders.ListCustomAttributeDefinitionsRequest, + ): Promise> => { + const { visibility_filter: visibilityFilter, cursor, limit } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = visibilityFilter; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListOrderCustomAttributeDefinitionsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributeDefinitions ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attribute_definitions ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -151,7 +154,7 @@ export class CustomAttributeDefinitions { * * @example * await client.orders.customAttributeDefinitions.create({ - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "cover-count", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number" @@ -160,56 +163,55 @@ export class CustomAttributeDefinitions { * description: "The number of people seated at a table", * visibility: "VISIBILITY_READ_WRITE_VALUES" * }, - * idempotencyKey: "IDEMPOTENCY_KEY" + * idempotency_key: "IDEMPOTENCY_KEY" * }) */ - public async create( + public create( + request: Square.orders.CreateOrderCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.orders.CreateOrderCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.orders.CreateOrderCustomAttributeDefinitionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateOrderCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -218,6 +220,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -226,6 +229,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -245,10 +249,17 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async get( + public get( + request: Square.orders.GetCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.orders.GetCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key, version } = request; const _queryParams: Record = {}; if (version !== undefined) { @@ -256,45 +267,38 @@ export class CustomAttributeDefinitions { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveOrderCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -303,6 +307,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -311,6 +316,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -326,62 +332,61 @@ export class CustomAttributeDefinitions { * @example * await client.orders.customAttributeDefinitions.update({ * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "cover-count", * visibility: "VISIBILITY_READ_ONLY", * version: 1 * }, - * idempotencyKey: "IDEMPOTENCY_KEY" + * idempotency_key: "IDEMPOTENCY_KEY" * }) */ - public async update( + public update( + request: Square.orders.UpdateOrderCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.orders.UpdateOrderCustomAttributeDefinitionRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.orders.UpdateOrderCustomAttributeDefinitionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateOrderCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -390,6 +395,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -398,6 +404,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -415,50 +422,50 @@ export class CustomAttributeDefinitions { * key: "key" * }) */ - public async delete( + public delete( + request: Square.orders.DeleteCustomAttributeDefinitionsRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.orders.DeleteCustomAttributeDefinitionsRequest, requestOptions?: CustomAttributeDefinitions.RequestOptions, - ): Promise { + ): Promise> { const { key } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteOrderCustomAttributeDefinitionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -467,6 +474,7 @@ export class CustomAttributeDefinitions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -475,6 +483,7 @@ export class CustomAttributeDefinitions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/index.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts index 7dd420311..ccb4fef35 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "cover-count", * schema: { * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number" @@ -16,7 +16,7 @@ import * as Square from "../../../../../../index"; * description: "The number of people seated at a table", * visibility: "VISIBILITY_READ_WRITE_VALUES" * }, - * idempotencyKey: "IDEMPOTENCY_KEY" + * idempotency_key: "IDEMPOTENCY_KEY" * } */ export interface CreateOrderCustomAttributeDefinitionRequest { @@ -28,10 +28,10 @@ export interface CreateOrderCustomAttributeDefinitionRequest { * - 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; + custom_attribute_definition: 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; + idempotency_key?: string; } diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts index e8123e530..208c3ef07 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -12,7 +12,7 @@ export interface ListCustomAttributeDefinitionsRequest { /** * Requests that all of the custom attributes be returned, or only those that are read-only or read-write. */ - visibilityFilter?: Square.VisibilityFilter | null; + visibility_filter?: 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. diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts index 3eaac2d78..2bea5403e 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts @@ -2,18 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * key: "key", - * customAttributeDefinition: { + * custom_attribute_definition: { * key: "cover-count", * visibility: "VISIBILITY_READ_ONLY", * version: 1 * }, - * idempotencyKey: "IDEMPOTENCY_KEY" + * idempotency_key: "IDEMPOTENCY_KEY" * } */ export interface UpdateOrderCustomAttributeDefinitionRequest { @@ -28,10 +28,10 @@ export interface UpdateOrderCustomAttributeDefinitionRequest { * * 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; + custom_attribute_definition: 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; + idempotency_key?: 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 index fbb70badb..3db93e706 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest"; -export { type CreateOrderCustomAttributeDefinitionRequest } from "./CreateOrderCustomAttributeDefinitionRequest"; -export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest"; -export { type UpdateOrderCustomAttributeDefinitionRequest } from "./UpdateOrderCustomAttributeDefinitionRequest"; -export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest"; +export { type ListCustomAttributeDefinitionsRequest } from "./ListCustomAttributeDefinitionsRequest.js"; +export { type CreateOrderCustomAttributeDefinitionRequest } from "./CreateOrderCustomAttributeDefinitionRequest.js"; +export { type GetCustomAttributeDefinitionsRequest } from "./GetCustomAttributeDefinitionsRequest.js"; +export { type UpdateOrderCustomAttributeDefinitionRequest } from "./UpdateOrderCustomAttributeDefinitionRequest.js"; +export { type DeleteCustomAttributeDefinitionsRequest } from "./DeleteCustomAttributeDefinitionsRequest.js"; diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/index.ts b/src/api/resources/orders/resources/customAttributeDefinitions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/index.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/orders/resources/customAttributes/client/Client.ts b/src/api/resources/orders/resources/customAttributes/client/Client.ts index 2a1e2885a..feaa2a8b7 100644 --- a/src/api/resources/orders/resources/customAttributes/client/Client.ts +++ b/src/api/resources/orders/resources/customAttributes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace CustomAttributes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace CustomAttributes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace CustomAttributes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class CustomAttributes { - constructor(protected readonly _options: CustomAttributes.Options = {}) {} + protected readonly _options: CustomAttributes.Options; + + constructor(_options: CustomAttributes.Options = {}) { + this._options = _options; + } /** * Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation. @@ -61,62 +66,61 @@ export class CustomAttributes { * values: { * "cover-count": { * key: "cover-count", - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * }, * "table-number": { * key: "table-number", - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * } * } * }) */ - public async batchDelete( + public batchDelete( request: Square.orders.BulkDeleteOrderCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchDelete(request, requestOptions)); + } + + private async __batchDelete( + request: Square.orders.BulkDeleteOrderCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.orders.BulkDeleteOrderCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkDeleteOrderCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -125,6 +129,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -133,6 +138,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -160,71 +166,70 @@ export class CustomAttributes { * await client.orders.customAttributes.batchUpsert({ * values: { * "cover-count": { - * customAttribute: { + * custom_attribute: { * key: "cover-count", * value: "6", * version: 2 * }, - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * }, * "table-number": { - * customAttribute: { + * custom_attribute: { * key: "table-number", * value: "11", * version: 4 * }, - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * } * } * }) */ - public async batchUpsert( + public batchUpsert( + request: Square.orders.BulkUpsertOrderCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpsert(request, requestOptions)); + } + + private async __batchUpsert( request: Square.orders.BulkUpsertOrderCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.orders.BulkUpsertOrderCustomAttributesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BulkUpsertOrderCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -233,6 +238,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -241,6 +247,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -260,94 +267,98 @@ export class CustomAttributes { * * @example * await client.orders.customAttributes.list({ - * orderId: "order_id" + * order_id: "order_id" * }) */ public async list( request: Square.orders.ListCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, ): Promise> { - const list = async ( - request: Square.orders.ListCustomAttributesRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.orders.ListCustomAttributesRequest, + ): Promise> => { + const { + order_id: orderId, + visibility_filter: visibilityFilter, + cursor, + limit, + with_definitions: withDefinitions, + } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = visibilityFilter; + } + 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListOrderCustomAttributesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.customAttributes ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.custom_attributes ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -369,15 +380,27 @@ export class CustomAttributes { * * @example * await client.orders.customAttributes.get({ - * orderId: "order_id", - * customAttributeKey: "custom_attribute_key" + * order_id: "order_id", + * custom_attribute_key: "custom_attribute_key" * }) */ - public async get( + public get( request: Square.orders.GetCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { orderId, customAttributeKey, version, withDefinition } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.orders.GetCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { + order_id: orderId, + custom_attribute_key: customAttributeKey, + version, + with_definition: withDefinition, + } = request; const _queryParams: Record = {}; if (version !== undefined) { _queryParams["version"] = version?.toString() ?? null; @@ -388,45 +411,38 @@ export class CustomAttributes { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.RetrieveOrderCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -435,6 +451,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -443,6 +460,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -463,63 +481,62 @@ export class CustomAttributes { * * @example * await client.orders.customAttributes.upsert({ - * orderId: "order_id", - * customAttributeKey: "custom_attribute_key", - * customAttribute: { + * order_id: "order_id", + * custom_attribute_key: "custom_attribute_key", + * custom_attribute: { * key: "table-number", * value: "42", * version: 1 * } * }) */ - public async upsert( + public upsert( request: Square.orders.UpsertOrderCustomAttributeRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { orderId, customAttributeKey, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions)); + } + + private async __upsert( + request: Square.orders.UpsertOrderCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const { order_id: orderId, custom_attribute_key: customAttributeKey, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.orders.UpsertOrderCustomAttributeRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpsertOrderCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -528,6 +545,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -536,6 +554,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -552,54 +571,54 @@ export class CustomAttributes { * * @example * await client.orders.customAttributes.delete({ - * orderId: "order_id", - * customAttributeKey: "custom_attribute_key" + * order_id: "order_id", + * custom_attribute_key: "custom_attribute_key" * }) */ - public async delete( + public delete( + request: Square.orders.DeleteCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.orders.DeleteCustomAttributesRequest, requestOptions?: CustomAttributes.RequestOptions, - ): Promise { - const { orderId, customAttributeKey } = request; + ): Promise> { + const { order_id: orderId, custom_attribute_key: customAttributeKey } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteOrderCustomAttributeResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -608,6 +627,7 @@ export class CustomAttributes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -616,6 +636,7 @@ export class CustomAttributes { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/orders/resources/customAttributes/client/index.ts b/src/api/resources/orders/resources/customAttributes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/orders/resources/customAttributes/client/index.ts +++ b/src/api/resources/orders/resources/customAttributes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts index c179f4272..ac1489d03 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -10,11 +10,11 @@ import * as Square from "../../../../../../index"; * values: { * "cover-count": { * key: "cover-count", - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * }, * "table-number": { * key: "table-number", - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * } * } * } diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts index 049e4a5fc..a62f236ad 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts @@ -2,27 +2,27 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * values: { * "cover-count": { - * customAttribute: { + * custom_attribute: { * key: "cover-count", * value: "6", * version: 2 * }, - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * }, * "table-number": { - * customAttribute: { + * custom_attribute: { * key: "table-number", * value: "11", * version: 4 * }, - * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" * } * } * } diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts index 1ad104438..417c79981 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/DeleteCustomAttributesRequest.ts @@ -5,18 +5,18 @@ /** * @example * { - * orderId: "order_id", - * customAttributeKey: "custom_attribute_key" + * order_id: "order_id", + * custom_attribute_key: "custom_attribute_key" * } */ export interface DeleteCustomAttributesRequest { /** * The ID of the target [order](entity:Order). */ - orderId: string; + order_id: string; /** * The key of the custom attribute to delete. This key must match the key of an * existing custom attribute definition. */ - customAttributeKey: string; + custom_attribute_key: string; } diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts index 7c77448f5..61e3ce00f 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -5,20 +5,20 @@ /** * @example * { - * orderId: "order_id", - * customAttributeKey: "custom_attribute_key" + * order_id: "order_id", + * custom_attribute_key: "custom_attribute_key" * } */ export interface GetCustomAttributesRequest { /** * The ID of the target [order](entity:Order). */ - orderId: string; + order_id: string; /** * The key of the custom attribute to retrieve. This key must match the key of an * existing custom attribute definition. */ - customAttributeKey: string; + custom_attribute_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. @@ -29,5 +29,5 @@ export interface GetCustomAttributesRequest { * 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; + with_definition?: boolean | null; } diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts index e91327e97..4992d866e 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * orderId: "order_id" + * order_id: "order_id" * } */ export interface ListCustomAttributesRequest { /** * The ID of the target [order](entity:Order). */ - orderId: string; + order_id: string; /** * Requests that all of the custom attributes be returned, or only those that are read-only or read-write. */ - visibilityFilter?: Square.VisibilityFilter | null; + visibility_filter?: 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. @@ -37,5 +37,5 @@ export interface ListCustomAttributesRequest { * 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; + with_definitions?: 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 index d8edbbc12..ae7c4f9dd 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * orderId: "order_id", - * customAttributeKey: "custom_attribute_key", - * customAttribute: { + * order_id: "order_id", + * custom_attribute_key: "custom_attribute_key", + * custom_attribute: { * key: "table-number", * value: "42", * version: 1 @@ -20,12 +20,12 @@ export interface UpsertOrderCustomAttributeRequest { /** * The ID of the target [order](entity:Order). */ - orderId: string; + order_id: 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; + custom_attribute_key: string; /** * The custom attribute to create or update, with the following fields: * @@ -35,10 +35,10 @@ export interface UpsertOrderCustomAttributeRequest { * - `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; + custom_attribute: 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; + idempotency_key?: 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 index 63278aa3e..f1390b1df 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/index.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type BulkDeleteOrderCustomAttributesRequest } from "./BulkDeleteOrderCustomAttributesRequest"; -export { type BulkUpsertOrderCustomAttributesRequest } from "./BulkUpsertOrderCustomAttributesRequest"; -export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest"; -export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest"; -export { type UpsertOrderCustomAttributeRequest } from "./UpsertOrderCustomAttributeRequest"; -export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest"; +export { type BulkDeleteOrderCustomAttributesRequest } from "./BulkDeleteOrderCustomAttributesRequest.js"; +export { type BulkUpsertOrderCustomAttributesRequest } from "./BulkUpsertOrderCustomAttributesRequest.js"; +export { type ListCustomAttributesRequest } from "./ListCustomAttributesRequest.js"; +export { type GetCustomAttributesRequest } from "./GetCustomAttributesRequest.js"; +export { type UpsertOrderCustomAttributeRequest } from "./UpsertOrderCustomAttributeRequest.js"; +export { type DeleteCustomAttributesRequest } from "./DeleteCustomAttributesRequest.js"; diff --git a/src/api/resources/orders/resources/customAttributes/index.ts b/src/api/resources/orders/resources/customAttributes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/orders/resources/customAttributes/index.ts +++ b/src/api/resources/orders/resources/customAttributes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/orders/resources/index.ts b/src/api/resources/orders/resources/index.ts index bfa7c90b7..72d9ddae6 100644 --- a/src/api/resources/orders/resources/index.ts +++ b/src/api/resources/orders/resources/index.ts @@ -1,4 +1,4 @@ -export * as customAttributeDefinitions from "./customAttributeDefinitions"; -export * as customAttributes from "./customAttributes"; -export * from "./customAttributeDefinitions/client/requests"; -export * from "./customAttributes/client/requests"; +export * as customAttributeDefinitions from "./customAttributeDefinitions/index.js"; +export * as customAttributes from "./customAttributes/index.js"; +export * from "./customAttributeDefinitions/client/requests/index.js"; +export * from "./customAttributes/client/requests/index.js"; diff --git a/src/api/resources/payments/client/Client.ts b/src/api/resources/payments/client/Client.ts index dc078c622..0adbe8cc2 100644 --- a/src/api/resources/payments/client/Client.ts +++ b/src/api/resources/payments/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Payments { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Payments { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Payments { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Payments { - constructor(protected readonly _options: Payments.Options = {}) {} + protected readonly _options: Payments.Options; + + constructor(_options: Payments.Options = {}) { + this._options = _options; + } /** * Retrieves a list of payments taken by the account making the request. @@ -55,131 +60,126 @@ export class Payments { request: Square.ListPaymentsRequest = {}, requestOptions?: Payments.RequestOptions, ): Promise> { - const list = async (request: Square.ListPaymentsRequest): 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.ListPaymentsRequestSortField.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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListPaymentsRequest): Promise> => { + const { + begin_time: beginTime, + end_time: endTime, + sort_order: sortOrder, + cursor, + location_id: locationId, + total, + last_4: last4, + card_brand: cardBrand, + limit, + is_offline_payment: isOfflinePayment, + offline_begin_time: offlineBeginTime, + offline_end_time: offlineEndTime, + updated_at_begin_time: updatedAtBeginTime, + updated_at_end_time: updatedAtEndTime, + sort_field: 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"] = sortField; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/payments", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListPaymentsResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/payments."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/payments."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.payments ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -202,70 +202,66 @@ export class Payments { * * @example * await client.payments.create({ - * sourceId: "ccof:GaJGNaZa8x4OgDJn4GB", - * idempotencyKey: "7b0f3ec5-086a-4871-8f13-3c81b3875218", - * amountMoney: { - * amount: 1000, + * source_id: "ccof:GaJGNaZa8x4OgDJn4GB", + * idempotency_key: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + * amount_money: { + * amount: BigInt("1000"), * currency: "USD" * }, - * appFeeMoney: { - * amount: 10, + * app_fee_money: { + * amount: BigInt("10"), * currency: "USD" * }, * autocomplete: true, - * customerId: "W92WH6P11H4Z77CTET0RNTGFW8", - * locationId: "L88917AVBK2S5", - * referenceId: "123456", + * customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + * location_id: "L88917AVBK2S5", + * reference_id: "123456", * note: "Brief description" * }) */ - public async create( + public create( + request: Square.CreatePaymentRequest, + requestOptions?: Payments.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.CreatePaymentRequest, requestOptions?: Payments.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreatePaymentRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreatePaymentResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -274,12 +270,14 @@ export class Payments { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/payments."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -302,56 +300,55 @@ export class Payments { * * @example * await client.payments.cancelByIdempotencyKey({ - * idempotencyKey: "a7e36d40-d24b-11e8-b568-0800200c9a66" + * idempotency_key: "a7e36d40-d24b-11e8-b568-0800200c9a66" * }) */ - public async cancelByIdempotencyKey( + public cancelByIdempotencyKey( + request: Square.CancelPaymentByIdempotencyKeyRequest, + requestOptions?: Payments.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancelByIdempotencyKey(request, requestOptions)); + } + + private async __cancelByIdempotencyKey( request: Square.CancelPaymentByIdempotencyKeyRequest, requestOptions?: Payments.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CancelPaymentByIdempotencyKeyRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CancelPaymentByIdempotencyKeyResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -360,12 +357,14 @@ export class Payments { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/payments/cancel."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -378,53 +377,50 @@ export class Payments { * * @example * await client.payments.get({ - * paymentId: "payment_id" + * payment_id: "payment_id" * }) */ - public async get( + public get( + request: Square.GetPaymentsRequest, + requestOptions?: Payments.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetPaymentsRequest, requestOptions?: Payments.RequestOptions, - ): Promise { - const { paymentId } = request; + ): Promise> { + const { payment_id: paymentId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetPaymentResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -433,12 +429,14 @@ export class Payments { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -452,69 +450,65 @@ export class Payments { * * @example * await client.payments.update({ - * paymentId: "payment_id", + * payment_id: "payment_id", * payment: { - * amountMoney: { - * amount: 1000, + * amount_money: { + * amount: BigInt("1000"), * currency: "USD" * }, - * tipMoney: { - * amount: 100, + * tip_money: { + * amount: BigInt("100"), * currency: "USD" * }, - * versionToken: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o" + * version_token: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o" * }, - * idempotencyKey: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de" + * idempotency_key: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de" * }) */ - public async update( + public update( + request: Square.UpdatePaymentRequest, + requestOptions?: Payments.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.UpdatePaymentRequest, requestOptions?: Payments.RequestOptions, - ): Promise { - const { paymentId, ..._body } = request; + ): Promise> { + const { payment_id: paymentId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdatePaymentRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdatePaymentResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -523,12 +517,14 @@ export class Payments { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -542,53 +538,50 @@ export class Payments { * * @example * await client.payments.cancel({ - * paymentId: "payment_id" + * payment_id: "payment_id" * }) */ - public async cancel( + public cancel( request: Square.CancelPaymentsRequest, requestOptions?: Payments.RequestOptions, - ): Promise { - const { paymentId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( + request: Square.CancelPaymentsRequest, + requestOptions?: Payments.RequestOptions, + ): Promise> { + const { payment_id: paymentId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.CancelPaymentResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -597,6 +590,7 @@ export class Payments { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -605,6 +599,7 @@ export class Payments { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -620,57 +615,53 @@ export class Payments { * * @example * await client.payments.complete({ - * paymentId: "payment_id" + * payment_id: "payment_id" * }) */ - public async complete( + public complete( request: Square.CompletePaymentRequest, requestOptions?: Payments.RequestOptions, - ): Promise { - const { paymentId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__complete(request, requestOptions)); + } + + private async __complete( + request: Square.CompletePaymentRequest, + requestOptions?: Payments.RequestOptions, + ): Promise> { + const { payment_id: paymentId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CompletePaymentRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.CompletePaymentResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -679,6 +670,7 @@ export class Payments { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -687,6 +679,7 @@ export class Payments { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/payments/client/index.ts b/src/api/resources/payments/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/payments/client/index.ts +++ b/src/api/resources/payments/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts b/src/api/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts index 7929437cc..c288189b8 100644 --- a/src/api/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts +++ b/src/api/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * idempotencyKey: "a7e36d40-d24b-11e8-b568-0800200c9a66" + * idempotency_key: "a7e36d40-d24b-11e8-b568-0800200c9a66" * } */ export interface CancelPaymentByIdempotencyKeyRequest { /** The `idempotency_key` identifying the payment to be canceled. */ - idempotencyKey: string; + idempotency_key: string; } diff --git a/src/api/resources/payments/client/requests/CancelPaymentsRequest.ts b/src/api/resources/payments/client/requests/CancelPaymentsRequest.ts index 909ef567d..bf27d0abd 100644 --- a/src/api/resources/payments/client/requests/CancelPaymentsRequest.ts +++ b/src/api/resources/payments/client/requests/CancelPaymentsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * paymentId: "payment_id" + * payment_id: "payment_id" * } */ export interface CancelPaymentsRequest { /** * The ID of the payment to cancel. */ - paymentId: string; + payment_id: string; } diff --git a/src/api/resources/payments/client/requests/CompletePaymentRequest.ts b/src/api/resources/payments/client/requests/CompletePaymentRequest.ts index c75e332e9..b22d53086 100644 --- a/src/api/resources/payments/client/requests/CompletePaymentRequest.ts +++ b/src/api/resources/payments/client/requests/CompletePaymentRequest.ts @@ -5,18 +5,18 @@ /** * @example * { - * paymentId: "payment_id" + * payment_id: "payment_id" * } */ export interface CompletePaymentRequest { /** * The unique ID identifying the payment to be completed. */ - paymentId: string; + payment_id: 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; + version_token?: string | null; } diff --git a/src/api/resources/payments/client/requests/CreatePaymentRequest.ts b/src/api/resources/payments/client/requests/CreatePaymentRequest.ts index 8c7756897..a47808b3a 100644 --- a/src/api/resources/payments/client/requests/CreatePaymentRequest.ts +++ b/src/api/resources/payments/client/requests/CreatePaymentRequest.ts @@ -2,25 +2,25 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * sourceId: "ccof:GaJGNaZa8x4OgDJn4GB", - * idempotencyKey: "7b0f3ec5-086a-4871-8f13-3c81b3875218", - * amountMoney: { - * amount: 1000, + * source_id: "ccof:GaJGNaZa8x4OgDJn4GB", + * idempotency_key: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + * amount_money: { + * amount: BigInt("1000"), * currency: "USD" * }, - * appFeeMoney: { - * amount: 10, + * app_fee_money: { + * amount: BigInt("10"), * currency: "USD" * }, * autocomplete: true, - * customerId: "W92WH6P11H4Z77CTET0RNTGFW8", - * locationId: "L88917AVBK2S5", - * referenceId: "123456", + * customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + * location_id: "L88917AVBK2S5", + * reference_id: "123456", * note: "Brief description" * } */ @@ -34,7 +34,7 @@ export interface CreatePaymentRequest { * For more information, see * [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). */ - sourceId: string; + source_id: string; /** * A unique string that identifies this `CreatePayment` request. Keys can be any valid string * but must be unique for every `CreatePayment` request. @@ -44,7 +44,7 @@ export interface CreatePaymentRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; + idempotency_key: string; /** * The amount of money to accept for this payment, not including `tip_money`. * @@ -55,7 +55,7 @@ export interface CreatePaymentRequest { * The currency code must match the currency associated with the business * that is accepting the payment. */ - amountMoney?: Square.Money; + amount_money?: Square.Money; /** * The amount designated as a tip, in addition to `amount_money`. * @@ -66,7 +66,7 @@ export interface CreatePaymentRequest { * The currency code must match the currency associated with the business * that is accepting the payment. */ - tipMoney?: Square.Money; + tip_money?: Square.Money; /** * The amount of money that the developer is taking as a fee * for facilitating the payment on behalf of the seller. @@ -87,7 +87,7 @@ export interface CreatePaymentRequest { * 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; + app_fee_money?: 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. @@ -104,7 +104,7 @@ export interface CreatePaymentRequest { * - Card-present payments: "PT36H" (36 hours) from the creation time. * - Card-not-present payments: "P7D" (7 days) from the creation time. */ - delayDuration?: string; + delay_duration?: 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 @@ -112,7 +112,7 @@ export interface CreatePaymentRequest { * * Default: CANCEL */ - delayAction?: string; + delay_action?: 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 @@ -123,30 +123,30 @@ export interface CreatePaymentRequest { */ autocomplete?: boolean; /** Associates a previously created order with this payment. */ - orderId?: string; + order_id?: 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; + customer_id?: 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; + location_id?: string; /** * An optional [TeamMember](entity:TeamMember) ID to associate with * this payment. */ - teamMemberId?: string; + team_member_id?: 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; + reference_id?: 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 @@ -154,7 +154,7 @@ export interface CreatePaymentRequest { * * For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview). */ - verificationToken?: string; + verification_token?: 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 @@ -167,9 +167,9 @@ export interface CreatePaymentRequest { * * Default: false */ - acceptPartialAuthorization?: boolean; + accept_partial_authorization?: boolean; /** The buyer's email address. */ - buyerEmailAddress?: string; + buyer_email_address?: string; /** * The buyer's phone number. * Must follow the following format: @@ -178,11 +178,11 @@ export interface CreatePaymentRequest { * Alphabetical characters aren't allowed. * 3. The phone number must contain between 9 and 16 digits. */ - buyerPhoneNumber?: string; + buyer_phone_number?: string; /** The buyer's billing address. */ - billingAddress?: Square.Address; + billing_address?: Square.Address; /** The buyer's shipping address. */ - shippingAddress?: Square.Address; + shipping_address?: Square.Address; /** An optional note to be entered by the developer when creating a payment. */ note?: string; /** @@ -194,16 +194,16 @@ export interface CreatePaymentRequest { * to fit the required information including the Square identifier (SQ *) and name of the * seller taking the payment. */ - statementDescriptionIdentifier?: string; + statement_description_identifier?: string; /** Additional details required when recording a cash payment (`source_id` is CASH). */ - cashDetails?: Square.CashPaymentDetails; + cash_details?: Square.CashPaymentDetails; /** Additional details required when recording an external payment (`source_id` is EXTERNAL). */ - externalDetails?: Square.ExternalPaymentDetails; + external_details?: Square.ExternalPaymentDetails; /** Details about the customer making the payment. */ - customerDetails?: Square.CustomerDetails; + customer_details?: Square.CustomerDetails; /** * An optional field for specifying the offline payment details. This is intended for * internal 1st-party callers only. */ - offlinePaymentDetails?: Square.OfflinePaymentDetails; + offline_payment_details?: Square.OfflinePaymentDetails; } diff --git a/src/api/resources/payments/client/requests/GetPaymentsRequest.ts b/src/api/resources/payments/client/requests/GetPaymentsRequest.ts index a012df8cd..0bf9e4779 100644 --- a/src/api/resources/payments/client/requests/GetPaymentsRequest.ts +++ b/src/api/resources/payments/client/requests/GetPaymentsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * paymentId: "payment_id" + * payment_id: "payment_id" * } */ export interface GetPaymentsRequest { /** * A unique ID for the desired payment. */ - paymentId: string; + payment_id: string; } diff --git a/src/api/resources/payments/client/requests/ListPaymentsRequest.ts b/src/api/resources/payments/client/requests/ListPaymentsRequest.ts index 686751d03..972cd45c9 100644 --- a/src/api/resources/payments/client/requests/ListPaymentsRequest.ts +++ b/src/api/resources/payments/client/requests/ListPaymentsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -14,20 +14,20 @@ export interface ListPaymentsRequest { * The range is determined using the `created_at` field for each Payment. * Inclusive. Default: The current time minus one year. */ - beginTime?: string | null; + begin_time?: 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; + end_time?: 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; + sort_order?: 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. @@ -39,19 +39,19 @@ export interface ListPaymentsRequest { * Limit results to the location supplied. By default, results are returned * for the default (main) location associated with the seller. */ - locationId?: string | null; + location_id?: string | null; /** * The exact amount in the `total_money` for a payment. */ - total?: bigint | null; + total?: (number | bigint) | null; /** * The last four digits of a payment card. */ - last4?: string | null; + last_4?: string | null; /** * The brand of the payment card (for example, VISA). */ - cardBrand?: string | null; + card_brand?: 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. @@ -65,7 +65,7 @@ export interface ListPaymentsRequest { /** * Whether the payment was taken offline or not. */ - isOfflinePayment?: boolean | null; + is_offline_payment?: 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 @@ -74,7 +74,7 @@ export interface ListPaymentsRequest { * * Default: The current time. */ - offlineBeginTime?: string | null; + offline_begin_time?: 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 @@ -83,19 +83,19 @@ export interface ListPaymentsRequest { * * Default: The current time. */ - offlineEndTime?: string | null; + offline_end_time?: 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; + updated_at_begin_time?: 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; + updated_at_end_time?: string | null; /** * The field used to sort results by. The default is `CREATED_AT`. */ - sortField?: Square.ListPaymentsRequestSortField | null; + sort_field?: Square.ListPaymentsRequestSortField | null; } diff --git a/src/api/resources/payments/client/requests/UpdatePaymentRequest.ts b/src/api/resources/payments/client/requests/UpdatePaymentRequest.ts index 62e6078ab..a3122ece9 100644 --- a/src/api/resources/payments/client/requests/UpdatePaymentRequest.ts +++ b/src/api/resources/payments/client/requests/UpdatePaymentRequest.ts @@ -2,31 +2,31 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * paymentId: "payment_id", + * payment_id: "payment_id", * payment: { - * amountMoney: { - * amount: 1000, + * amount_money: { + * amount: BigInt("1000"), * currency: "USD" * }, - * tipMoney: { - * amount: 100, + * tip_money: { + * amount: BigInt("100"), * currency: "USD" * }, - * versionToken: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o" + * version_token: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o" * }, - * idempotencyKey: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de" + * idempotency_key: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de" * } */ export interface UpdatePaymentRequest { /** * The ID of the payment to update. */ - paymentId: string; + payment_id: string; /** The updated `Payment` object. */ payment?: Square.Payment; /** @@ -35,5 +35,5 @@ export interface UpdatePaymentRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey: string; + idempotency_key: string; } diff --git a/src/api/resources/payments/client/requests/index.ts b/src/api/resources/payments/client/requests/index.ts index 3828c6442..1c4c86505 100644 --- a/src/api/resources/payments/client/requests/index.ts +++ b/src/api/resources/payments/client/requests/index.ts @@ -1,7 +1,7 @@ -export { type ListPaymentsRequest } from "./ListPaymentsRequest"; -export { type CreatePaymentRequest } from "./CreatePaymentRequest"; -export { type CancelPaymentByIdempotencyKeyRequest } from "./CancelPaymentByIdempotencyKeyRequest"; -export { type GetPaymentsRequest } from "./GetPaymentsRequest"; -export { type UpdatePaymentRequest } from "./UpdatePaymentRequest"; -export { type CancelPaymentsRequest } from "./CancelPaymentsRequest"; -export { type CompletePaymentRequest } from "./CompletePaymentRequest"; +export { type ListPaymentsRequest } from "./ListPaymentsRequest.js"; +export { type CreatePaymentRequest } from "./CreatePaymentRequest.js"; +export { type CancelPaymentByIdempotencyKeyRequest } from "./CancelPaymentByIdempotencyKeyRequest.js"; +export { type GetPaymentsRequest } from "./GetPaymentsRequest.js"; +export { type UpdatePaymentRequest } from "./UpdatePaymentRequest.js"; +export { type CancelPaymentsRequest } from "./CancelPaymentsRequest.js"; +export { type CompletePaymentRequest } from "./CompletePaymentRequest.js"; diff --git a/src/api/resources/payments/index.ts b/src/api/resources/payments/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/payments/index.ts +++ b/src/api/resources/payments/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/payouts/client/Client.ts b/src/api/resources/payouts/client/Client.ts index 3c93d7455..159bb179e 100644 --- a/src/api/resources/payouts/client/Client.ts +++ b/src/api/resources/payouts/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Payouts { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Payouts { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Payouts { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Payouts { - constructor(protected readonly _options: Payouts.Options = {}) {} + protected readonly _options: Payouts.Options; + + constructor(_options: Payouts.Options = {}) { + this._options = _options; + } /** * Retrieves a list of all payouts for the default location. @@ -52,94 +57,94 @@ export class Payouts { request: Square.ListPayoutsRequest = {}, requestOptions?: Payouts.RequestOptions, ): Promise> { - const list = async (request: Square.ListPayoutsRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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"], + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListPayoutsRequest): Promise> => { + const { + location_id: locationId, + status, + begin_time: beginTime, + end_time: endTime, + sort_order: sortOrder, + cursor, + limit, + } = request; + const _queryParams: Record = {}; + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (status !== undefined) { + _queryParams["status"] = status; + } + 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 (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/payouts", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { data: _response.body as Square.ListPayoutsResponse, rawResponse: _response.rawResponse }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/payouts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.payouts ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -156,53 +161,50 @@ export class Payouts { * * @example * await client.payouts.get({ - * payoutId: "payout_id" + * payout_id: "payout_id" * }) */ - public async get( + public get( request: Square.GetPayoutsRequest, requestOptions?: Payouts.RequestOptions, - ): Promise { - const { payoutId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetPayoutsRequest, + requestOptions?: Payouts.RequestOptions, + ): Promise> { + const { payout_id: payoutId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetPayoutResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -211,12 +213,14 @@ export class Payouts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -230,89 +234,89 @@ export class Payouts { * * @example * await client.payouts.listEntries({ - * payoutId: "payout_id" + * payout_id: "payout_id" * }) */ public async listEntries( request: Square.ListEntriesPayoutsRequest, requestOptions?: Payouts.RequestOptions, ): Promise> { - const list = async (request: Square.ListEntriesPayoutsRequest): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListEntriesPayoutsRequest, + ): Promise> => { + const { payout_id: payoutId, sort_order: sortOrder, cursor, limit } = request; + const _queryParams: Record = {}; + if (sortOrder !== undefined) { + _queryParams["sort_order"] = sortOrder; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListPayoutEntriesResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - 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, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.payoutEntries ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.payout_entries ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, diff --git a/src/api/resources/payouts/client/index.ts b/src/api/resources/payouts/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/payouts/client/index.ts +++ b/src/api/resources/payouts/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/payouts/client/requests/GetPayoutsRequest.ts b/src/api/resources/payouts/client/requests/GetPayoutsRequest.ts index 2a31c8f5b..8399a45fa 100644 --- a/src/api/resources/payouts/client/requests/GetPayoutsRequest.ts +++ b/src/api/resources/payouts/client/requests/GetPayoutsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * payoutId: "payout_id" + * payout_id: "payout_id" * } */ export interface GetPayoutsRequest { /** * The ID of the payout to retrieve the information for. */ - payoutId: string; + payout_id: string; } diff --git a/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts b/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts index e12ee9e59..67ddae931 100644 --- a/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts +++ b/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * payoutId: "payout_id" + * payout_id: "payout_id" * } */ export interface ListEntriesPayoutsRequest { /** * The ID of the payout to retrieve the information for. */ - payoutId: string; + payout_id: string; /** * The order in which payout entries are listed. */ - sortOrder?: Square.SortOrder | null; + sort_order?: 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. diff --git a/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts b/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts index c585aace4..e004fe7a8 100644 --- a/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts +++ b/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -13,7 +13,7 @@ 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; + location_id?: string | null; /** * If provided, only payouts with the given status are returned. */ @@ -22,16 +22,16 @@ export interface ListPayoutsRequest { * 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; + begin_time?: string | null; /** * The timestamp for the end of the payout creation time, in RFC 3339 format. * Default: The current time. */ - endTime?: string | null; + end_time?: string | null; /** * The order in which payouts are listed. */ - sortOrder?: Square.SortOrder | null; + sort_order?: 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. diff --git a/src/api/resources/payouts/client/requests/index.ts b/src/api/resources/payouts/client/requests/index.ts index 73f48e53f..bfb032001 100644 --- a/src/api/resources/payouts/client/requests/index.ts +++ b/src/api/resources/payouts/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type ListPayoutsRequest } from "./ListPayoutsRequest"; -export { type GetPayoutsRequest } from "./GetPayoutsRequest"; -export { type ListEntriesPayoutsRequest } from "./ListEntriesPayoutsRequest"; +export { type ListPayoutsRequest } from "./ListPayoutsRequest.js"; +export { type GetPayoutsRequest } from "./GetPayoutsRequest.js"; +export { type ListEntriesPayoutsRequest } from "./ListEntriesPayoutsRequest.js"; diff --git a/src/api/resources/payouts/index.ts b/src/api/resources/payouts/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/payouts/index.ts +++ b/src/api/resources/payouts/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/refunds/client/Client.ts b/src/api/resources/refunds/client/Client.ts index 6e3a3c843..e6b1fc90c 100644 --- a/src/api/resources/refunds/client/Client.ts +++ b/src/api/resources/refunds/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Refunds { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Refunds { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Refunds { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Refunds { - constructor(protected readonly _options: Refunds.Options = {}) {} + protected readonly _options: Refunds.Options; + + constructor(_options: Refunds.Options = {}) { + this._options = _options; + } /** * Retrieves a list of refunds for the account making the request. @@ -55,115 +60,115 @@ export class Refunds { request: Square.ListRefundsRequest = {}, requestOptions?: Refunds.RequestOptions, ): Promise> { - const list = async (request: Square.ListRefundsRequest): Promise => { - const { - beginTime, - endTime, - sortOrder, - cursor, - locationId, - status, - sourceType, - limit, - 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 (status !== undefined) { - _queryParams["status"] = status; - } - if (sourceType !== undefined) { - _queryParams["source_type"] = sourceType; - } - if (limit !== undefined) { - _queryParams["limit"] = limit?.toString() ?? null; - } - 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.ListPaymentRefundsRequestSortField.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/refunds", - ), - method: "GET", - headers: { - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListRefundsRequest, + ): Promise> => { + const { + begin_time: beginTime, + end_time: endTime, + sort_order: sortOrder, + cursor, + location_id: locationId, + status, + source_type: sourceType, + limit, + updated_at_begin_time: updatedAtBeginTime, + updated_at_end_time: updatedAtEndTime, + sort_field: 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 (status !== undefined) { + _queryParams["status"] = status; + } + if (sourceType !== undefined) { + _queryParams["source_type"] = sourceType; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (updatedAtBeginTime !== undefined) { + _queryParams["updated_at_begin_time"] = updatedAtBeginTime; + } + if (updatedAtEndTime !== undefined) { + _queryParams["updated_at_end_time"] = updatedAtEndTime; + } + if (sortField !== undefined) { + _queryParams["sort_field"] = sortField; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/refunds", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListPaymentRefundsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/refunds."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/refunds."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.refunds ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -182,66 +187,62 @@ export class Refunds { * * @example * await client.refunds.refundPayment({ - * idempotencyKey: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", - * amountMoney: { - * amount: 1000, + * idempotency_key: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + * amount_money: { + * amount: BigInt("1000"), * currency: "USD" * }, - * appFeeMoney: { - * amount: 10, + * app_fee_money: { + * amount: BigInt("10"), * currency: "USD" * }, - * paymentId: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + * payment_id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", * reason: "Example" * }) */ - public async refundPayment( + public refundPayment( + request: Square.RefundPaymentRequest, + requestOptions?: Refunds.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__refundPayment(request, requestOptions)); + } + + private async __refundPayment( request: Square.RefundPaymentRequest, requestOptions?: Refunds.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.RefundPaymentRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.RefundPaymentResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -250,12 +251,14 @@ export class Refunds { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/refunds."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -268,53 +271,50 @@ export class Refunds { * * @example * await client.refunds.get({ - * refundId: "refund_id" + * refund_id: "refund_id" * }) */ - public async get( + public get( + request: Square.GetRefundsRequest, + requestOptions?: Refunds.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetRefundsRequest, requestOptions?: Refunds.RequestOptions, - ): Promise { - const { refundId } = request; + ): Promise> { + const { refund_id: refundId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetPaymentRefundResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -323,12 +323,14 @@ export class Refunds { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/refunds/client/index.ts b/src/api/resources/refunds/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/refunds/client/index.ts +++ b/src/api/resources/refunds/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/refunds/client/requests/GetRefundsRequest.ts b/src/api/resources/refunds/client/requests/GetRefundsRequest.ts index e5935da3f..d65fd7a44 100644 --- a/src/api/resources/refunds/client/requests/GetRefundsRequest.ts +++ b/src/api/resources/refunds/client/requests/GetRefundsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * refundId: "refund_id" + * refund_id: "refund_id" * } */ export interface GetRefundsRequest { /** * The unique ID for the desired `PaymentRefund`. */ - refundId: string; + refund_id: string; } diff --git a/src/api/resources/refunds/client/requests/ListRefundsRequest.ts b/src/api/resources/refunds/client/requests/ListRefundsRequest.ts index f21e73500..ef34f5fb8 100644 --- a/src/api/resources/refunds/client/requests/ListRefundsRequest.ts +++ b/src/api/resources/refunds/client/requests/ListRefundsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -15,20 +15,20 @@ export interface ListRefundsRequest { * * Default: The current time minus one year. */ - beginTime?: string | null; + begin_time?: 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; + end_time?: 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; + sort_order?: 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. @@ -40,7 +40,7 @@ export interface ListRefundsRequest { * Limit results to the location supplied. By default, results are returned * for all locations associated with the seller. */ - locationId?: string | null; + location_id?: string | null; /** * If provided, only refunds with the given status are returned. * For a list of refund status values, see [PaymentRefund](entity:PaymentRefund). @@ -56,7 +56,7 @@ export interface ListRefundsRequest { * * Default: If omitted, refunds are returned regardless of the source type. */ - sourceType?: string | null; + source_type?: string | null; /** * The maximum number of results to be returned in a single page. * @@ -73,16 +73,16 @@ export interface ListRefundsRequest { * * Default: If omitted, the time range starts at `begin_time`. */ - updatedAtBeginTime?: string | null; + updated_at_begin_time?: string | null; /** * Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339 * format. The range is determined using the `updated_at` field for each `PaymentRefund`. * * Default: The current time. */ - updatedAtEndTime?: string | null; + updated_at_end_time?: string | null; /** * The field used to sort results by. The default is `CREATED_AT`. */ - sortField?: Square.ListPaymentRefundsRequestSortField | null; + sort_field?: Square.ListPaymentRefundsRequestSortField | null; } diff --git a/src/api/resources/refunds/client/requests/RefundPaymentRequest.ts b/src/api/resources/refunds/client/requests/RefundPaymentRequest.ts index bc21d1716..ed343a3c1 100644 --- a/src/api/resources/refunds/client/requests/RefundPaymentRequest.ts +++ b/src/api/resources/refunds/client/requests/RefundPaymentRequest.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", - * amountMoney: { - * amount: 1000, + * idempotency_key: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + * amount_money: { + * amount: BigInt("1000"), * currency: "USD" * }, - * appFeeMoney: { - * amount: 10, + * app_fee_money: { + * amount: BigInt("10"), * currency: "USD" * }, - * paymentId: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + * payment_id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", * reason: "Example" * } */ @@ -30,7 +30,7 @@ export interface RefundPaymentRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; + idempotency_key: string; /** * The amount of money to refund. * @@ -44,7 +44,7 @@ export interface RefundPaymentRequest { * The currency code must match the currency associated with the business * that is charging the card. */ - amountMoney: Square.Money; + amount_money: 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, @@ -59,12 +59,12 @@ export interface RefundPaymentRequest { * 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; + app_fee_money?: Square.Money; /** * The unique ID of the payment being refunded. * Required when unlinked=false, otherwise must not be set. */ - paymentId?: string | null; + payment_id?: 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). @@ -74,7 +74,7 @@ export interface RefundPaymentRequest { * 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; + destination_id?: 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 @@ -86,13 +86,13 @@ export interface RefundPaymentRequest { * Required for requests specifying `unlinked=true`. * Otherwise, if included when `unlinked=false`, will throw an error. */ - locationId?: string | null; + location_id?: 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; + customer_id?: string | null; /** A description of the reason for the refund. */ reason?: string | null; /** @@ -101,14 +101,14 @@ export interface RefundPaymentRequest { * 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; + payment_version_token?: string | null; /** An optional [TeamMember](entity:TeamMember) ID to associate with this refund. */ - teamMemberId?: string | null; + team_member_id?: string | null; /** Additional details required when recording an unlinked cash refund (`destination_id` is CASH). */ - cashDetails?: Square.DestinationDetailsCashRefundDetails; + cash_details?: Square.DestinationDetailsCashRefundDetails; /** * Additional details required when recording an unlinked external refund * (`destination_id` is EXTERNAL). */ - externalDetails?: Square.DestinationDetailsExternalRefundDetails; + external_details?: Square.DestinationDetailsExternalRefundDetails; } diff --git a/src/api/resources/refunds/client/requests/index.ts b/src/api/resources/refunds/client/requests/index.ts index 8effc0bce..57410ea5c 100644 --- a/src/api/resources/refunds/client/requests/index.ts +++ b/src/api/resources/refunds/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type ListRefundsRequest } from "./ListRefundsRequest"; -export { type RefundPaymentRequest } from "./RefundPaymentRequest"; -export { type GetRefundsRequest } from "./GetRefundsRequest"; +export { type ListRefundsRequest } from "./ListRefundsRequest.js"; +export { type RefundPaymentRequest } from "./RefundPaymentRequest.js"; +export { type GetRefundsRequest } from "./GetRefundsRequest.js"; diff --git a/src/api/resources/refunds/index.ts b/src/api/resources/refunds/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/refunds/index.ts +++ b/src/api/resources/refunds/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/sites/client/Client.ts b/src/api/resources/sites/client/Client.ts index 0ee7341e5..75d78fb90 100644 --- a/src/api/resources/sites/client/Client.ts +++ b/src/api/resources/sites/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Sites { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Sites { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Sites { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Sites { - constructor(protected readonly _options: Sites.Options = {}) {} + protected readonly _options: Sites.Options; + + constructor(_options: Sites.Options = {}) { + this._options = _options; + } /** * Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date. @@ -48,46 +53,42 @@ export class Sites { * @example * await client.sites.list() */ - public async list(requestOptions?: Sites.RequestOptions): Promise { + public list(requestOptions?: Sites.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(requestOptions)); + } + + private async __list( + requestOptions?: Sites.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.ListSitesResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -96,12 +97,14 @@ export class Sites { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/sites."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/sites/index.ts b/src/api/resources/sites/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/sites/index.ts +++ b/src/api/resources/sites/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/snippets/client/Client.ts b/src/api/resources/snippets/client/Client.ts index 04ef500f3..7531cff3d 100644 --- a/src/api/resources/snippets/client/Client.ts +++ b/src/api/resources/snippets/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Snippets { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Snippets { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Snippets { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Snippets { - constructor(protected readonly _options: Snippets.Options = {}) {} + protected readonly _options: Snippets.Options; + + constructor(_options: Snippets.Options = {}) { + this._options = _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. @@ -50,53 +55,50 @@ export class Snippets { * * @example * await client.snippets.get({ - * siteId: "site_id" + * site_id: "site_id" * }) */ - public async get( + public get( + request: Square.GetSnippetsRequest, + requestOptions?: Snippets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.GetSnippetsRequest, requestOptions?: Snippets.RequestOptions, - ): Promise { - const { siteId } = request; + ): Promise> { + const { site_id: siteId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetSnippetResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -105,12 +107,14 @@ export class Snippets { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -129,60 +133,56 @@ export class Snippets { * * @example * await client.snippets.upsert({ - * siteId: "site_id", + * site_id: "site_id", * snippet: { * content: "" * } * }) */ - public async upsert( + public upsert( + request: Square.UpsertSnippetRequest, + requestOptions?: Snippets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions)); + } + + private async __upsert( request: Square.UpsertSnippetRequest, requestOptions?: Snippets.RequestOptions, - ): Promise { - const { siteId, ..._body } = request; + ): Promise> { + const { site_id: siteId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpsertSnippetRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpsertSnippetResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -191,12 +191,14 @@ export class Snippets { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -214,53 +216,50 @@ export class Snippets { * * @example * await client.snippets.delete({ - * siteId: "site_id" + * site_id: "site_id" * }) */ - public async delete( + public delete( + request: Square.DeleteSnippetsRequest, + requestOptions?: Snippets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.DeleteSnippetsRequest, requestOptions?: Snippets.RequestOptions, - ): Promise { - const { siteId } = request; + ): Promise> { + const { site_id: siteId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DeleteSnippetResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -269,6 +268,7 @@ export class Snippets { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -277,6 +277,7 @@ export class Snippets { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/snippets/client/index.ts b/src/api/resources/snippets/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/snippets/client/index.ts +++ b/src/api/resources/snippets/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/snippets/client/requests/DeleteSnippetsRequest.ts b/src/api/resources/snippets/client/requests/DeleteSnippetsRequest.ts index 35df88023..54dadefd7 100644 --- a/src/api/resources/snippets/client/requests/DeleteSnippetsRequest.ts +++ b/src/api/resources/snippets/client/requests/DeleteSnippetsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * siteId: "site_id" + * site_id: "site_id" * } */ export interface DeleteSnippetsRequest { /** * The ID of the site that contains the snippet. */ - siteId: string; + site_id: string; } diff --git a/src/api/resources/snippets/client/requests/GetSnippetsRequest.ts b/src/api/resources/snippets/client/requests/GetSnippetsRequest.ts index 64275821f..dc700dc1e 100644 --- a/src/api/resources/snippets/client/requests/GetSnippetsRequest.ts +++ b/src/api/resources/snippets/client/requests/GetSnippetsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * siteId: "site_id" + * site_id: "site_id" * } */ export interface GetSnippetsRequest { /** * The ID of the site that contains the snippet. */ - siteId: string; + site_id: string; } diff --git a/src/api/resources/snippets/client/requests/UpsertSnippetRequest.ts b/src/api/resources/snippets/client/requests/UpsertSnippetRequest.ts index 28d2100a3..07831984e 100644 --- a/src/api/resources/snippets/client/requests/UpsertSnippetRequest.ts +++ b/src/api/resources/snippets/client/requests/UpsertSnippetRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * siteId: "site_id", + * site_id: "site_id", * snippet: { * content: "" * } @@ -17,7 +17,7 @@ export interface UpsertSnippetRequest { /** * The ID of the site where you want to add or update the snippet. */ - siteId: string; + site_id: 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 index 9dd51c182..9e0696b04 100644 --- a/src/api/resources/snippets/client/requests/index.ts +++ b/src/api/resources/snippets/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type GetSnippetsRequest } from "./GetSnippetsRequest"; -export { type UpsertSnippetRequest } from "./UpsertSnippetRequest"; -export { type DeleteSnippetsRequest } from "./DeleteSnippetsRequest"; +export { type GetSnippetsRequest } from "./GetSnippetsRequest.js"; +export { type UpsertSnippetRequest } from "./UpsertSnippetRequest.js"; +export { type DeleteSnippetsRequest } from "./DeleteSnippetsRequest.js"; diff --git a/src/api/resources/snippets/index.ts b/src/api/resources/snippets/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/snippets/index.ts +++ b/src/api/resources/snippets/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/subscriptions/client/Client.ts b/src/api/resources/subscriptions/client/Client.ts index 24b43ad53..fa5aa46c4 100644 --- a/src/api/resources/subscriptions/client/Client.ts +++ b/src/api/resources/subscriptions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Subscriptions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Subscriptions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Subscriptions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Subscriptions { - constructor(protected readonly _options: Subscriptions.Options = {}) {} + protected readonly _options: Subscriptions.Options; + + constructor(_options: Subscriptions.Options = {}) { + this._options = _options; + } /** * Enrolls a customer in a subscription. @@ -52,69 +57,65 @@ export class Subscriptions { * * @example * await client.subscriptions.create({ - * idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", - * locationId: "S8GWD5R9QB376", - * planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - * customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", - * startDate: "2023-06-20", - * cardId: "ccof:qy5x8hHGYsgLrp4Q4GB", + * idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", + * location_id: "S8GWD5R9QB376", + * plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + * customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + * start_date: "2023-06-20", + * card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", * timezone: "America/Los_Angeles", * source: { * name: "My Application" * }, * phases: [{ - * ordinal: 0, - * orderTemplateId: "U2NaowWxzXwpsZU697x7ZHOAnCNZY" + * ordinal: BigInt("0"), + * order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY" * }] * }) */ - public async create( + public create( request: Square.CreateSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.CreateSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateSubscriptionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateSubscriptionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -123,12 +124,14 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/subscriptions."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -142,58 +145,54 @@ export class Subscriptions { * * @example * await client.subscriptions.bulkSwapPlan({ - * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", - * oldPlanVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - * locationId: "S8GWD5R9QB376" + * new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * old_plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + * location_id: "S8GWD5R9QB376" * }) */ - public async bulkSwapPlan( + public bulkSwapPlan( + request: Square.BulkSwapPlanRequest, + requestOptions?: Subscriptions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__bulkSwapPlan(request, requestOptions)); + } + + private async __bulkSwapPlan( request: Square.BulkSwapPlanRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BulkSwapPlanRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BulkSwapPlanResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -202,6 +201,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -210,6 +210,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -237,60 +238,56 @@ export class Subscriptions { * await client.subscriptions.search({ * query: { * filter: { - * customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], - * locationIds: ["S8GWD5R9QB376"], - * sourceNames: ["My App"] + * customer_ids: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + * location_ids: ["S8GWD5R9QB376"], + * source_names: ["My App"] * } * } * }) */ - public async search( + public search( request: Square.SearchSubscriptionsRequest = {}, requestOptions?: Subscriptions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.SearchSubscriptionsRequest = {}, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchSubscriptionsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchSubscriptionsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -299,12 +296,14 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/subscriptions/search."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -317,59 +316,56 @@ export class Subscriptions { * * @example * await client.subscriptions.get({ - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * }) */ - public async get( + public get( request: Square.GetSubscriptionsRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, include } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetSubscriptionsRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, include } = request; const _queryParams: Record = {}; if (include !== undefined) { _queryParams["include"] = include; } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetSubscriptionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -378,6 +374,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -386,6 +383,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -399,60 +397,56 @@ export class Subscriptions { * * @example * await client.subscriptions.update({ - * subscriptionId: "subscription_id", + * subscription_id: "subscription_id", * subscription: { - * cardId: "{NEW CARD ID}" + * card_id: "{NEW CARD ID}" * } * }) */ - public async update( + public update( + request: Square.UpdateSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.UpdateSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateSubscriptionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateSubscriptionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -461,6 +455,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -469,6 +464,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -481,54 +477,54 @@ export class Subscriptions { * * @example * await client.subscriptions.deleteAction({ - * subscriptionId: "subscription_id", - * actionId: "action_id" + * subscription_id: "subscription_id", + * action_id: "action_id" * }) */ - public async deleteAction( + public deleteAction( request: Square.DeleteActionSubscriptionsRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, actionId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteAction(request, requestOptions)); + } + + private async __deleteAction( + request: Square.DeleteActionSubscriptionsRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, action_id: actionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteSubscriptionActionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -537,6 +533,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -545,6 +542,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -558,58 +556,57 @@ export class Subscriptions { * * @example * await client.subscriptions.changeBillingAnchorDate({ - * subscriptionId: "subscription_id", - * monthlyBillingAnchorDate: 1 + * subscription_id: "subscription_id", + * monthly_billing_anchor_date: 1 * }) */ - public async changeBillingAnchorDate( + public changeBillingAnchorDate( request: Square.ChangeBillingAnchorDateRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__changeBillingAnchorDate(request, requestOptions)); + } + + private async __changeBillingAnchorDate( + request: Square.ChangeBillingAnchorDateRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.ChangeBillingAnchorDateRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.ChangeBillingAnchorDateResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -618,6 +615,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -626,6 +624,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -640,53 +639,50 @@ export class Subscriptions { * * @example * await client.subscriptions.cancel({ - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * }) */ - public async cancel( + public cancel( + request: Square.CancelSubscriptionsRequest, + requestOptions?: Subscriptions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( request: Square.CancelSubscriptionsRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId } = request; + ): Promise> { + const { subscription_id: subscriptionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.CancelSubscriptionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -695,6 +691,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -703,6 +700,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -715,85 +713,86 @@ export class Subscriptions { * * @example * await client.subscriptions.listEvents({ - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * }) */ public async listEvents( request: Square.ListEventsSubscriptionsRequest, requestOptions?: Subscriptions.RequestOptions, ): Promise> { - const list = async ( - request: Square.ListEventsSubscriptionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.ListEventsSubscriptionsRequest, + ): Promise> => { + const { subscription_id: 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: core.url.join( + (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: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListSubscriptionEventsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { 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, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + 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, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, - getItems: (response) => response?.subscriptionEvents ?? [], + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.subscription_events ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); }, @@ -808,57 +807,53 @@ export class Subscriptions { * * @example * await client.subscriptions.pause({ - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * }) */ - public async pause( + public pause( request: Square.PauseSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__pause(request, requestOptions)); + } + + private async __pause( + request: Square.PauseSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.PauseSubscriptionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.PauseSubscriptionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -867,6 +862,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -875,6 +871,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -887,57 +884,53 @@ export class Subscriptions { * * @example * await client.subscriptions.resume({ - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * }) */ - public async resume( + public resume( + request: Square.ResumeSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__resume(request, requestOptions)); + } + + private async __resume( request: Square.ResumeSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.ResumeSubscriptionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.ResumeSubscriptionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -946,6 +939,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -954,6 +948,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -967,62 +962,58 @@ export class Subscriptions { * * @example * await client.subscriptions.swapPlan({ - * subscriptionId: "subscription_id", - * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * subscription_id: "subscription_id", + * new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", * phases: [{ - * ordinal: 0, - * orderTemplateId: "uhhnjH9osVv3shUADwaC0b3hNxQZY" + * ordinal: BigInt("0"), + * order_template_id: "uhhnjH9osVv3shUADwaC0b3hNxQZY" * }] * }) */ - public async swapPlan( + public swapPlan( request: Square.SwapPlanRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__swapPlan(request, requestOptions)); + } + + private async __swapPlan( + request: Square.SwapPlanRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SwapPlanRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.SwapPlanResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -1031,6 +1022,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -1039,6 +1031,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/subscriptions/client/index.ts b/src/api/resources/subscriptions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/subscriptions/client/index.ts +++ b/src/api/resources/subscriptions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts b/src/api/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts index b282183e2..ee558dc4d 100644 --- a/src/api/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts +++ b/src/api/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts @@ -5,9 +5,9 @@ /** * @example * { - * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", - * oldPlanVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - * locationId: "S8GWD5R9QB376" + * new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * old_plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + * location_id: "S8GWD5R9QB376" * } */ export interface BulkSwapPlanRequest { @@ -16,13 +16,13 @@ export interface BulkSwapPlanRequest { * * This field is required. */ - newPlanVariationId: string; + new_plan_variation_id: 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; + old_plan_variation_id: string; /** The ID of the location to associate with the swapped subscriptions. */ - locationId: string; + location_id: string; } diff --git a/src/api/resources/subscriptions/client/requests/CancelSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/CancelSubscriptionsRequest.ts index 5586bc2e5..cf59f6723 100644 --- a/src/api/resources/subscriptions/client/requests/CancelSubscriptionsRequest.ts +++ b/src/api/resources/subscriptions/client/requests/CancelSubscriptionsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * } */ export interface CancelSubscriptionsRequest { /** * The ID of the subscription to cancel. */ - subscriptionId: string; + subscription_id: string; } diff --git a/src/api/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts b/src/api/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts index 9c715ee5f..5c3387758 100644 --- a/src/api/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts +++ b/src/api/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * subscriptionId: "subscription_id", - * monthlyBillingAnchorDate: 1 + * subscription_id: "subscription_id", + * monthly_billing_anchor_date: 1 * } */ export interface ChangeBillingAnchorDateRequest { /** * The ID of the subscription to update the billing anchor date. */ - subscriptionId: string; + subscription_id: string; /** The anchor day for the billing cycle. */ - monthlyBillingAnchorDate?: number | null; + monthly_billing_anchor_date?: number | null; /** * The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes * place on the subscription. @@ -23,5 +23,5 @@ export interface ChangeBillingAnchorDateRequest { * When this date is unspecified or falls within the current billing cycle, the billing anchor date * is changed immediately. */ - effectiveDate?: string | null; + effective_date?: string | null; } diff --git a/src/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts b/src/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts index 027cf2e8c..22ffd51b5 100644 --- a/src/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts +++ b/src/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts @@ -2,24 +2,24 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", - * locationId: "S8GWD5R9QB376", - * planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - * customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", - * startDate: "2023-06-20", - * cardId: "ccof:qy5x8hHGYsgLrp4Q4GB", + * idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", + * location_id: "S8GWD5R9QB376", + * plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + * customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + * start_date: "2023-06-20", + * card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", * timezone: "America/Los_Angeles", * source: { * name: "My Application" * }, * phases: [{ - * ordinal: 0, - * orderTemplateId: "U2NaowWxzXwpsZU697x7ZHOAnCNZY" + * ordinal: BigInt("0"), + * order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY" * }] * } */ @@ -31,18 +31,18 @@ export interface CreateSubscriptionRequest { * * For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string; + idempotency_key?: string; /** The ID of the location the subscription is associated with. */ - locationId: string; + location_id: 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; + plan_variation_id?: string; /** The ID of the [customer](entity:Customer) subscribing to the subscription plan variation. */ - customerId: string; + customer_id: string; /** * The `YYYY-MM-DD`-formatted date to start the subscription. * If it is unspecified, the subscription starts immediately. */ - startDate?: string; + start_date?: string; /** * The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation. * @@ -54,25 +54,25 @@ export interface CreateSubscriptionRequest { * 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; + canceled_date?: 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; + tax_percentage?: 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; + price_override_money?: 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; + card_id?: 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". @@ -83,7 +83,7 @@ export interface CreateSubscriptionRequest { /** The origination details of the subscription. */ source?: Square.SubscriptionSource; /** The day-of-the-month to change the billing date to. */ - monthlyBillingAnchorDate?: number; + monthly_billing_anchor_date?: number; /** array of phases for this subscription */ phases?: Square.Phase[]; } diff --git a/src/api/resources/subscriptions/client/requests/DeleteActionSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/DeleteActionSubscriptionsRequest.ts index efbc64238..74bb06ea6 100644 --- a/src/api/resources/subscriptions/client/requests/DeleteActionSubscriptionsRequest.ts +++ b/src/api/resources/subscriptions/client/requests/DeleteActionSubscriptionsRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * subscriptionId: "subscription_id", - * actionId: "action_id" + * subscription_id: "subscription_id", + * action_id: "action_id" * } */ export interface DeleteActionSubscriptionsRequest { /** * The ID of the subscription the targeted action is to act upon. */ - subscriptionId: string; + subscription_id: string; /** * The ID of the targeted action to be deleted. */ - actionId: string; + action_id: string; } diff --git a/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts index 90b54e807..c31fd485d 100644 --- a/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts +++ b/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * } */ export interface GetSubscriptionsRequest { /** * The ID of the subscription to retrieve. */ - subscriptionId: string; + subscription_id: string; /** * A query parameter to specify related information to be included in the response. * diff --git a/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts index 85ef351a1..b964f23b6 100644 --- a/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts +++ b/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts @@ -5,14 +5,14 @@ /** * @example * { - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * } */ export interface ListEventsSubscriptionsRequest { /** * The ID of the subscription to retrieve the events for. */ - subscriptionId: string; + subscription_id: 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. diff --git a/src/api/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts b/src/api/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts index 1b7358f4f..05f4d3887 100644 --- a/src/api/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts +++ b/src/api/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts @@ -2,26 +2,26 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * } */ export interface PauseSubscriptionRequest { /** * The ID of the subscription to pause. */ - subscriptionId: string; + subscription_id: 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; + pause_effective_date?: string | null; /** * The number of billing cycles the subscription will be paused before it is reactivated. * @@ -29,18 +29,18 @@ export interface PauseSubscriptionRequest { * 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; + pause_cycle_duration?: (number | 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; + resume_effective_date?: 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; + resume_change_timing?: Square.ChangeTiming; /** The user-provided reason to pause the subscription. */ - pauseReason?: string | null; + pause_reason?: string | null; } diff --git a/src/api/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts b/src/api/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts index b0c1e5f91..7ea62be6e 100644 --- a/src/api/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts +++ b/src/api/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts @@ -2,25 +2,25 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * } */ export interface ResumeSubscriptionRequest { /** * The ID of the subscription to resume. */ - subscriptionId: string; + subscription_id: string; /** The `YYYY-MM-DD`-formatted date when the subscription reactivated. */ - resumeEffectiveDate?: string | null; + resume_effective_date?: 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; + resume_change_timing?: Square.ChangeTiming; } diff --git a/src/api/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts index cf4de613c..50439bfef 100644 --- a/src/api/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts +++ b/src/api/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * query: { * filter: { - * customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], - * locationIds: ["S8GWD5R9QB376"], - * sourceNames: ["My App"] + * customer_ids: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + * location_ids: ["S8GWD5R9QB376"], + * source_names: ["My App"] * } * } * } diff --git a/src/api/resources/subscriptions/client/requests/SwapPlanRequest.ts b/src/api/resources/subscriptions/client/requests/SwapPlanRequest.ts index 56fede5b6..d47ddb86e 100644 --- a/src/api/resources/subscriptions/client/requests/SwapPlanRequest.ts +++ b/src/api/resources/subscriptions/client/requests/SwapPlanRequest.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * subscriptionId: "subscription_id", - * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * subscription_id: "subscription_id", + * new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", * phases: [{ - * ordinal: 0, - * orderTemplateId: "uhhnjH9osVv3shUADwaC0b3hNxQZY" + * ordinal: BigInt("0"), + * order_template_id: "uhhnjH9osVv3shUADwaC0b3hNxQZY" * }] * } */ @@ -19,13 +19,13 @@ export interface SwapPlanRequest { /** * The ID of the subscription to swap the subscription plan for. */ - subscriptionId: string; + subscription_id: string; /** * The ID of the new subscription plan variation. * * This field is required. */ - newPlanVariationId?: string | null; + new_plan_variation_id?: 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 index 2f2e513e5..648f4bf7a 100644 --- a/src/api/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts +++ b/src/api/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * subscriptionId: "subscription_id", + * subscription_id: "subscription_id", * subscription: { - * cardId: "{NEW CARD ID}" + * card_id: "{NEW CARD ID}" * } * } */ @@ -17,7 +17,7 @@ export interface UpdateSubscriptionRequest { /** * The ID of the subscription to update. */ - subscriptionId: string; + subscription_id: 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 diff --git a/src/api/resources/subscriptions/client/requests/index.ts b/src/api/resources/subscriptions/client/requests/index.ts index e79da906c..a519bf842 100644 --- a/src/api/resources/subscriptions/client/requests/index.ts +++ b/src/api/resources/subscriptions/client/requests/index.ts @@ -1,12 +1,12 @@ -export { type CreateSubscriptionRequest } from "./CreateSubscriptionRequest"; -export { type BulkSwapPlanRequest } from "./BulkSwapPlanRequest"; -export { type SearchSubscriptionsRequest } from "./SearchSubscriptionsRequest"; -export { type GetSubscriptionsRequest } from "./GetSubscriptionsRequest"; -export { type UpdateSubscriptionRequest } from "./UpdateSubscriptionRequest"; -export { type DeleteActionSubscriptionsRequest } from "./DeleteActionSubscriptionsRequest"; -export { type ChangeBillingAnchorDateRequest } from "./ChangeBillingAnchorDateRequest"; -export { type CancelSubscriptionsRequest } from "./CancelSubscriptionsRequest"; -export { type ListEventsSubscriptionsRequest } from "./ListEventsSubscriptionsRequest"; -export { type PauseSubscriptionRequest } from "./PauseSubscriptionRequest"; -export { type ResumeSubscriptionRequest } from "./ResumeSubscriptionRequest"; -export { type SwapPlanRequest } from "./SwapPlanRequest"; +export { type CreateSubscriptionRequest } from "./CreateSubscriptionRequest.js"; +export { type BulkSwapPlanRequest } from "./BulkSwapPlanRequest.js"; +export { type SearchSubscriptionsRequest } from "./SearchSubscriptionsRequest.js"; +export { type GetSubscriptionsRequest } from "./GetSubscriptionsRequest.js"; +export { type UpdateSubscriptionRequest } from "./UpdateSubscriptionRequest.js"; +export { type DeleteActionSubscriptionsRequest } from "./DeleteActionSubscriptionsRequest.js"; +export { type ChangeBillingAnchorDateRequest } from "./ChangeBillingAnchorDateRequest.js"; +export { type CancelSubscriptionsRequest } from "./CancelSubscriptionsRequest.js"; +export { type ListEventsSubscriptionsRequest } from "./ListEventsSubscriptionsRequest.js"; +export { type PauseSubscriptionRequest } from "./PauseSubscriptionRequest.js"; +export { type ResumeSubscriptionRequest } from "./ResumeSubscriptionRequest.js"; +export { type SwapPlanRequest } from "./SwapPlanRequest.js"; diff --git a/src/api/resources/subscriptions/index.ts b/src/api/resources/subscriptions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/subscriptions/index.ts +++ b/src/api/resources/subscriptions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/team/client/Client.ts b/src/api/resources/team/client/Client.ts index c93e3937c..b3be78bd3 100644 --- a/src/api/resources/team/client/Client.ts +++ b/src/api/resources/team/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Team { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Team { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Team { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Team { - constructor(protected readonly _options: Team.Options = {}) {} + protected readonly _options: Team.Options; + + constructor(_options: Team.Options = {}) { + this._options = _options; + } /** * Lists jobs in a seller account. Results are sorted by title in ascending order. @@ -46,10 +51,17 @@ export class Team { * @example * await client.team.listJobs() */ - public async listJobs( + public listJobs( + request: Square.ListJobsRequest = {}, + requestOptions?: Team.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listJobs(request, requestOptions)); + } + + private async __listJobs( request: Square.ListJobsRequest = {}, requestOptions?: Team.RequestOptions, - ): Promise { + ): Promise> { const { cursor } = request; const _queryParams: Record = {}; if (cursor !== undefined) { @@ -57,45 +69,35 @@ export class Team { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.ListJobsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -104,12 +106,14 @@ export class Team { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -125,58 +129,54 @@ export class Team { * await client.team.createJob({ * job: { * title: "Cashier", - * isTipEligible: true + * is_tip_eligible: true * }, - * idempotencyKey: "idempotency-key-0" + * idempotency_key: "idempotency-key-0" * }) */ - public async createJob( + public createJob( request: Square.CreateJobRequest, requestOptions?: Team.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createJob(request, requestOptions)); + } + + private async __createJob( + request: Square.CreateJobRequest, + requestOptions?: Team.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateJobRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateJobResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -185,12 +185,14 @@ export class Team { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -203,53 +205,50 @@ export class Team { * * @example * await client.team.retrieveJob({ - * jobId: "job_id" + * job_id: "job_id" * }) */ - public async retrieveJob( + public retrieveJob( + request: Square.RetrieveJobRequest, + requestOptions?: Team.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveJob(request, requestOptions)); + } + + private async __retrieveJob( request: Square.RetrieveJobRequest, requestOptions?: Team.RequestOptions, - ): Promise { - const { jobId } = request; + ): Promise> { + const { job_id: jobId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.RetrieveJobResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -258,6 +257,7 @@ export class Team { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -266,6 +266,7 @@ export class Team { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -280,61 +281,57 @@ export class Team { * * @example * await client.team.updateJob({ - * jobId: "job_id", + * job_id: "job_id", * job: { * title: "Cashier 1", - * isTipEligible: true + * is_tip_eligible: true * } * }) */ - public async updateJob( + public updateJob( request: Square.UpdateJobRequest, requestOptions?: Team.RequestOptions, - ): Promise { - const { jobId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateJob(request, requestOptions)); + } + + private async __updateJob( + request: Square.UpdateJobRequest, + requestOptions?: Team.RequestOptions, + ): Promise> { + const { job_id: jobId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateJobRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateJobResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -343,6 +340,7 @@ export class Team { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -351,6 +349,7 @@ export class Team { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/team/client/index.ts b/src/api/resources/team/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/team/client/index.ts +++ b/src/api/resources/team/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/team/client/requests/CreateJobRequest.ts b/src/api/resources/team/client/requests/CreateJobRequest.ts index 168657c5b..a95b844c5 100644 --- a/src/api/resources/team/client/requests/CreateJobRequest.ts +++ b/src/api/resources/team/client/requests/CreateJobRequest.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * job: { * title: "Cashier", - * isTipEligible: true + * is_tip_eligible: true * }, - * idempotencyKey: "idempotency-key-0" + * idempotency_key: "idempotency-key-0" * } */ export interface CreateJobRequest { @@ -22,5 +22,5 @@ export interface CreateJobRequest { * 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; + idempotency_key: string; } diff --git a/src/api/resources/team/client/requests/RetrieveJobRequest.ts b/src/api/resources/team/client/requests/RetrieveJobRequest.ts index a4b709eb1..32fd9e9d8 100644 --- a/src/api/resources/team/client/requests/RetrieveJobRequest.ts +++ b/src/api/resources/team/client/requests/RetrieveJobRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * jobId: "job_id" + * job_id: "job_id" * } */ export interface RetrieveJobRequest { /** * The ID of the job to retrieve. */ - jobId: string; + job_id: string; } diff --git a/src/api/resources/team/client/requests/UpdateJobRequest.ts b/src/api/resources/team/client/requests/UpdateJobRequest.ts index 2889c5bab..f1ee90dbb 100644 --- a/src/api/resources/team/client/requests/UpdateJobRequest.ts +++ b/src/api/resources/team/client/requests/UpdateJobRequest.ts @@ -2,15 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * jobId: "job_id", + * job_id: "job_id", * job: { * title: "Cashier 1", - * isTipEligible: true + * is_tip_eligible: true * } * } */ @@ -18,7 +18,7 @@ export interface UpdateJobRequest { /** * The ID of the job to update. */ - jobId: string; + job_id: 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. diff --git a/src/api/resources/team/client/requests/index.ts b/src/api/resources/team/client/requests/index.ts index 1ade5cbcb..25893d027 100644 --- a/src/api/resources/team/client/requests/index.ts +++ b/src/api/resources/team/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type ListJobsRequest } from "./ListJobsRequest"; -export { type CreateJobRequest } from "./CreateJobRequest"; -export { type RetrieveJobRequest } from "./RetrieveJobRequest"; -export { type UpdateJobRequest } from "./UpdateJobRequest"; +export { type ListJobsRequest } from "./ListJobsRequest.js"; +export { type CreateJobRequest } from "./CreateJobRequest.js"; +export { type RetrieveJobRequest } from "./RetrieveJobRequest.js"; +export { type UpdateJobRequest } from "./UpdateJobRequest.js"; diff --git a/src/api/resources/team/index.ts b/src/api/resources/team/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/team/index.ts +++ b/src/api/resources/team/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/teamMembers/client/Client.ts b/src/api/resources/teamMembers/client/Client.ts index ab0aef909..27faee9c0 100644 --- a/src/api/resources/teamMembers/client/Client.ts +++ b/src/api/resources/teamMembers/client/Client.ts @@ -2,13 +2,12 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { WageSetting } from "../resources/wageSetting/client/Client.js"; export declare namespace TeamMembers { export interface Options { @@ -18,6 +17,8 @@ export declare namespace TeamMembers { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -31,14 +32,17 @@ export declare namespace TeamMembers { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class TeamMembers { + protected readonly _options: TeamMembers.Options; protected _wageSetting: WageSetting | undefined; - constructor(protected readonly _options: TeamMembers.Options = {}) {} + constructor(_options: TeamMembers.Options = {}) { + this._options = _options; + } public get wageSetting(): WageSetting { return (this._wageSetting ??= new WageSetting(this._options)); @@ -57,87 +61,83 @@ export class TeamMembers { * * @example * await client.teamMembers.create({ - * idempotencyKey: "idempotency-key-0", - * teamMember: { - * referenceId: "reference_id_1", + * idempotency_key: "idempotency-key-0", + * team_member: { + * reference_id: "reference_id_1", * status: "ACTIVE", - * givenName: "Joe", - * familyName: "Doe", - * emailAddress: "joe_doe@gmail.com", - * phoneNumber: "+14159283333", - * assignedLocations: { - * assignmentType: "EXPLICIT_LOCATIONS", - * locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] + * given_name: "Joe", + * family_name: "Doe", + * email_address: "joe_doe@gmail.com", + * phone_number: "+14159283333", + * assigned_locations: { + * assignment_type: "EXPLICIT_LOCATIONS", + * location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] * }, - * wageSetting: { - * jobAssignments: [{ - * payType: "SALARY", - * annualRate: { - * amount: 3000000, + * wage_setting: { + * job_assignments: [{ + * pay_type: "SALARY", + * annual_rate: { + * amount: BigInt("3000000"), * currency: "USD" * }, - * weeklyHours: 40, - * jobId: "FjS8x95cqHiMenw4f1NAUH4P" + * weekly_hours: 40, + * job_id: "FjS8x95cqHiMenw4f1NAUH4P" * }, { - * payType: "HOURLY", - * hourlyRate: { - * amount: 2000, + * pay_type: "HOURLY", + * hourly_rate: { + * amount: BigInt("2000"), * currency: "USD" * }, - * jobId: "VDNpRv8da51NU8qZFC5zDWpF" + * job_id: "VDNpRv8da51NU8qZFC5zDWpF" * }], - * isOvertimeExempt: true + * is_overtime_exempt: true * } * } * }) */ - public async create( + public create( + request: Square.CreateTeamMemberRequest, + requestOptions?: TeamMembers.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.CreateTeamMemberRequest, requestOptions?: TeamMembers.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateTeamMemberRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateTeamMemberResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -146,12 +146,14 @@ export class TeamMembers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/team-members."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -169,82 +171,81 @@ export class TeamMembers { * * @example * await client.teamMembers.batchCreate({ - * teamMembers: { + * team_members: { * "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"] + * team_member: { + * reference_id: "reference_id_1", + * given_name: "Joe", + * family_name: "Doe", + * email_address: "joe_doe@gmail.com", + * phone_number: "+14159283333", + * assigned_locations: { + * assignment_type: "EXPLICIT_LOCATIONS", + * location_ids: ["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" + * team_member: { + * reference_id: "reference_id_2", + * given_name: "Jane", + * family_name: "Smith", + * email_address: "jane_smith@gmail.com", + * phone_number: "+14159223334", + * assigned_locations: { + * assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" * } * } * } * } * }) */ - public async batchCreate( + public batchCreate( + request: Square.BatchCreateTeamMembersRequest, + requestOptions?: TeamMembers.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchCreate(request, requestOptions)); + } + + private async __batchCreate( request: Square.BatchCreateTeamMembersRequest, requestOptions?: TeamMembers.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchCreateTeamMembersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchCreateTeamMembersResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -253,12 +254,14 @@ export class TeamMembers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -275,86 +278,85 @@ export class TeamMembers { * * @example * await client.teamMembers.batchUpdate({ - * teamMembers: { + * team_members: { * "AFMwA08kR-MIF-3Vs0OE": { - * teamMember: { - * referenceId: "reference_id_2", - * isOwner: false, + * team_member: { + * reference_id: "reference_id_2", + * is_owner: false, * status: "ACTIVE", - * givenName: "Jane", - * familyName: "Smith", - * emailAddress: "jane_smith@gmail.com", - * phoneNumber: "+14159223334", - * assignedLocations: { - * assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS" + * given_name: "Jane", + * family_name: "Smith", + * email_address: "jane_smith@gmail.com", + * phone_number: "+14159223334", + * assigned_locations: { + * assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" * } * } * }, * "fpgteZNMaf0qOK-a4t6P": { - * teamMember: { - * referenceId: "reference_id_1", - * isOwner: false, + * team_member: { + * reference_id: "reference_id_1", + * is_owner: false, * status: "ACTIVE", - * givenName: "Joe", - * familyName: "Doe", - * emailAddress: "joe_doe@gmail.com", - * phoneNumber: "+14159283333", - * assignedLocations: { - * assignmentType: "EXPLICIT_LOCATIONS", - * locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] + * given_name: "Joe", + * family_name: "Doe", + * email_address: "joe_doe@gmail.com", + * phone_number: "+14159283333", + * assigned_locations: { + * assignment_type: "EXPLICIT_LOCATIONS", + * location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] * } * } * } * } * }) */ - public async batchUpdate( + public batchUpdate( + request: Square.BatchUpdateTeamMembersRequest, + requestOptions?: TeamMembers.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpdate(request, requestOptions)); + } + + private async __batchUpdate( request: Square.BatchUpdateTeamMembersRequest, requestOptions?: TeamMembers.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchUpdateTeamMembersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.BatchUpdateTeamMembersResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -363,12 +365,14 @@ export class TeamMembers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -385,60 +389,56 @@ export class TeamMembers { * await client.teamMembers.search({ * query: { * filter: { - * locationIds: ["0G5P3VGACMMQZ"], + * location_ids: ["0G5P3VGACMMQZ"], * status: "ACTIVE" * } * }, * limit: 10 * }) */ - public async search( + public search( request: Square.SearchTeamMembersRequest = {}, requestOptions?: TeamMembers.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.SearchTeamMembersRequest = {}, + requestOptions?: TeamMembers.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchTeamMembersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchTeamMembersResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -447,12 +447,14 @@ export class TeamMembers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -466,53 +468,50 @@ export class TeamMembers { * * @example * await client.teamMembers.get({ - * teamMemberId: "team_member_id" + * team_member_id: "team_member_id" * }) */ - public async get( + public get( request: Square.GetTeamMembersRequest, requestOptions?: TeamMembers.RequestOptions, - ): Promise { - const { teamMemberId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetTeamMembersRequest, + requestOptions?: TeamMembers.RequestOptions, + ): Promise> { + const { team_member_id: teamMemberId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetTeamMemberResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -521,6 +520,7 @@ export class TeamMembers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -529,6 +529,7 @@ export class TeamMembers { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -542,90 +543,86 @@ export class TeamMembers { * * @example * await client.teamMembers.update({ - * teamMemberId: "team_member_id", + * team_member_id: "team_member_id", * body: { - * teamMember: { - * referenceId: "reference_id_1", + * team_member: { + * reference_id: "reference_id_1", * status: "ACTIVE", - * givenName: "Joe", - * familyName: "Doe", - * emailAddress: "joe_doe@gmail.com", - * phoneNumber: "+14159283333", - * assignedLocations: { - * assignmentType: "EXPLICIT_LOCATIONS", - * locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] + * given_name: "Joe", + * family_name: "Doe", + * email_address: "joe_doe@gmail.com", + * phone_number: "+14159283333", + * assigned_locations: { + * assignment_type: "EXPLICIT_LOCATIONS", + * location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] * }, - * wageSetting: { - * jobAssignments: [{ - * payType: "SALARY", - * annualRate: { - * amount: 3000000, + * wage_setting: { + * job_assignments: [{ + * pay_type: "SALARY", + * annual_rate: { + * amount: BigInt("3000000"), * currency: "USD" * }, - * weeklyHours: 40, - * jobId: "FjS8x95cqHiMenw4f1NAUH4P" + * weekly_hours: 40, + * job_id: "FjS8x95cqHiMenw4f1NAUH4P" * }, { - * payType: "HOURLY", - * hourlyRate: { - * amount: 1200, + * pay_type: "HOURLY", + * hourly_rate: { + * amount: BigInt("1200"), * currency: "USD" * }, - * jobId: "VDNpRv8da51NU8qZFC5zDWpF" + * job_id: "VDNpRv8da51NU8qZFC5zDWpF" * }], - * isOvertimeExempt: true + * is_overtime_exempt: true * } * } * } * }) */ - public async update( + public update( request: Square.UpdateTeamMembersRequest, requestOptions?: TeamMembers.RequestOptions, - ): Promise { - const { teamMemberId, body: _body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.UpdateTeamMembersRequest, + requestOptions?: TeamMembers.RequestOptions, + ): Promise> { + const { team_member_id: teamMemberId, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateTeamMemberRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateTeamMemberResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -634,6 +631,7 @@ export class TeamMembers { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -642,6 +640,7 @@ export class TeamMembers { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/teamMembers/client/index.ts b/src/api/resources/teamMembers/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/teamMembers/client/index.ts +++ b/src/api/resources/teamMembers/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts index b14d89bb5..fdb4e802e 100644 --- a/src/api/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts +++ b/src/api/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts @@ -2,34 +2,34 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * teamMembers: { + * team_members: { * "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"] + * team_member: { + * reference_id: "reference_id_1", + * given_name: "Joe", + * family_name: "Doe", + * email_address: "joe_doe@gmail.com", + * phone_number: "+14159283333", + * assigned_locations: { + * assignment_type: "EXPLICIT_LOCATIONS", + * location_ids: ["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" + * team_member: { + * reference_id: "reference_id_2", + * given_name: "Jane", + * family_name: "Smith", + * email_address: "jane_smith@gmail.com", + * phone_number: "+14159223334", + * assigned_locations: { + * assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" * } * } * } @@ -44,5 +44,5 @@ export interface BatchCreateTeamMembersRequest { * 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; + team_members: Record; } diff --git a/src/api/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts index a29378d92..535d76e20 100644 --- a/src/api/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts +++ b/src/api/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts @@ -2,38 +2,38 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * teamMembers: { + * team_members: { * "AFMwA08kR-MIF-3Vs0OE": { - * teamMember: { - * referenceId: "reference_id_2", - * isOwner: false, + * team_member: { + * reference_id: "reference_id_2", + * is_owner: false, * status: "ACTIVE", - * givenName: "Jane", - * familyName: "Smith", - * emailAddress: "jane_smith@gmail.com", - * phoneNumber: "+14159223334", - * assignedLocations: { - * assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS" + * given_name: "Jane", + * family_name: "Smith", + * email_address: "jane_smith@gmail.com", + * phone_number: "+14159223334", + * assigned_locations: { + * assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" * } * } * }, * "fpgteZNMaf0qOK-a4t6P": { - * teamMember: { - * referenceId: "reference_id_1", - * isOwner: false, + * team_member: { + * reference_id: "reference_id_1", + * is_owner: false, * status: "ACTIVE", - * givenName: "Joe", - * familyName: "Doe", - * emailAddress: "joe_doe@gmail.com", - * phoneNumber: "+14159283333", - * assignedLocations: { - * assignmentType: "EXPLICIT_LOCATIONS", - * locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] + * given_name: "Joe", + * family_name: "Doe", + * email_address: "joe_doe@gmail.com", + * phone_number: "+14159283333", + * assigned_locations: { + * assignment_type: "EXPLICIT_LOCATIONS", + * location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] * } * } * } @@ -49,5 +49,5 @@ export interface BatchUpdateTeamMembersRequest { * 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; + team_members: Record; } diff --git a/src/api/resources/teamMembers/client/requests/GetTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/GetTeamMembersRequest.ts index a8b345f61..75d5d7e35 100644 --- a/src/api/resources/teamMembers/client/requests/GetTeamMembersRequest.ts +++ b/src/api/resources/teamMembers/client/requests/GetTeamMembersRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * teamMemberId: "team_member_id" + * team_member_id: "team_member_id" * } */ export interface GetTeamMembersRequest { /** * The ID of the team member to retrieve. */ - teamMemberId: string; + team_member_id: string; } diff --git a/src/api/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts index 2e097261d..5f921084c 100644 --- a/src/api/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts +++ b/src/api/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { * query: { * filter: { - * locationIds: ["0G5P3VGACMMQZ"], + * location_ids: ["0G5P3VGACMMQZ"], * status: "ACTIVE" * } * }, diff --git a/src/api/resources/teamMembers/client/requests/UpdateTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/UpdateTeamMembersRequest.ts index 65c4da3d9..fb91af12b 100644 --- a/src/api/resources/teamMembers/client/requests/UpdateTeamMembersRequest.ts +++ b/src/api/resources/teamMembers/client/requests/UpdateTeamMembersRequest.ts @@ -2,42 +2,42 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * teamMemberId: "team_member_id", + * team_member_id: "team_member_id", * body: { - * teamMember: { - * referenceId: "reference_id_1", + * team_member: { + * reference_id: "reference_id_1", * status: "ACTIVE", - * givenName: "Joe", - * familyName: "Doe", - * emailAddress: "joe_doe@gmail.com", - * phoneNumber: "+14159283333", - * assignedLocations: { - * assignmentType: "EXPLICIT_LOCATIONS", - * locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] + * given_name: "Joe", + * family_name: "Doe", + * email_address: "joe_doe@gmail.com", + * phone_number: "+14159283333", + * assigned_locations: { + * assignment_type: "EXPLICIT_LOCATIONS", + * location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"] * }, - * wageSetting: { - * jobAssignments: [{ - * payType: "SALARY", - * annualRate: { - * amount: 3000000, + * wage_setting: { + * job_assignments: [{ + * pay_type: "SALARY", + * annual_rate: { + * amount: BigInt("3000000"), * currency: "USD" * }, - * weeklyHours: 40, - * jobId: "FjS8x95cqHiMenw4f1NAUH4P" + * weekly_hours: 40, + * job_id: "FjS8x95cqHiMenw4f1NAUH4P" * }, { - * payType: "HOURLY", - * hourlyRate: { - * amount: 1200, + * pay_type: "HOURLY", + * hourly_rate: { + * amount: BigInt("1200"), * currency: "USD" * }, - * jobId: "VDNpRv8da51NU8qZFC5zDWpF" + * job_id: "VDNpRv8da51NU8qZFC5zDWpF" * }], - * isOvertimeExempt: true + * is_overtime_exempt: true * } * } * } @@ -47,6 +47,6 @@ export interface UpdateTeamMembersRequest { /** * The ID of the team member to update. */ - teamMemberId: string; + team_member_id: string; body: Square.UpdateTeamMemberRequest; } diff --git a/src/api/resources/teamMembers/client/requests/index.ts b/src/api/resources/teamMembers/client/requests/index.ts index 64e675afc..f22272813 100644 --- a/src/api/resources/teamMembers/client/requests/index.ts +++ b/src/api/resources/teamMembers/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type BatchCreateTeamMembersRequest } from "./BatchCreateTeamMembersRequest"; -export { type BatchUpdateTeamMembersRequest } from "./BatchUpdateTeamMembersRequest"; -export { type SearchTeamMembersRequest } from "./SearchTeamMembersRequest"; -export { type GetTeamMembersRequest } from "./GetTeamMembersRequest"; -export { type UpdateTeamMembersRequest } from "./UpdateTeamMembersRequest"; +export { type BatchCreateTeamMembersRequest } from "./BatchCreateTeamMembersRequest.js"; +export { type BatchUpdateTeamMembersRequest } from "./BatchUpdateTeamMembersRequest.js"; +export { type SearchTeamMembersRequest } from "./SearchTeamMembersRequest.js"; +export { type GetTeamMembersRequest } from "./GetTeamMembersRequest.js"; +export { type UpdateTeamMembersRequest } from "./UpdateTeamMembersRequest.js"; diff --git a/src/api/resources/teamMembers/index.ts b/src/api/resources/teamMembers/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/teamMembers/index.ts +++ b/src/api/resources/teamMembers/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/teamMembers/resources/index.ts b/src/api/resources/teamMembers/resources/index.ts index 921a5bbe9..4758813aa 100644 --- a/src/api/resources/teamMembers/resources/index.ts +++ b/src/api/resources/teamMembers/resources/index.ts @@ -1,2 +1,2 @@ -export * as wageSetting from "./wageSetting"; -export * from "./wageSetting/client/requests"; +export * as wageSetting from "./wageSetting/index.js"; +export * from "./wageSetting/client/requests/index.js"; diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts b/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts index bcfc8f5cb..7002a8317 100644 --- a/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts +++ b/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace WageSetting { export interface Options { @@ -17,6 +16,8 @@ export declare namespace WageSetting { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace WageSetting { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class WageSetting { - constructor(protected readonly _options: WageSetting.Options = {}) {} + protected readonly _options: WageSetting.Options; + + constructor(_options: WageSetting.Options = {}) { + this._options = _options; + } /** * Retrieves a `WageSetting` object for a team member specified @@ -50,53 +55,50 @@ export class WageSetting { * * @example * await client.teamMembers.wageSetting.get({ - * teamMemberId: "team_member_id" + * team_member_id: "team_member_id" * }) */ - public async get( + public get( + request: Square.teamMembers.GetWageSettingRequest, + requestOptions?: WageSetting.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.teamMembers.GetWageSettingRequest, requestOptions?: WageSetting.RequestOptions, - ): Promise { - const { teamMemberId } = request; + ): Promise> { + const { team_member_id: teamMemberId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetWageSettingResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -105,6 +107,7 @@ export class WageSetting { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -113,6 +116,7 @@ export class WageSetting { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -132,76 +136,72 @@ export class WageSetting { * * @example * await client.teamMembers.wageSetting.update({ - * teamMemberId: "team_member_id", - * wageSetting: { - * jobAssignments: [{ - * jobTitle: "Manager", - * payType: "SALARY", - * annualRate: { - * amount: 3000000, + * team_member_id: "team_member_id", + * wage_setting: { + * job_assignments: [{ + * job_title: "Manager", + * pay_type: "SALARY", + * annual_rate: { + * amount: BigInt("3000000"), * currency: "USD" * }, - * weeklyHours: 40 + * weekly_hours: 40 * }, { - * jobTitle: "Cashier", - * payType: "HOURLY", - * hourlyRate: { - * amount: 2000, + * job_title: "Cashier", + * pay_type: "HOURLY", + * hourly_rate: { + * amount: BigInt("2000"), * currency: "USD" * } * }], - * isOvertimeExempt: true + * is_overtime_exempt: true * } * }) */ - public async update( + public update( + request: Square.teamMembers.UpdateWageSettingRequest, + requestOptions?: WageSetting.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( request: Square.teamMembers.UpdateWageSettingRequest, requestOptions?: WageSetting.RequestOptions, - ): Promise { - const { teamMemberId, ..._body } = request; + ): Promise> { + const { team_member_id: teamMemberId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.teamMembers.UpdateWageSettingRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateWageSettingResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -210,6 +210,7 @@ export class WageSetting { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -218,6 +219,7 @@ export class WageSetting { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/index.ts b/src/api/resources/teamMembers/resources/wageSetting/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/teamMembers/resources/wageSetting/client/index.ts +++ b/src/api/resources/teamMembers/resources/wageSetting/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/requests/GetWageSettingRequest.ts b/src/api/resources/teamMembers/resources/wageSetting/client/requests/GetWageSettingRequest.ts index 81df49508..b638c99b8 100644 --- a/src/api/resources/teamMembers/resources/wageSetting/client/requests/GetWageSettingRequest.ts +++ b/src/api/resources/teamMembers/resources/wageSetting/client/requests/GetWageSettingRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * teamMemberId: "team_member_id" + * team_member_id: "team_member_id" * } */ export interface GetWageSettingRequest { /** * The ID of the team member for which to retrieve the wage setting. */ - teamMemberId: string; + team_member_id: string; } diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts b/src/api/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts index 2714623e6..562abc9d6 100644 --- a/src/api/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts +++ b/src/api/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts @@ -2,30 +2,30 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * teamMemberId: "team_member_id", - * wageSetting: { - * jobAssignments: [{ - * jobTitle: "Manager", - * payType: "SALARY", - * annualRate: { - * amount: 3000000, + * team_member_id: "team_member_id", + * wage_setting: { + * job_assignments: [{ + * job_title: "Manager", + * pay_type: "SALARY", + * annual_rate: { + * amount: BigInt("3000000"), * currency: "USD" * }, - * weeklyHours: 40 + * weekly_hours: 40 * }, { - * jobTitle: "Cashier", - * payType: "HOURLY", - * hourlyRate: { - * amount: 2000, + * job_title: "Cashier", + * pay_type: "HOURLY", + * hourly_rate: { + * amount: BigInt("2000"), * currency: "USD" * } * }], - * isOvertimeExempt: true + * is_overtime_exempt: true * } * } */ @@ -33,7 +33,7 @@ export interface UpdateWageSettingRequest { /** * The ID of the team member for which to update the `WageSetting` object. */ - teamMemberId: string; + team_member_id: 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. @@ -41,5 +41,5 @@ export interface UpdateWageSettingRequest { * - `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; + wage_setting: Square.WageSetting; } diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/requests/index.ts b/src/api/resources/teamMembers/resources/wageSetting/client/requests/index.ts index 68850acfa..2be3bcfc1 100644 --- a/src/api/resources/teamMembers/resources/wageSetting/client/requests/index.ts +++ b/src/api/resources/teamMembers/resources/wageSetting/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type GetWageSettingRequest } from "./GetWageSettingRequest"; -export { type UpdateWageSettingRequest } from "./UpdateWageSettingRequest"; +export { type GetWageSettingRequest } from "./GetWageSettingRequest.js"; +export { type UpdateWageSettingRequest } from "./UpdateWageSettingRequest.js"; diff --git a/src/api/resources/teamMembers/resources/wageSetting/index.ts b/src/api/resources/teamMembers/resources/wageSetting/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/teamMembers/resources/wageSetting/index.ts +++ b/src/api/resources/teamMembers/resources/wageSetting/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/terminal/client/Client.ts b/src/api/resources/terminal/client/Client.ts index cee4c37ad..1d7586dfe 100644 --- a/src/api/resources/terminal/client/Client.ts +++ b/src/api/resources/terminal/client/Client.ts @@ -2,15 +2,14 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; +import { Actions } from "../resources/actions/client/Client.js"; +import { Checkouts } from "../resources/checkouts/client/Client.js"; +import { Refunds } from "../resources/refunds/client/Client.js"; export declare namespace Terminal { export interface Options { @@ -20,6 +19,8 @@ export declare namespace Terminal { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -33,16 +34,19 @@ export declare namespace Terminal { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Terminal { + protected readonly _options: Terminal.Options; protected _actions: Actions | undefined; protected _checkouts: Checkouts | undefined; protected _refunds: Refunds | undefined; - constructor(protected readonly _options: Terminal.Options = {}) {} + constructor(_options: Terminal.Options = {}) { + this._options = _options; + } public get actions(): Actions { return (this._actions ??= new Actions(this._options)); @@ -66,53 +70,50 @@ export class Terminal { * * @example * await client.terminal.dismissTerminalAction({ - * actionId: "action_id" + * action_id: "action_id" * }) */ - public async dismissTerminalAction( + public dismissTerminalAction( + request: Square.DismissTerminalActionRequest, + requestOptions?: Terminal.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__dismissTerminalAction(request, requestOptions)); + } + + private async __dismissTerminalAction( request: Square.DismissTerminalActionRequest, requestOptions?: Terminal.RequestOptions, - ): Promise { - const { actionId } = request; + ): Promise> { + const { action_id: actionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DismissTerminalActionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -121,6 +122,7 @@ export class Terminal { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -129,6 +131,7 @@ export class Terminal { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -141,53 +144,53 @@ export class Terminal { * * @example * await client.terminal.dismissTerminalCheckout({ - * checkoutId: "checkout_id" + * checkout_id: "checkout_id" * }) */ - public async dismissTerminalCheckout( + public dismissTerminalCheckout( request: Square.DismissTerminalCheckoutRequest, requestOptions?: Terminal.RequestOptions, - ): Promise { - const { checkoutId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__dismissTerminalCheckout(request, requestOptions)); + } + + private async __dismissTerminalCheckout( + request: Square.DismissTerminalCheckoutRequest, + requestOptions?: Terminal.RequestOptions, + ): Promise> { + const { checkout_id: checkoutId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DismissTerminalCheckoutResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -196,6 +199,7 @@ export class Terminal { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -204,6 +208,7 @@ export class Terminal { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -216,53 +221,50 @@ export class Terminal { * * @example * await client.terminal.dismissTerminalRefund({ - * terminalRefundId: "terminal_refund_id" + * terminal_refund_id: "terminal_refund_id" * }) */ - public async dismissTerminalRefund( + public dismissTerminalRefund( request: Square.DismissTerminalRefundRequest, requestOptions?: Terminal.RequestOptions, - ): Promise { - const { terminalRefundId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__dismissTerminalRefund(request, requestOptions)); + } + + private async __dismissTerminalRefund( + request: Square.DismissTerminalRefundRequest, + requestOptions?: Terminal.RequestOptions, + ): Promise> { + const { terminal_refund_id: terminalRefundId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.DismissTerminalRefundResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -271,6 +273,7 @@ export class Terminal { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -279,6 +282,7 @@ export class Terminal { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/terminal/client/index.ts b/src/api/resources/terminal/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/terminal/client/index.ts +++ b/src/api/resources/terminal/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/terminal/client/requests/DismissTerminalActionRequest.ts b/src/api/resources/terminal/client/requests/DismissTerminalActionRequest.ts index 950b3ab0c..bf50edc65 100644 --- a/src/api/resources/terminal/client/requests/DismissTerminalActionRequest.ts +++ b/src/api/resources/terminal/client/requests/DismissTerminalActionRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * actionId: "action_id" + * action_id: "action_id" * } */ export interface DismissTerminalActionRequest { /** * Unique ID for the `TerminalAction` associated with the action to be dismissed. */ - actionId: string; + action_id: string; } diff --git a/src/api/resources/terminal/client/requests/DismissTerminalCheckoutRequest.ts b/src/api/resources/terminal/client/requests/DismissTerminalCheckoutRequest.ts index 3ff7298a2..f511b8d3c 100644 --- a/src/api/resources/terminal/client/requests/DismissTerminalCheckoutRequest.ts +++ b/src/api/resources/terminal/client/requests/DismissTerminalCheckoutRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * checkoutId: "checkout_id" + * checkout_id: "checkout_id" * } */ export interface DismissTerminalCheckoutRequest { /** * Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed. */ - checkoutId: string; + checkout_id: string; } diff --git a/src/api/resources/terminal/client/requests/DismissTerminalRefundRequest.ts b/src/api/resources/terminal/client/requests/DismissTerminalRefundRequest.ts index 699bf5b40..2475efa67 100644 --- a/src/api/resources/terminal/client/requests/DismissTerminalRefundRequest.ts +++ b/src/api/resources/terminal/client/requests/DismissTerminalRefundRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * terminalRefundId: "terminal_refund_id" + * terminal_refund_id: "terminal_refund_id" * } */ export interface DismissTerminalRefundRequest { /** * Unique ID for the `TerminalRefund` associated with the refund to be dismissed. */ - terminalRefundId: string; + terminal_refund_id: string; } diff --git a/src/api/resources/terminal/client/requests/index.ts b/src/api/resources/terminal/client/requests/index.ts index f3e44661a..50ae476c3 100644 --- a/src/api/resources/terminal/client/requests/index.ts +++ b/src/api/resources/terminal/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type DismissTerminalActionRequest } from "./DismissTerminalActionRequest"; -export { type DismissTerminalCheckoutRequest } from "./DismissTerminalCheckoutRequest"; -export { type DismissTerminalRefundRequest } from "./DismissTerminalRefundRequest"; +export { type DismissTerminalActionRequest } from "./DismissTerminalActionRequest.js"; +export { type DismissTerminalCheckoutRequest } from "./DismissTerminalCheckoutRequest.js"; +export { type DismissTerminalRefundRequest } from "./DismissTerminalRefundRequest.js"; diff --git a/src/api/resources/terminal/index.ts b/src/api/resources/terminal/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/terminal/index.ts +++ b/src/api/resources/terminal/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/terminal/resources/actions/client/Client.ts b/src/api/resources/terminal/resources/actions/client/Client.ts index ae4217c5e..3a69bb3a8 100644 --- a/src/api/resources/terminal/resources/actions/client/Client.ts +++ b/src/api/resources/terminal/resources/actions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Actions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Actions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Actions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Actions { - constructor(protected readonly _options: Actions.Options = {}) {} + protected readonly _options: Actions.Options; + + constructor(_options: Actions.Options = {}) { + this._options = _options; + } /** * Creates a Terminal action request and sends it to the specified device. @@ -45,65 +50,61 @@ export class Actions { * * @example * await client.terminal.actions.create({ - * idempotencyKey: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + * idempotency_key: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", * action: { - * deviceId: "{{DEVICE_ID}}", - * deadlineDuration: "PT5M", + * device_id: "{{DEVICE_ID}}", + * deadline_duration: "PT5M", * type: "SAVE_CARD", - * saveCardOptions: { - * customerId: "{{CUSTOMER_ID}}", - * referenceId: "user-id-1" + * save_card_options: { + * customer_id: "{{CUSTOMER_ID}}", + * reference_id: "user-id-1" * } * } * }) */ - public async create( + public create( + request: Square.terminal.CreateTerminalActionRequest, + requestOptions?: Actions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.terminal.CreateTerminalActionRequest, requestOptions?: Actions.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.terminal.CreateTerminalActionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateTerminalActionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -112,12 +113,14 @@ export class Actions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/actions."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -132,64 +135,60 @@ export class Actions { * await client.terminal.actions.search({ * query: { * filter: { - * createdAt: { - * startAt: "2022-04-01T00:00:00.000Z" + * created_at: { + * start_at: "2022-04-01T00:00:00.000Z" * } * }, * sort: { - * sortOrder: "DESC" + * sort_order: "DESC" * } * }, * limit: 2 * }) */ - public async search( + public search( request: Square.terminal.SearchTerminalActionsRequest = {}, requestOptions?: Actions.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.terminal.SearchTerminalActionsRequest = {}, + requestOptions?: Actions.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.terminal.SearchTerminalActionsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchTerminalActionsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -198,12 +197,14 @@ export class Actions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -216,53 +217,50 @@ export class Actions { * * @example * await client.terminal.actions.get({ - * actionId: "action_id" + * action_id: "action_id" * }) */ - public async get( + public get( + request: Square.terminal.GetActionsRequest, + requestOptions?: Actions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.terminal.GetActionsRequest, requestOptions?: Actions.RequestOptions, - ): Promise { - const { actionId } = request; + ): Promise> { + const { action_id: actionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetTerminalActionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -271,6 +269,7 @@ export class Actions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -279,6 +278,7 @@ export class Actions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -291,53 +291,50 @@ export class Actions { * * @example * await client.terminal.actions.cancel({ - * actionId: "action_id" + * action_id: "action_id" * }) */ - public async cancel( + public cancel( request: Square.terminal.CancelActionsRequest, requestOptions?: Actions.RequestOptions, - ): Promise { - const { actionId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( + request: Square.terminal.CancelActionsRequest, + requestOptions?: Actions.RequestOptions, + ): Promise> { + const { action_id: actionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.CancelTerminalActionResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -346,6 +343,7 @@ export class Actions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -354,6 +352,7 @@ export class Actions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/terminal/resources/actions/client/index.ts b/src/api/resources/terminal/resources/actions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/terminal/resources/actions/client/index.ts +++ b/src/api/resources/terminal/resources/actions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/terminal/resources/actions/client/requests/CancelActionsRequest.ts b/src/api/resources/terminal/resources/actions/client/requests/CancelActionsRequest.ts index e37d98233..14d6f7b4a 100644 --- a/src/api/resources/terminal/resources/actions/client/requests/CancelActionsRequest.ts +++ b/src/api/resources/terminal/resources/actions/client/requests/CancelActionsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * actionId: "action_id" + * action_id: "action_id" * } */ export interface CancelActionsRequest { /** * Unique ID for the desired `TerminalAction`. */ - actionId: string; + action_id: 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 index 95d1c87d1..3778e244c 100644 --- a/src/api/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts +++ b/src/api/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + * idempotency_key: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", * action: { - * deviceId: "{{DEVICE_ID}}", - * deadlineDuration: "PT5M", + * device_id: "{{DEVICE_ID}}", + * deadline_duration: "PT5M", * type: "SAVE_CARD", - * saveCardOptions: { - * customerId: "{{CUSTOMER_ID}}", - * referenceId: "user-id-1" + * save_card_options: { + * customer_id: "{{CUSTOMER_ID}}", + * reference_id: "user-id-1" * } * } * } @@ -27,7 +27,7 @@ export interface CreateTerminalActionRequest { * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more * information. */ - idempotencyKey: string; + idempotency_key: string; /** The Action to create. */ action: Square.TerminalAction; } diff --git a/src/api/resources/terminal/resources/actions/client/requests/GetActionsRequest.ts b/src/api/resources/terminal/resources/actions/client/requests/GetActionsRequest.ts index 68e93ee26..5dd98057b 100644 --- a/src/api/resources/terminal/resources/actions/client/requests/GetActionsRequest.ts +++ b/src/api/resources/terminal/resources/actions/client/requests/GetActionsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * actionId: "action_id" + * action_id: "action_id" * } */ export interface GetActionsRequest { /** * Unique ID for the desired `TerminalAction`. */ - actionId: string; + action_id: string; } diff --git a/src/api/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts b/src/api/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts index 7b4697a8e..43ec7ffd1 100644 --- a/src/api/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts +++ b/src/api/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { * query: { * filter: { - * createdAt: { - * startAt: "2022-04-01T00:00:00.000Z" + * created_at: { + * start_at: "2022-04-01T00:00:00.000Z" * } * }, * sort: { - * sortOrder: "DESC" + * sort_order: "DESC" * } * }, * limit: 2 diff --git a/src/api/resources/terminal/resources/actions/client/requests/index.ts b/src/api/resources/terminal/resources/actions/client/requests/index.ts index 1f4d52c70..596ebc89e 100644 --- a/src/api/resources/terminal/resources/actions/client/requests/index.ts +++ b/src/api/resources/terminal/resources/actions/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type CreateTerminalActionRequest } from "./CreateTerminalActionRequest"; -export { type SearchTerminalActionsRequest } from "./SearchTerminalActionsRequest"; -export { type GetActionsRequest } from "./GetActionsRequest"; -export { type CancelActionsRequest } from "./CancelActionsRequest"; +export { type CreateTerminalActionRequest } from "./CreateTerminalActionRequest.js"; +export { type SearchTerminalActionsRequest } from "./SearchTerminalActionsRequest.js"; +export { type GetActionsRequest } from "./GetActionsRequest.js"; +export { type CancelActionsRequest } from "./CancelActionsRequest.js"; diff --git a/src/api/resources/terminal/resources/actions/index.ts b/src/api/resources/terminal/resources/actions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/terminal/resources/actions/index.ts +++ b/src/api/resources/terminal/resources/actions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/terminal/resources/checkouts/client/Client.ts b/src/api/resources/terminal/resources/checkouts/client/Client.ts index 9885ba5ea..228f3bbb2 100644 --- a/src/api/resources/terminal/resources/checkouts/client/Client.ts +++ b/src/api/resources/terminal/resources/checkouts/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Checkouts { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Checkouts { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Checkouts { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Checkouts { - constructor(protected readonly _options: Checkouts.Options = {}) {} + protected readonly _options: Checkouts.Options; + + constructor(_options: Checkouts.Options = {}) { + this._options = _options; + } /** * Creates a Terminal checkout request and sends it to the specified device to take a payment @@ -46,67 +51,66 @@ export class Checkouts { * * @example * await client.terminal.checkouts.create({ - * idempotencyKey: "28a0c3bc-7839-11ea-bc55-0242ac130003", + * idempotency_key: "28a0c3bc-7839-11ea-bc55-0242ac130003", * checkout: { - * amountMoney: { - * amount: 2610, + * amount_money: { + * amount: BigInt("2610"), * currency: "USD" * }, - * referenceId: "id11572", + * reference_id: "id11572", * note: "A brief note", - * deviceOptions: { - * deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003" + * device_options: { + * device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003" * } * } * }) */ - public async create( + public create( + request: Square.terminal.CreateTerminalCheckoutRequest, + requestOptions?: Checkouts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.terminal.CreateTerminalCheckoutRequest, requestOptions?: Checkouts.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.terminal.CreateTerminalCheckoutRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateTerminalCheckoutResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -115,12 +119,14 @@ export class Checkouts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/checkouts."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -141,53 +147,52 @@ export class Checkouts { * limit: 2 * }) */ - public async search( + public search( request: Square.terminal.SearchTerminalCheckoutsRequest = {}, requestOptions?: Checkouts.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.terminal.SearchTerminalCheckoutsRequest = {}, + requestOptions?: Checkouts.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.terminal.SearchTerminalCheckoutsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.SearchTerminalCheckoutsResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -196,6 +201,7 @@ export class Checkouts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -204,6 +210,7 @@ export class Checkouts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -216,53 +223,50 @@ export class Checkouts { * * @example * await client.terminal.checkouts.get({ - * checkoutId: "checkout_id" + * checkout_id: "checkout_id" * }) */ - public async get( + public get( + request: Square.terminal.GetCheckoutsRequest, + requestOptions?: Checkouts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.terminal.GetCheckoutsRequest, requestOptions?: Checkouts.RequestOptions, - ): Promise { - const { checkoutId } = request; + ): Promise> { + const { checkout_id: checkoutId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetTerminalCheckoutResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -271,6 +275,7 @@ export class Checkouts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -279,6 +284,7 @@ export class Checkouts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -291,53 +297,53 @@ export class Checkouts { * * @example * await client.terminal.checkouts.cancel({ - * checkoutId: "checkout_id" + * checkout_id: "checkout_id" * }) */ - public async cancel( + public cancel( request: Square.terminal.CancelCheckoutsRequest, requestOptions?: Checkouts.RequestOptions, - ): Promise { - const { checkoutId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( + request: Square.terminal.CancelCheckoutsRequest, + requestOptions?: Checkouts.RequestOptions, + ): Promise> { + const { checkout_id: checkoutId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.CancelTerminalCheckoutResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -346,6 +352,7 @@ export class Checkouts { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -354,6 +361,7 @@ export class Checkouts { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/terminal/resources/checkouts/client/index.ts b/src/api/resources/terminal/resources/checkouts/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/terminal/resources/checkouts/client/index.ts +++ b/src/api/resources/terminal/resources/checkouts/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/CancelCheckoutsRequest.ts b/src/api/resources/terminal/resources/checkouts/client/requests/CancelCheckoutsRequest.ts index a346b1067..34ab3f6a9 100644 --- a/src/api/resources/terminal/resources/checkouts/client/requests/CancelCheckoutsRequest.ts +++ b/src/api/resources/terminal/resources/checkouts/client/requests/CancelCheckoutsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * checkoutId: "checkout_id" + * checkout_id: "checkout_id" * } */ export interface CancelCheckoutsRequest { /** * The unique ID for the desired `TerminalCheckout`. */ - checkoutId: string; + checkout_id: 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 index 7cf248165..1cc55d58f 100644 --- a/src/api/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts +++ b/src/api/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "28a0c3bc-7839-11ea-bc55-0242ac130003", + * idempotency_key: "28a0c3bc-7839-11ea-bc55-0242ac130003", * checkout: { - * amountMoney: { - * amount: 2610, + * amount_money: { + * amount: BigInt("2610"), * currency: "USD" * }, - * referenceId: "id11572", + * reference_id: "id11572", * note: "A brief note", - * deviceOptions: { - * deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003" + * device_options: { + * device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003" * } * } * } @@ -28,7 +28,7 @@ export interface CreateTerminalCheckoutRequest { * * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: string; /** The checkout to create. */ checkout: Square.TerminalCheckout; } diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/GetCheckoutsRequest.ts b/src/api/resources/terminal/resources/checkouts/client/requests/GetCheckoutsRequest.ts index 83f26ef56..2607438e0 100644 --- a/src/api/resources/terminal/resources/checkouts/client/requests/GetCheckoutsRequest.ts +++ b/src/api/resources/terminal/resources/checkouts/client/requests/GetCheckoutsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * checkoutId: "checkout_id" + * checkout_id: "checkout_id" * } */ export interface GetCheckoutsRequest { /** * The unique ID for the desired `TerminalCheckout`. */ - checkoutId: string; + checkout_id: string; } diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts b/src/api/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts index 06ef4a3d5..320d73dc9 100644 --- a/src/api/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts +++ b/src/api/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/index.ts b/src/api/resources/terminal/resources/checkouts/client/requests/index.ts index 5ef9dcb34..6b872b6c0 100644 --- a/src/api/resources/terminal/resources/checkouts/client/requests/index.ts +++ b/src/api/resources/terminal/resources/checkouts/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type CreateTerminalCheckoutRequest } from "./CreateTerminalCheckoutRequest"; -export { type SearchTerminalCheckoutsRequest } from "./SearchTerminalCheckoutsRequest"; -export { type GetCheckoutsRequest } from "./GetCheckoutsRequest"; -export { type CancelCheckoutsRequest } from "./CancelCheckoutsRequest"; +export { type CreateTerminalCheckoutRequest } from "./CreateTerminalCheckoutRequest.js"; +export { type SearchTerminalCheckoutsRequest } from "./SearchTerminalCheckoutsRequest.js"; +export { type GetCheckoutsRequest } from "./GetCheckoutsRequest.js"; +export { type CancelCheckoutsRequest } from "./CancelCheckoutsRequest.js"; diff --git a/src/api/resources/terminal/resources/checkouts/index.ts b/src/api/resources/terminal/resources/checkouts/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/terminal/resources/checkouts/index.ts +++ b/src/api/resources/terminal/resources/checkouts/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/terminal/resources/index.ts b/src/api/resources/terminal/resources/index.ts index 9c6d9980c..f79c8b7d8 100644 --- a/src/api/resources/terminal/resources/index.ts +++ b/src/api/resources/terminal/resources/index.ts @@ -1,6 +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"; +export * as actions from "./actions/index.js"; +export * as checkouts from "./checkouts/index.js"; +export * as refunds from "./refunds/index.js"; +export * from "./actions/client/requests/index.js"; +export * from "./checkouts/client/requests/index.js"; +export * from "./refunds/client/requests/index.js"; diff --git a/src/api/resources/terminal/resources/refunds/client/Client.ts b/src/api/resources/terminal/resources/refunds/client/Client.ts index 3e989c6b0..2e945d8d9 100644 --- a/src/api/resources/terminal/resources/refunds/client/Client.ts +++ b/src/api/resources/terminal/resources/refunds/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Refunds { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Refunds { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Refunds { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Refunds { - constructor(protected readonly _options: Refunds.Options = {}) {} + protected readonly _options: Refunds.Options; + + constructor(_options: Refunds.Options = {}) { + this._options = _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). @@ -45,65 +50,61 @@ export class Refunds { * * @example * await client.terminal.refunds.create({ - * idempotencyKey: "402a640b-b26f-401f-b406-46f839590c04", + * idempotency_key: "402a640b-b26f-401f-b406-46f839590c04", * refund: { - * paymentId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - * amountMoney: { - * amount: 111, + * payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + * amount_money: { + * amount: BigInt("111"), * currency: "CAD" * }, * reason: "Returning items", - * deviceId: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291" + * device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291" * } * }) */ - public async create( + public create( + request: Square.terminal.CreateTerminalRefundRequest, + requestOptions?: Refunds.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.terminal.CreateTerminalRefundRequest, requestOptions?: Refunds.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.terminal.CreateTerminalRefundRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateTerminalRefundResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -112,12 +113,14 @@ export class Refunds { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/refunds."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -138,53 +141,49 @@ export class Refunds { * limit: 1 * }) */ - public async search( + public search( request: Square.terminal.SearchTerminalRefundsRequest = {}, requestOptions?: Refunds.RequestOptions, - ): Promise { + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( + request: Square.terminal.SearchTerminalRefundsRequest = {}, + requestOptions?: Refunds.RequestOptions, + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.terminal.SearchTerminalRefundsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchTerminalRefundsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -193,12 +192,14 @@ export class Refunds { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -211,53 +212,50 @@ export class Refunds { * * @example * await client.terminal.refunds.get({ - * terminalRefundId: "terminal_refund_id" + * terminal_refund_id: "terminal_refund_id" * }) */ - public async get( + public get( + request: Square.terminal.GetRefundsRequest, + requestOptions?: Refunds.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.terminal.GetRefundsRequest, requestOptions?: Refunds.RequestOptions, - ): Promise { - const { terminalRefundId } = request; + ): Promise> { + const { terminal_refund_id: terminalRefundId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetTerminalRefundResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -266,6 +264,7 @@ export class Refunds { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -274,6 +273,7 @@ export class Refunds { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -286,53 +286,50 @@ export class Refunds { * * @example * await client.terminal.refunds.cancel({ - * terminalRefundId: "terminal_refund_id" + * terminal_refund_id: "terminal_refund_id" * }) */ - public async cancel( + public cancel( request: Square.terminal.CancelRefundsRequest, requestOptions?: Refunds.RequestOptions, - ): Promise { - const { terminalRefundId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( + request: Square.terminal.CancelRefundsRequest, + requestOptions?: Refunds.RequestOptions, + ): Promise> { + const { terminal_refund_id: terminalRefundId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.CancelTerminalRefundResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -341,6 +338,7 @@ export class Refunds { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -349,6 +347,7 @@ export class Refunds { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/terminal/resources/refunds/client/index.ts b/src/api/resources/terminal/resources/refunds/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/terminal/resources/refunds/client/index.ts +++ b/src/api/resources/terminal/resources/refunds/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/terminal/resources/refunds/client/requests/CancelRefundsRequest.ts b/src/api/resources/terminal/resources/refunds/client/requests/CancelRefundsRequest.ts index 250a548ff..36c73a262 100644 --- a/src/api/resources/terminal/resources/refunds/client/requests/CancelRefundsRequest.ts +++ b/src/api/resources/terminal/resources/refunds/client/requests/CancelRefundsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * terminalRefundId: "terminal_refund_id" + * terminal_refund_id: "terminal_refund_id" * } */ export interface CancelRefundsRequest { /** * The unique ID for the desired `TerminalRefund`. */ - terminalRefundId: string; + terminal_refund_id: string; } diff --git a/src/api/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts b/src/api/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts index 624a728ea..63c80ff55 100644 --- a/src/api/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts +++ b/src/api/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "402a640b-b26f-401f-b406-46f839590c04", + * idempotency_key: "402a640b-b26f-401f-b406-46f839590c04", * refund: { - * paymentId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - * amountMoney: { - * amount: 111, + * payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + * amount_money: { + * amount: BigInt("111"), * currency: "CAD" * }, * reason: "Returning items", - * deviceId: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291" + * device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291" * } * } */ @@ -26,7 +26,7 @@ export interface CreateTerminalRefundRequest { * * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: string; /** The refund to create. */ refund?: Square.TerminalRefund; } diff --git a/src/api/resources/terminal/resources/refunds/client/requests/GetRefundsRequest.ts b/src/api/resources/terminal/resources/refunds/client/requests/GetRefundsRequest.ts index 784c1cd2e..dbff10472 100644 --- a/src/api/resources/terminal/resources/refunds/client/requests/GetRefundsRequest.ts +++ b/src/api/resources/terminal/resources/refunds/client/requests/GetRefundsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * terminalRefundId: "terminal_refund_id" + * terminal_refund_id: "terminal_refund_id" * } */ export interface GetRefundsRequest { /** * The unique ID for the desired `TerminalRefund`. */ - terminalRefundId: string; + terminal_refund_id: 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 index 22f190f62..a7969f31a 100644 --- a/src/api/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts +++ b/src/api/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example diff --git a/src/api/resources/terminal/resources/refunds/client/requests/index.ts b/src/api/resources/terminal/resources/refunds/client/requests/index.ts index d076a5792..7c7435517 100644 --- a/src/api/resources/terminal/resources/refunds/client/requests/index.ts +++ b/src/api/resources/terminal/resources/refunds/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type CreateTerminalRefundRequest } from "./CreateTerminalRefundRequest"; -export { type SearchTerminalRefundsRequest } from "./SearchTerminalRefundsRequest"; -export { type GetRefundsRequest } from "./GetRefundsRequest"; -export { type CancelRefundsRequest } from "./CancelRefundsRequest"; +export { type CreateTerminalRefundRequest } from "./CreateTerminalRefundRequest.js"; +export { type SearchTerminalRefundsRequest } from "./SearchTerminalRefundsRequest.js"; +export { type GetRefundsRequest } from "./GetRefundsRequest.js"; +export { type CancelRefundsRequest } from "./CancelRefundsRequest.js"; diff --git a/src/api/resources/terminal/resources/refunds/index.ts b/src/api/resources/terminal/resources/refunds/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/terminal/resources/refunds/index.ts +++ b/src/api/resources/terminal/resources/refunds/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/v1Transactions/client/Client.ts b/src/api/resources/v1Transactions/client/Client.ts index f90a5c547..8478bd779 100644 --- a/src/api/resources/v1Transactions/client/Client.ts +++ b/src/api/resources/v1Transactions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace V1Transactions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace V1Transactions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace V1Transactions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class V1Transactions { - constructor(protected readonly _options: V1Transactions.Options = {}) {} + protected readonly _options: V1Transactions.Options; + + constructor(_options: V1Transactions.Options = {}) { + this._options = _options; + } /** * Provides summary information for a merchant's online store orders. @@ -45,20 +50,24 @@ export class V1Transactions { * * @example * await client.v1Transactions.v1ListOrders({ - * locationId: "location_id" + * location_id: "location_id" * }) */ - public async v1ListOrders( + public v1ListOrders( request: Square.V1ListOrdersRequest, requestOptions?: V1Transactions.RequestOptions, - ): Promise { - const { locationId, order, limit, batchToken } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__v1ListOrders(request, requestOptions)); + } + + private async __v1ListOrders( + request: Square.V1ListOrdersRequest, + requestOptions?: V1Transactions.RequestOptions, + ): Promise> { + const { location_id: locationId, order, limit, batch_token: batchToken } = request; const _queryParams: Record = {}; if (order !== undefined) { - _queryParams["order"] = serializers.SortOrder.jsonOrThrow(order, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }); + _queryParams["order"] = order; } if (limit !== undefined) { @@ -70,45 +79,35 @@ export class V1Transactions { } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.V1Order[], rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -117,12 +116,14 @@ export class V1Transactions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -135,54 +136,51 @@ export class V1Transactions { * * @example * await client.v1Transactions.v1RetrieveOrder({ - * locationId: "location_id", - * orderId: "order_id" + * location_id: "location_id", + * order_id: "order_id" * }) */ - public async v1RetrieveOrder( + public v1RetrieveOrder( request: Square.V1RetrieveOrderRequest, requestOptions?: V1Transactions.RequestOptions, - ): Promise { - const { locationId, orderId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__v1RetrieveOrder(request, requestOptions)); + } + + private async __v1RetrieveOrder( + request: Square.V1RetrieveOrderRequest, + requestOptions?: V1Transactions.RequestOptions, + ): Promise> { + const { location_id: locationId, order_id: orderId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.V1Order, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -191,6 +189,7 @@ export class V1Transactions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -199,6 +198,7 @@ export class V1Transactions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -211,59 +211,55 @@ export class V1Transactions { * * @example * await client.v1Transactions.v1UpdateOrder({ - * locationId: "location_id", - * orderId: "order_id", + * location_id: "location_id", + * order_id: "order_id", * action: "COMPLETE" * }) */ - public async v1UpdateOrder( + public v1UpdateOrder( request: Square.V1UpdateOrderRequest, requestOptions?: V1Transactions.RequestOptions, - ): Promise { - const { locationId, orderId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__v1UpdateOrder(request, requestOptions)); + } + + private async __v1UpdateOrder( + request: Square.V1UpdateOrderRequest, + requestOptions?: V1Transactions.RequestOptions, + ): Promise> { + const { location_id: locationId, order_id: orderId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.V1UpdateOrderRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.V1Order, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -272,6 +268,7 @@ export class V1Transactions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -280,6 +277,7 @@ export class V1Transactions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/v1Transactions/client/index.ts b/src/api/resources/v1Transactions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/v1Transactions/client/index.ts +++ b/src/api/resources/v1Transactions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts b/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts index ef21b9525..beb665747 100644 --- a/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts +++ b/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * locationId: "location_id" + * location_id: "location_id" * } */ export interface V1ListOrdersRequest { /** * The ID of the location to list online store orders for. */ - locationId: string; + location_id: string; /** * The order in which payments are listed in the response. */ @@ -27,5 +27,5 @@ export interface V1ListOrdersRequest { * A pagination cursor to retrieve the next set of results for your * original query to the endpoint. */ - batchToken?: string | null; + batch_token?: string | null; } diff --git a/src/api/resources/v1Transactions/client/requests/V1RetrieveOrderRequest.ts b/src/api/resources/v1Transactions/client/requests/V1RetrieveOrderRequest.ts index cdc38ad36..35922ce37 100644 --- a/src/api/resources/v1Transactions/client/requests/V1RetrieveOrderRequest.ts +++ b/src/api/resources/v1Transactions/client/requests/V1RetrieveOrderRequest.ts @@ -5,17 +5,17 @@ /** * @example * { - * locationId: "location_id", - * orderId: "order_id" + * location_id: "location_id", + * order_id: "order_id" * } */ export interface V1RetrieveOrderRequest { /** * The ID of the order's associated location. */ - locationId: string; + location_id: string; /** * The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint */ - orderId: string; + order_id: string; } diff --git a/src/api/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts b/src/api/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts index 29b41dae6..b0a3bc027 100644 --- a/src/api/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts +++ b/src/api/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * locationId: "location_id", - * orderId: "order_id", + * location_id: "location_id", + * order_id: "order_id", * action: "COMPLETE" * } */ @@ -16,22 +16,22 @@ export interface V1UpdateOrderRequest { /** * The ID of the order's associated location. */ - locationId: string; + location_id: string; /** * The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint */ - orderId: string; + order_id: 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; + shipped_tracking_number?: string | null; /** A merchant-specified note about the completion of the order. Only valid if action is COMPLETE. */ - completedNote?: string | null; + completed_note?: string | null; /** A merchant-specified note about the refunding of the order. Only valid if action is REFUND. */ - refundedNote?: string | null; + refunded_note?: string | null; /** A merchant-specified note about the canceling of the order. Only valid if action is CANCEL. */ - canceledNote?: string | null; + canceled_note?: string | null; } diff --git a/src/api/resources/v1Transactions/client/requests/index.ts b/src/api/resources/v1Transactions/client/requests/index.ts index 0d77a3125..aaf77fd24 100644 --- a/src/api/resources/v1Transactions/client/requests/index.ts +++ b/src/api/resources/v1Transactions/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type V1ListOrdersRequest } from "./V1ListOrdersRequest"; -export { type V1RetrieveOrderRequest } from "./V1RetrieveOrderRequest"; -export { type V1UpdateOrderRequest } from "./V1UpdateOrderRequest"; +export { type V1ListOrdersRequest } from "./V1ListOrdersRequest.js"; +export { type V1RetrieveOrderRequest } from "./V1RetrieveOrderRequest.js"; +export { type V1UpdateOrderRequest } from "./V1UpdateOrderRequest.js"; diff --git a/src/api/resources/v1Transactions/index.ts b/src/api/resources/v1Transactions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/v1Transactions/index.ts +++ b/src/api/resources/v1Transactions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/vendors/client/Client.ts b/src/api/resources/vendors/client/Client.ts index a2507a1bb..aeb11480c 100644 --- a/src/api/resources/vendors/client/Client.ts +++ b/src/api/resources/vendors/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import * as Square from "../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as errors from "../../../../errors/index.js"; export declare namespace Vendors { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Vendors { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Vendors { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Vendors { - constructor(protected readonly _options: Vendors.Options = {}) {} + protected readonly _options: Vendors.Options; + + constructor(_options: Vendors.Options = {}) { + this._options = _options; + } /** * Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller. @@ -49,72 +54,68 @@ export class Vendors { * "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { * name: "Joe's Fresh Seafood", * address: { - * addressLine1: "505 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "505 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, * contacts: [{ * name: "Joe Burrow", - * emailAddress: "joe@joesfreshseafood.com", - * phoneNumber: "1-212-555-4250", + * email_address: "joe@joesfreshseafood.com", + * phone_number: "1-212-555-4250", * ordinal: 1 * }], - * accountNumber: "4025391", + * account_number: "4025391", * note: "a vendor" * } * } * }) */ - public async batchCreate( + public batchCreate( + request: Square.BatchCreateVendorsRequest, + requestOptions?: Vendors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchCreate(request, requestOptions)); + } + + private async __batchCreate( request: Square.BatchCreateVendorsRequest, requestOptions?: Vendors.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchCreateVendorsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BatchCreateVendorsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -123,12 +124,14 @@ export class Vendors { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -141,56 +144,52 @@ export class Vendors { * * @example * await client.vendors.batchGet({ - * vendorIds: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * vendor_ids: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"] * }) */ - public async batchGet( + public batchGet( + request: Square.BatchGetVendorsRequest = {}, + requestOptions?: Vendors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchGet(request, requestOptions)); + } + + private async __batchGet( request: Square.BatchGetVendorsRequest = {}, requestOptions?: Vendors.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchGetVendorsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BatchGetVendorsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -199,12 +198,14 @@ export class Vendors { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -227,53 +228,49 @@ export class Vendors { * } * }) */ - public async batchUpdate( + public batchUpdate( + request: Square.BatchUpdateVendorsRequest, + requestOptions?: Vendors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__batchUpdate(request, requestOptions)); + } + + private async __batchUpdate( request: Square.BatchUpdateVendorsRequest, requestOptions?: Vendors.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.BatchUpdateVendorsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.BatchUpdateVendorsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -282,12 +279,14 @@ export class Vendors { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -300,75 +299,71 @@ export class Vendors { * * @example * await client.vendors.create({ - * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", * vendor: { * name: "Joe's Fresh Seafood", * address: { - * addressLine1: "505 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "505 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, * contacts: [{ * name: "Joe Burrow", - * emailAddress: "joe@joesfreshseafood.com", - * phoneNumber: "1-212-555-4250", + * email_address: "joe@joesfreshseafood.com", + * phone_number: "1-212-555-4250", * ordinal: 1 * }], - * accountNumber: "4025391", + * account_number: "4025391", * note: "a vendor" * } * }) */ - public async create( + public create( + request: Square.CreateVendorRequest, + requestOptions?: Vendors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.CreateVendorRequest, requestOptions?: Vendors.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.CreateVendorRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.CreateVendorResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -377,12 +372,14 @@ export class Vendors { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/vendors/create."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -396,53 +393,49 @@ export class Vendors { * @example * await client.vendors.search() */ - public async search( + public search( + request: Square.SearchVendorsRequest = {}, + requestOptions?: Vendors.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); + } + + private async __search( request: Square.SearchVendorsRequest = {}, requestOptions?: Vendors.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.SearchVendorsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { data: _response.body as Square.SearchVendorsResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -451,12 +444,14 @@ export class Vendors { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/vendors/search."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -469,53 +464,50 @@ export class Vendors { * * @example * await client.vendors.get({ - * vendorId: "vendor_id" + * vendor_id: "vendor_id" * }) */ - public async get( + public get( request: Square.GetVendorsRequest, requestOptions?: Vendors.RequestOptions, - ): Promise { - const { vendorId } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetVendorsRequest, + requestOptions?: Vendors.RequestOptions, + ): Promise> { + const { vendor_id: vendorId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.GetVendorResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -524,12 +516,14 @@ export class Vendors { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } @@ -542,9 +536,9 @@ export class Vendors { * * @example * await client.vendors.update({ - * vendorId: "vendor_id", + * vendor_id: "vendor_id", * body: { - * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", * vendor: { * id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", * name: "Jack's Chicken Shack", @@ -554,54 +548,50 @@ export class Vendors { * } * }) */ - public async update( + public update( request: Square.UpdateVendorsRequest, requestOptions?: Vendors.RequestOptions, - ): Promise { - const { vendorId, body: _body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.UpdateVendorsRequest, + requestOptions?: Vendors.RequestOptions, + ): Promise> { + const { vendor_id: vendorId, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.UpdateVendorRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { data: _response.body as Square.UpdateVendorResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -610,12 +600,14 @@ export class Vendors { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/vendors/client/index.ts b/src/api/resources/vendors/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/vendors/client/index.ts +++ b/src/api/resources/vendors/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/vendors/client/requests/BatchCreateVendorsRequest.ts b/src/api/resources/vendors/client/requests/BatchCreateVendorsRequest.ts index 7137f0e8e..0db5d4029 100644 --- a/src/api/resources/vendors/client/requests/BatchCreateVendorsRequest.ts +++ b/src/api/resources/vendors/client/requests/BatchCreateVendorsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example @@ -11,20 +11,20 @@ import * as Square from "../../../../index"; * "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { * name: "Joe's Fresh Seafood", * address: { - * addressLine1: "505 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "505 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, * contacts: [{ * name: "Joe Burrow", - * emailAddress: "joe@joesfreshseafood.com", - * phoneNumber: "1-212-555-4250", + * email_address: "joe@joesfreshseafood.com", + * phone_number: "1-212-555-4250", * ordinal: 1 * }], - * accountNumber: "4025391", + * account_number: "4025391", * note: "a vendor" * } * } diff --git a/src/api/resources/vendors/client/requests/BatchGetVendorsRequest.ts b/src/api/resources/vendors/client/requests/BatchGetVendorsRequest.ts index 26dda1865..79b3c67d6 100644 --- a/src/api/resources/vendors/client/requests/BatchGetVendorsRequest.ts +++ b/src/api/resources/vendors/client/requests/BatchGetVendorsRequest.ts @@ -5,10 +5,10 @@ /** * @example * { - * vendorIds: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * vendor_ids: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"] * } */ export interface BatchGetVendorsRequest { /** IDs of the [Vendor](entity:Vendor) objects to retrieve. */ - vendorIds?: string[] | null; + vendor_ids?: string[] | null; } diff --git a/src/api/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts b/src/api/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts index 9af78e9eb..58a3b6422 100644 --- a/src/api/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts +++ b/src/api/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example diff --git a/src/api/resources/vendors/client/requests/CreateVendorRequest.ts b/src/api/resources/vendors/client/requests/CreateVendorRequest.ts index 5af83d983..dc084429c 100644 --- a/src/api/resources/vendors/client/requests/CreateVendorRequest.ts +++ b/src/api/resources/vendors/client/requests/CreateVendorRequest.ts @@ -2,29 +2,29 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", * vendor: { * name: "Joe's Fresh Seafood", * address: { - * addressLine1: "505 Electric Ave", - * addressLine2: "Suite 600", + * address_line_1: "505 Electric Ave", + * address_line_2: "Suite 600", * locality: "New York", - * administrativeDistrictLevel1: "NY", - * postalCode: "10003", + * administrative_district_level_1: "NY", + * postal_code: "10003", * country: "US" * }, * contacts: [{ * name: "Joe Burrow", - * emailAddress: "joe@joesfreshseafood.com", - * phoneNumber: "1-212-555-4250", + * email_address: "joe@joesfreshseafood.com", + * phone_number: "1-212-555-4250", * ordinal: 1 * }], - * accountNumber: "4025391", + * account_number: "4025391", * note: "a vendor" * } * } @@ -37,7 +37,7 @@ export interface CreateVendorRequest { * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more * information. */ - idempotencyKey: string; + idempotency_key: string; /** The requested [Vendor](entity:Vendor) to be created. */ vendor?: Square.Vendor; } diff --git a/src/api/resources/vendors/client/requests/GetVendorsRequest.ts b/src/api/resources/vendors/client/requests/GetVendorsRequest.ts index ac8bc8927..d3104a25c 100644 --- a/src/api/resources/vendors/client/requests/GetVendorsRequest.ts +++ b/src/api/resources/vendors/client/requests/GetVendorsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * vendorId: "vendor_id" + * vendor_id: "vendor_id" * } */ export interface GetVendorsRequest { /** * ID of the [Vendor](entity:Vendor) to retrieve. */ - vendorId: string; + vendor_id: string; } diff --git a/src/api/resources/vendors/client/requests/SearchVendorsRequest.ts b/src/api/resources/vendors/client/requests/SearchVendorsRequest.ts index 67d1ddc63..a82deab85 100644 --- a/src/api/resources/vendors/client/requests/SearchVendorsRequest.ts +++ b/src/api/resources/vendors/client/requests/SearchVendorsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example diff --git a/src/api/resources/vendors/client/requests/UpdateVendorsRequest.ts b/src/api/resources/vendors/client/requests/UpdateVendorsRequest.ts index 912e5811f..11857403e 100644 --- a/src/api/resources/vendors/client/requests/UpdateVendorsRequest.ts +++ b/src/api/resources/vendors/client/requests/UpdateVendorsRequest.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../index"; +import * as Square from "../../../../index.js"; /** * @example * { - * vendorId: "vendor_id", + * vendor_id: "vendor_id", * body: { - * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", * vendor: { * id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", * name: "Jack's Chicken Shack", @@ -23,6 +23,6 @@ export interface UpdateVendorsRequest { /** * ID of the [Vendor](entity:Vendor) to retrieve. */ - vendorId: string; + vendor_id: string; body: Square.UpdateVendorRequest; } diff --git a/src/api/resources/vendors/client/requests/index.ts b/src/api/resources/vendors/client/requests/index.ts index 68fdae923..a323420c4 100644 --- a/src/api/resources/vendors/client/requests/index.ts +++ b/src/api/resources/vendors/client/requests/index.ts @@ -1,7 +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 GetVendorsRequest } from "./GetVendorsRequest"; -export { type UpdateVendorsRequest } from "./UpdateVendorsRequest"; +export { type BatchCreateVendorsRequest } from "./BatchCreateVendorsRequest.js"; +export { type BatchGetVendorsRequest } from "./BatchGetVendorsRequest.js"; +export { type BatchUpdateVendorsRequest } from "./BatchUpdateVendorsRequest.js"; +export { type CreateVendorRequest } from "./CreateVendorRequest.js"; +export { type SearchVendorsRequest } from "./SearchVendorsRequest.js"; +export { type GetVendorsRequest } from "./GetVendorsRequest.js"; +export { type UpdateVendorsRequest } from "./UpdateVendorsRequest.js"; diff --git a/src/api/resources/vendors/index.ts b/src/api/resources/vendors/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/vendors/index.ts +++ b/src/api/resources/vendors/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts index cb72fb95b..81324ac16 100644 --- a/src/api/resources/webhooks/client/Client.ts +++ b/src/api/resources/webhooks/client/Client.ts @@ -2,10 +2,10 @@ * 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"; +import * as environments from "../../../../environments.js"; +import * as core from "../../../../core/index.js"; +import { EventTypes } from "../resources/eventTypes/client/Client.js"; +import { Subscriptions } from "../resources/subscriptions/client/Client.js"; export declare namespace Webhooks { export interface Options { @@ -15,28 +15,20 @@ export declare namespace Webhooks { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; 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-07-16"; - /** Additional headers to include in the request. */ - headers?: Record; - } } export class Webhooks { + protected readonly _options: Webhooks.Options; protected _eventTypes: EventTypes | undefined; protected _subscriptions: Subscriptions | undefined; - constructor(protected readonly _options: Webhooks.Options = {}) {} + constructor(_options: Webhooks.Options = {}) { + this._options = _options; + } public get eventTypes(): EventTypes { return (this._eventTypes ??= new EventTypes(this._options)); diff --git a/src/api/resources/webhooks/index.ts b/src/api/resources/webhooks/index.ts index 33a87f100..9eb1192dc 100644 --- a/src/api/resources/webhooks/index.ts +++ b/src/api/resources/webhooks/index.ts @@ -1,2 +1,2 @@ -export * from "./client"; -export * from "./resources"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/webhooks/resources/eventTypes/client/Client.ts b/src/api/resources/webhooks/resources/eventTypes/client/Client.ts index 138be8fd5..62481a127 100644 --- a/src/api/resources/webhooks/resources/eventTypes/client/Client.ts +++ b/src/api/resources/webhooks/resources/eventTypes/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace EventTypes { export interface Options { @@ -17,6 +16,8 @@ export declare namespace EventTypes { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace EventTypes { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class EventTypes { - constructor(protected readonly _options: EventTypes.Options = {}) {} + protected readonly _options: EventTypes.Options; + + constructor(_options: EventTypes.Options = {}) { + this._options = _options; + } /** * Lists all webhook event types that can be subscribed to. @@ -46,56 +51,53 @@ export class EventTypes { * @example * await client.webhooks.eventTypes.list() */ - public async list( + public list( + request: Square.webhooks.ListEventTypesRequest = {}, + requestOptions?: EventTypes.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( request: Square.webhooks.ListEventTypesRequest = {}, requestOptions?: EventTypes.RequestOptions, - ): Promise { - const { apiVersion } = request; + ): Promise> { + const { api_version: apiVersion } = request; const _queryParams: Record = {}; if (apiVersion !== undefined) { _queryParams["api_version"] = apiVersion; } const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { data: _response.body as Square.ListWebhookEventTypesResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -104,12 +106,14 @@ export class EventTypes { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); 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, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/webhooks/resources/eventTypes/client/index.ts b/src/api/resources/webhooks/resources/eventTypes/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/webhooks/resources/eventTypes/client/index.ts +++ b/src/api/resources/webhooks/resources/eventTypes/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/webhooks/resources/eventTypes/client/requests/ListEventTypesRequest.ts b/src/api/resources/webhooks/resources/eventTypes/client/requests/ListEventTypesRequest.ts index 58176164e..e9757197b 100644 --- a/src/api/resources/webhooks/resources/eventTypes/client/requests/ListEventTypesRequest.ts +++ b/src/api/resources/webhooks/resources/eventTypes/client/requests/ListEventTypesRequest.ts @@ -10,5 +10,5 @@ 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; + api_version?: 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 index 2e7e10bf3..218e21ca0 100644 --- a/src/api/resources/webhooks/resources/eventTypes/client/requests/index.ts +++ b/src/api/resources/webhooks/resources/eventTypes/client/requests/index.ts @@ -1 +1 @@ -export { type ListEventTypesRequest } from "./ListEventTypesRequest"; +export { type ListEventTypesRequest } from "./ListEventTypesRequest.js"; diff --git a/src/api/resources/webhooks/resources/eventTypes/index.ts b/src/api/resources/webhooks/resources/eventTypes/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/webhooks/resources/eventTypes/index.ts +++ b/src/api/resources/webhooks/resources/eventTypes/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/resources/webhooks/resources/index.ts b/src/api/resources/webhooks/resources/index.ts index f0cf7982d..18567d723 100644 --- a/src/api/resources/webhooks/resources/index.ts +++ b/src/api/resources/webhooks/resources/index.ts @@ -1,4 +1,4 @@ -export * as eventTypes from "./eventTypes"; -export * as subscriptions from "./subscriptions"; -export * from "./eventTypes/client/requests"; -export * from "./subscriptions/client/requests"; +export * as eventTypes from "./eventTypes/index.js"; +export * as subscriptions from "./subscriptions/index.js"; +export * from "./eventTypes/client/requests/index.js"; +export * from "./subscriptions/client/requests/index.js"; diff --git a/src/api/resources/webhooks/resources/subscriptions/client/Client.ts b/src/api/resources/webhooks/resources/subscriptions/client/Client.ts index afb5ce3ee..d267a4eaf 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/Client.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/Client.ts @@ -2,12 +2,11 @@ * 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 * as environments from "../../../../../../environments.js"; +import * as core from "../../../../../../core/index.js"; +import * as Square from "../../../../../index.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as errors from "../../../../../../errors/index.js"; export declare namespace Subscriptions { export interface Options { @@ -17,6 +16,8 @@ export declare namespace Subscriptions { token?: core.Supplier; /** Override the Square-Version header */ version?: "2025-07-16"; + /** Additional headers to include in requests. */ + headers?: Record | undefined>; fetcher?: core.FetchFunction; } @@ -30,12 +31,16 @@ export declare namespace Subscriptions { /** Override the Square-Version header */ version?: "2025-07-16"; /** Additional headers to include in the request. */ - headers?: Record; + headers?: Record | undefined>; } } export class Subscriptions { - constructor(protected readonly _options: Subscriptions.Options = {}) {} + protected readonly _options: Subscriptions.Options; + + constructor(_options: Subscriptions.Options = {}) { + this._options = _options; + } /** * Lists all webhook subscriptions owned by your application. @@ -50,86 +55,84 @@ export class Subscriptions { request: Square.webhooks.ListSubscriptionsRequest = {}, requestOptions?: Subscriptions.RequestOptions, ): Promise> { - const list = async ( - request: Square.webhooks.ListSubscriptionsRequest, - ): 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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "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, + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.webhooks.ListSubscriptionsRequest, + ): Promise> => { + const { cursor, include_disabled: includeDisabled, sort_order: 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"] = sortOrder; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/webhooks/subscriptions", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } - switch (_response.error.reason) { - case "non-json": + if (_response.ok) { + return { + data: _response.body as Square.ListWebhookSubscriptionsResponse, + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, - body: _response.error.rawBody, + body: _response.error.body, + rawResponse: _response.rawResponse, }); - case "timeout": - throw new errors.SquareTimeoutError( - "Timeout exceeded when calling GET /v2/webhooks/subscriptions.", - ); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - }); - } - }; + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/webhooks/subscriptions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); return new core.Pageable({ - response: await list(request), - hasNextPage: (response) => response?.cursor != null, + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), getItems: (response) => response?.subscriptions ?? [], loadPage: (response) => { return list(core.setObjectProperty(request, "cursor", response?.cursor)); @@ -145,62 +148,61 @@ export class Subscriptions { * * @example * await client.webhooks.subscriptions.create({ - * idempotencyKey: "63f84c6c-2200-4c99-846c-2670a1311fbf", + * idempotency_key: "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" + * event_types: ["payment.created", "payment.updated"], + * notification_url: "https://example-webhook-url.com", + * api_version: "2021-12-15" * } * }) */ - public async create( + public create( + request: Square.webhooks.CreateWebhookSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( request: Square.webhooks.CreateWebhookSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.webhooks.CreateWebhookSubscriptionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: request, 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"], - }); + return { + data: _response.body as Square.CreateWebhookSubscriptionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -209,12 +211,14 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/webhooks/subscriptions."); case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -227,53 +231,53 @@ export class Subscriptions { * * @example * await client.webhooks.subscriptions.get({ - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * }) */ - public async get( + public get( + request: Square.webhooks.GetSubscriptionsRequest, + requestOptions?: Subscriptions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( request: Square.webhooks.GetSubscriptionsRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId } = request; + ): Promise> { + const { subscription_id: subscriptionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.GetWebhookSubscriptionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -282,6 +286,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -290,6 +295,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -302,61 +308,60 @@ export class Subscriptions { * * @example * await client.webhooks.subscriptions.update({ - * subscriptionId: "subscription_id", + * subscription_id: "subscription_id", * subscription: { * name: "Updated Example Webhook Subscription", * enabled: false * } * }) */ - public async update( + public update( request: Square.webhooks.UpdateWebhookSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.webhooks.UpdateWebhookSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.webhooks.UpdateWebhookSubscriptionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateWebhookSubscriptionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -365,6 +370,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -373,6 +379,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -385,53 +392,53 @@ export class Subscriptions { * * @example * await client.webhooks.subscriptions.delete({ - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * }) */ - public async delete( + public delete( + request: Square.webhooks.DeleteSubscriptionsRequest, + requestOptions?: Subscriptions.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( request: Square.webhooks.DeleteSubscriptionsRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId } = request; + ): Promise> { + const { subscription_id: subscriptionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.1", - "User-Agent": "square/43.0.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), 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"], - }); + return { + data: _response.body as Square.DeleteWebhookSubscriptionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -440,6 +447,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -448,6 +456,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -460,58 +469,57 @@ export class Subscriptions { * * @example * await client.webhooks.subscriptions.updateSignatureKey({ - * subscriptionId: "subscription_id", - * idempotencyKey: "ed80ae6b-0654-473b-bbab-a39aee89a60d" + * subscription_id: "subscription_id", + * idempotency_key: "ed80ae6b-0654-473b-bbab-a39aee89a60d" * }) */ - public async updateSignatureKey( + public updateSignatureKey( request: Square.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateSignatureKey(request, requestOptions)); + } + + private async __updateSignatureKey( + request: Square.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.UpdateWebhookSubscriptionSignatureKeyResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -520,6 +528,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -528,6 +537,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } @@ -540,58 +550,57 @@ export class Subscriptions { * * @example * await client.webhooks.subscriptions.test({ - * subscriptionId: "subscription_id", - * eventType: "payment.created" + * subscription_id: "subscription_id", + * event_type: "payment.created" * }) */ - public async test( + public test( request: Square.webhooks.TestWebhookSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions, - ): Promise { - const { subscriptionId, ..._body } = request; + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__test(request, requestOptions)); + } + + private async __test( + request: Square.webhooks.TestWebhookSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const { subscription_id: subscriptionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( + url: core.url.join( (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-07-16", - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.0.0", - "User-Agent": "square/43.0.0", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-07-16", + }), + requestOptions?.headers, + ), contentType: "application/json", requestType: "json", - body: serializers.webhooks.TestWebhookSubscriptionRequest.jsonOrThrow(_body, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), + body: _body, 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"], - }); + return { + data: _response.body as Square.TestWebhookSubscriptionResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.body, + rawResponse: _response.rawResponse, }); } @@ -600,6 +609,7 @@ export class Subscriptions { throw new errors.SquareError({ statusCode: _response.error.statusCode, body: _response.error.rawBody, + rawResponse: _response.rawResponse, }); case "timeout": throw new errors.SquareTimeoutError( @@ -608,6 +618,7 @@ export class Subscriptions { case "unknown": throw new errors.SquareError({ message: _response.error.errorMessage, + rawResponse: _response.rawResponse, }); } } diff --git a/src/api/resources/webhooks/resources/subscriptions/client/index.ts b/src/api/resources/webhooks/resources/subscriptions/client/index.ts index 415726b7f..82648c6ff 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/index.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/index.ts @@ -1 +1,2 @@ -export * from "./requests"; +export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts index 8b5233858..79dca561a 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * idempotencyKey: "63f84c6c-2200-4c99-846c-2670a1311fbf", + * idempotency_key: "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" + * event_types: ["payment.created", "payment.updated"], + * notification_url: "https://example-webhook-url.com", + * api_version: "2021-12-15" * } * } */ export interface CreateWebhookSubscriptionRequest { /** A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request. */ - idempotencyKey?: string; + idempotency_key?: string; /** The [Subscription](entity:WebhookSubscription) to create. */ subscription: Square.WebhookSubscription; } diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/DeleteSubscriptionsRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/DeleteSubscriptionsRequest.ts index e348ad484..73cb00880 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/DeleteSubscriptionsRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/DeleteSubscriptionsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * } */ export interface DeleteSubscriptionsRequest { /** * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete. */ - subscriptionId: string; + subscription_id: string; } diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts index fde07880e..11b084468 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * subscriptionId: "subscription_id" + * subscription_id: "subscription_id" * } */ export interface GetSubscriptionsRequest { /** * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve. */ - subscriptionId: string; + subscription_id: string; } diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/ListSubscriptionsRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/ListSubscriptionsRequest.ts index 1d9c241f6..fc605feb4 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/ListSubscriptionsRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/ListSubscriptionsRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example @@ -20,12 +20,12 @@ export interface ListSubscriptionsRequest { * Includes disabled [Subscription](entity:WebhookSubscription)s. * By default, all enabled [Subscription](entity:WebhookSubscription)s are returned. */ - includeDisabled?: boolean | null; + include_disabled?: 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; + sort_order?: 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. diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts index 2d08b14bb..48cc07013 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts @@ -5,18 +5,18 @@ /** * @example * { - * subscriptionId: "subscription_id", - * eventType: "payment.created" + * subscription_id: "subscription_id", + * event_type: "payment.created" * } */ export interface TestWebhookSubscriptionRequest { /** * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to test. */ - subscriptionId: string; + subscription_id: 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; + event_type?: 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 index 379f9f4e9..e308edf1a 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../../../../../../index"; +import * as Square from "../../../../../../index.js"; /** * @example * { - * subscriptionId: "subscription_id", + * subscription_id: "subscription_id", * subscription: { * name: "Updated Example Webhook Subscription", * enabled: false @@ -18,7 +18,7 @@ export interface UpdateWebhookSubscriptionRequest { /** * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update. */ - subscriptionId: string; + subscription_id: 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 index 3a61969f4..febcf8377 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts @@ -5,15 +5,15 @@ /** * @example * { - * subscriptionId: "subscription_id", - * idempotencyKey: "ed80ae6b-0654-473b-bbab-a39aee89a60d" + * subscription_id: "subscription_id", + * idempotency_key: "ed80ae6b-0654-473b-bbab-a39aee89a60d" * } */ export interface UpdateWebhookSubscriptionSignatureKeyRequest { /** * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update. */ - subscriptionId: string; + subscription_id: string; /** A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request. */ - idempotencyKey?: string | null; + idempotency_key?: 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 index f32c424a4..264639321 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/index.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/index.ts @@ -1,7 +1,7 @@ -export { type ListSubscriptionsRequest } from "./ListSubscriptionsRequest"; -export { type CreateWebhookSubscriptionRequest } from "./CreateWebhookSubscriptionRequest"; -export { type GetSubscriptionsRequest } from "./GetSubscriptionsRequest"; -export { type UpdateWebhookSubscriptionRequest } from "./UpdateWebhookSubscriptionRequest"; -export { type DeleteSubscriptionsRequest } from "./DeleteSubscriptionsRequest"; -export { type UpdateWebhookSubscriptionSignatureKeyRequest } from "./UpdateWebhookSubscriptionSignatureKeyRequest"; -export { type TestWebhookSubscriptionRequest } from "./TestWebhookSubscriptionRequest"; +export { type ListSubscriptionsRequest } from "./ListSubscriptionsRequest.js"; +export { type CreateWebhookSubscriptionRequest } from "./CreateWebhookSubscriptionRequest.js"; +export { type GetSubscriptionsRequest } from "./GetSubscriptionsRequest.js"; +export { type UpdateWebhookSubscriptionRequest } from "./UpdateWebhookSubscriptionRequest.js"; +export { type DeleteSubscriptionsRequest } from "./DeleteSubscriptionsRequest.js"; +export { type UpdateWebhookSubscriptionSignatureKeyRequest } from "./UpdateWebhookSubscriptionSignatureKeyRequest.js"; +export { type TestWebhookSubscriptionRequest } from "./TestWebhookSubscriptionRequest.js"; diff --git a/src/api/resources/webhooks/resources/subscriptions/index.ts b/src/api/resources/webhooks/resources/subscriptions/index.ts index 5ec76921e..914b8c3c7 100644 --- a/src/api/resources/webhooks/resources/subscriptions/index.ts +++ b/src/api/resources/webhooks/resources/subscriptions/index.ts @@ -1 +1 @@ -export * from "./client"; +export * from "./client/index.js"; diff --git a/src/api/types/AcceptDisputeResponse.ts b/src/api/types/AcceptDisputeResponse.ts index 5cf8036d7..b7103e829 100644 --- a/src/api/types/AcceptDisputeResponse.ts +++ b/src/api/types/AcceptDisputeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields in an `AcceptDispute` response. diff --git a/src/api/types/AcceptedPaymentMethods.ts b/src/api/types/AcceptedPaymentMethods.ts index 0c05ee8f3..ae290c132 100644 --- a/src/api/types/AcceptedPaymentMethods.ts +++ b/src/api/types/AcceptedPaymentMethods.ts @@ -4,11 +4,11 @@ export interface AcceptedPaymentMethods { /** Whether Apple Pay is accepted at checkout. */ - applePay?: boolean | null; + apple_pay?: boolean | null; /** Whether Google Pay is accepted at checkout. */ - googlePay?: boolean | null; + google_pay?: boolean | null; /** Whether Cash App Pay is accepted at checkout. */ - cashAppPay?: boolean | null; + cash_app_pay?: boolean | null; /** Whether Afterpay/Clearpay is accepted at checkout. */ - afterpayClearpay?: boolean | null; + afterpay_clearpay?: boolean | null; } diff --git a/src/api/types/AccumulateLoyaltyPointsResponse.ts b/src/api/types/AccumulateLoyaltyPointsResponse.ts index 524ee73d3..279c75f10 100644 --- a/src/api/types/AccumulateLoyaltyPointsResponse.ts +++ b/src/api/types/AccumulateLoyaltyPointsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) response. diff --git a/src/api/types/AchDetails.ts b/src/api/types/AchDetails.ts index cdf932f07..447b6e35f 100644 --- a/src/api/types/AchDetails.ts +++ b/src/api/types/AchDetails.ts @@ -7,12 +7,12 @@ */ export interface AchDetails { /** The routing number for the bank account. */ - routingNumber?: string | null; + routing_number?: string | null; /** The last few digits of the bank account number. */ - accountNumberSuffix?: string | null; + account_number_suffix?: string | null; /** * The type of the bank account performing the transfer. The account type can be `CHECKING`, * `SAVINGS`, or `UNKNOWN`. */ - accountType?: string | null; + account_type?: string | null; } diff --git a/src/api/types/AddGroupToCustomerResponse.ts b/src/api/types/AddGroupToCustomerResponse.ts index 064a809ed..49c656297 100644 --- a/src/api/types/AddGroupToCustomerResponse.ts +++ b/src/api/types/AddGroupToCustomerResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/AdditionalRecipient.ts b/src/api/types/AdditionalRecipient.ts index 35b50da40..fae475474 100644 --- a/src/api/types/AdditionalRecipient.ts +++ b/src/api/types/AdditionalRecipient.ts @@ -2,18 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + location_id: string; /** The description of the additional recipient. */ description?: string | null; /** The amount of money distributed to the recipient. */ - amountMoney: Square.Money; + amount_money: 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; + receivable_id?: string | null; } diff --git a/src/api/types/Address.ts b/src/api/types/Address.ts index 31ed6e0dd..687acf6b4 100644 --- a/src/api/types/Address.ts +++ b/src/api/types/Address.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a postal address in a country. @@ -17,43 +17,43 @@ export interface Address { * provide less specific details like city, state/province, or country (these * details are provided in other fields). */ - addressLine1?: string | null; + address_line_1?: string | null; /** The second line of the address, if any. */ - addressLine2?: string | null; + address_line_2?: string | null; /** The third line of the address, if any. */ - addressLine3?: string | null; + address_line_3?: 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; + sublocality_2?: string | null; /** A civil region within the address's `sublocality_2`, if any. */ - sublocality3?: string | null; + sublocality_3?: 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; + administrative_district_level_1?: string | null; /** * A civil entity within the address's `administrative_district_level_1`. * In the US, this is the county. */ - administrativeDistrictLevel2?: string | null; + administrative_district_level_2?: string | null; /** * A civil entity within the address's `administrative_district_level_2`, * if any. */ - administrativeDistrictLevel3?: string | null; + administrative_district_level_3?: 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; + postal_code?: 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; + first_name?: string | null; /** Optional last name when it's representing recipient. */ - lastName?: string | null; + last_name?: string | null; } diff --git a/src/api/types/AdjustLoyaltyPointsResponse.ts b/src/api/types/AdjustLoyaltyPointsResponse.ts index 90365ec62..f12bdcd82 100644 --- a/src/api/types/AdjustLoyaltyPointsResponse.ts +++ b/src/api/types/AdjustLoyaltyPointsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [AdjustLoyaltyPoints](api-endpoint:Loyalty-AdjustLoyaltyPoints) request. diff --git a/src/api/types/AfterpayDetails.ts b/src/api/types/AfterpayDetails.ts index 48fbcac19..1e50392b1 100644 --- a/src/api/types/AfterpayDetails.ts +++ b/src/api/types/AfterpayDetails.ts @@ -7,5 +7,5 @@ */ export interface AfterpayDetails { /** Email address on the buyer's Afterpay account. */ - emailAddress?: string | null; + email_address?: string | null; } diff --git a/src/api/types/ApplicationDetails.ts b/src/api/types/ApplicationDetails.ts index af1fb2d46..c29e6a8f3 100644 --- a/src/api/types/ApplicationDetails.ts +++ b/src/api/types/ApplicationDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Details about the application that took the payment. @@ -13,7 +13,7 @@ export interface ApplicationDetails { * Square Invoices, or Square Virtual Terminal. * See [ExternalSquareProduct](#type-externalsquareproduct) for possible values */ - squareProduct?: Square.ApplicationDetailsExternalSquareProduct; + square_product?: Square.ApplicationDetailsExternalSquareProduct; /** * The Square ID assigned to the application used to take the payment. * Application developers can use this information to identify payments that @@ -23,5 +23,5 @@ export interface ApplicationDetails { * 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; + application_id?: string | null; } diff --git a/src/api/types/AppointmentSegment.ts b/src/api/types/AppointmentSegment.ts index fd5e7e479..53a8009ca 100644 --- a/src/api/types/AppointmentSegment.ts +++ b/src/api/types/AppointmentSegment.ts @@ -7,17 +7,17 @@ */ export interface AppointmentSegment { /** The time span in minutes of an appointment segment. */ - durationMinutes?: number | null; + duration_minutes?: number | null; /** The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. */ - serviceVariationId?: string | null; + service_variation_id?: string | null; /** The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment. */ - teamMemberId: string; + team_member_id: string; /** The current version of the item variation representing the service booked in this segment. */ - serviceVariationVersion?: bigint | null; + service_variation_version?: (number | bigint) | null; /** Time between the end of this segment and the beginning of the subsequent segment. */ - intermissionMinutes?: number; + intermission_minutes?: number; /** Whether the customer accepts any team member, instead of a specific one, to serve this segment. */ - anyTeamMember?: boolean; + any_team_member?: boolean; /** The IDs of the seller-accessible resources used for this appointment segment. */ - resourceIds?: string[]; + resource_ids?: string[]; } diff --git a/src/api/types/Availability.ts b/src/api/types/Availability.ts index 3dfd740d8..66079ef02 100644 --- a/src/api/types/Availability.ts +++ b/src/api/types/Availability.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + start_at?: string | null; /** The ID of the location available for booking. */ - locationId?: string; + location_id?: string; /** The list of appointment segments available for booking */ - appointmentSegments?: Square.AppointmentSegment[] | null; + appointment_segments?: Square.AppointmentSegment[] | null; } diff --git a/src/api/types/BankAccount.ts b/src/api/types/BankAccount.ts index 46946a700..14c7de5b1 100644 --- a/src/api/types/BankAccount.ts +++ b/src/api/types/BankAccount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a bank account. For more information about @@ -13,7 +13,7 @@ export interface BankAccount { /** The unique, Square-issued identifier for the bank account. */ id: string; /** The last few digits of the account number. */ - accountNumberSuffix: string; + account_number_suffix: string; /** * The ISO 3166 Alpha-2 country code where the bank account is based. * See [Country](#type-country) for possible values @@ -30,34 +30,34 @@ export interface BankAccount { * The financial purpose of the associated bank account. * See [BankAccountType](#type-bankaccounttype) for possible values */ - accountType: Square.BankAccountType; + account_type: Square.BankAccountType; /** * Name of the account holder. This name must match the name * on the targeted bank account record. */ - holderName: string; + holder_name: string; /** * Primary identifier for the bank. For more information, see * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). */ - primaryBankIdentificationNumber: string; + primary_bank_identification_number: string; /** * Secondary identifier for the bank. For more information, see * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). */ - secondaryBankIdentificationNumber?: string | null; + secondary_bank_identification_number?: 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; + debit_mandate_reference_id?: 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; + reference_id?: string | null; /** The location to which the bank account belongs. */ - locationId?: string | null; + location_id?: string | null; /** * Read-only. The current verification status of this BankAccount object. * See [BankAccountStatus](#type-bankaccountstatus) for possible values @@ -82,5 +82,5 @@ export interface BankAccount { * Read only. Name of actual financial institution. * For example "Bank of America". */ - bankName?: string | null; + bank_name?: string | null; } diff --git a/src/api/types/BankAccountCreatedEvent.ts b/src/api/types/BankAccountCreatedEvent.ts index 71b39e5cf..a83e538f0 100644 --- a/src/api/types/BankAccountCreatedEvent.ts +++ b/src/api/types/BankAccountCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when you link an external bank account to a Square @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface BankAccountCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"bank_account.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.BankAccountCreatedEventData; } diff --git a/src/api/types/BankAccountCreatedEventData.ts b/src/api/types/BankAccountCreatedEventData.ts index f3fedf2ea..cf87b8c82 100644 --- a/src/api/types/BankAccountCreatedEventData.ts +++ b/src/api/types/BankAccountCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BankAccountCreatedEventData { /** Name of the affected object’s type, `"bank_account"`. */ diff --git a/src/api/types/BankAccountCreatedEventObject.ts b/src/api/types/BankAccountCreatedEventObject.ts index 34545b8dc..d3ed1e827 100644 --- a/src/api/types/BankAccountCreatedEventObject.ts +++ b/src/api/types/BankAccountCreatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BankAccountCreatedEventObject { /** The created bank account. */ - bankAccount?: Square.BankAccount; + bank_account?: Square.BankAccount; } diff --git a/src/api/types/BankAccountDisabledEvent.ts b/src/api/types/BankAccountDisabledEvent.ts index 9e54b24de..a9dfbe390 100644 --- a/src/api/types/BankAccountDisabledEvent.ts +++ b/src/api/types/BankAccountDisabledEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when Square sets the status of a @@ -10,15 +10,15 @@ import * as Square from "../index"; */ export interface BankAccountDisabledEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"bank_account.disabled"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was disabled, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.BankAccountDisabledEventData; } diff --git a/src/api/types/BankAccountDisabledEventData.ts b/src/api/types/BankAccountDisabledEventData.ts index 842bb3dac..21864891c 100644 --- a/src/api/types/BankAccountDisabledEventData.ts +++ b/src/api/types/BankAccountDisabledEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BankAccountDisabledEventData { /** Name of the affected object’s type, `"bank_account"`. */ diff --git a/src/api/types/BankAccountDisabledEventObject.ts b/src/api/types/BankAccountDisabledEventObject.ts index 8ef0589dc..824f0067e 100644 --- a/src/api/types/BankAccountDisabledEventObject.ts +++ b/src/api/types/BankAccountDisabledEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BankAccountDisabledEventObject { /** The disabled bank account. */ - bankAccount?: Square.BankAccount; + bank_account?: Square.BankAccount; } diff --git a/src/api/types/BankAccountPaymentDetails.ts b/src/api/types/BankAccountPaymentDetails.ts index 67c412152..34645e1d2 100644 --- a/src/api/types/BankAccountPaymentDetails.ts +++ b/src/api/types/BankAccountPaymentDetails.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Additional details about BANK_ACCOUNT type payments. */ export interface BankAccountPaymentDetails { /** The name of the bank associated with the bank account. */ - bankName?: string | null; + bank_name?: string | null; /** The type of the bank transfer. The type can be `ACH` or `UNKNOWN`. */ - transferType?: string | null; + transfer_type?: 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; + account_ownership_type?: string | null; /** * Uniquely identifies the bank account for this seller and can be used * to determine if payments are from the same bank account. @@ -25,12 +25,12 @@ export interface BankAccountPaymentDetails { /** 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; + statement_description?: string | null; /** * ACH-specific information about the transfer. The information is only populated * if the `transfer_type` is `ACH`. */ - achDetails?: Square.AchDetails; + ach_details?: Square.AchDetails; /** Information about errors encountered during the request. */ errors?: Square.Error_[] | null; } diff --git a/src/api/types/BankAccountVerifiedEvent.ts b/src/api/types/BankAccountVerifiedEvent.ts index ffbf6a3a2..7cbad2f57 100644 --- a/src/api/types/BankAccountVerifiedEvent.ts +++ b/src/api/types/BankAccountVerifiedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when Square sets the status of a @@ -10,15 +10,15 @@ import * as Square from "../index"; */ export interface BankAccountVerifiedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"bank_account.verified"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was verified, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.BankAccountVerifiedEventData; } diff --git a/src/api/types/BankAccountVerifiedEventData.ts b/src/api/types/BankAccountVerifiedEventData.ts index 7976fc30a..c0174493d 100644 --- a/src/api/types/BankAccountVerifiedEventData.ts +++ b/src/api/types/BankAccountVerifiedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BankAccountVerifiedEventData { /** Name of the affected object’s type, `"bank_account"`. */ diff --git a/src/api/types/BankAccountVerifiedEventObject.ts b/src/api/types/BankAccountVerifiedEventObject.ts index 26af16448..2f428a6a6 100644 --- a/src/api/types/BankAccountVerifiedEventObject.ts +++ b/src/api/types/BankAccountVerifiedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BankAccountVerifiedEventObject { /** The verified bank account. */ - bankAccount?: Square.BankAccount; + bank_account?: Square.BankAccount; } diff --git a/src/api/types/BatchChangeInventoryRequest.ts b/src/api/types/BatchChangeInventoryRequest.ts index 1399ddc0d..06ffc1c42 100644 --- a/src/api/types/BatchChangeInventoryRequest.ts +++ b/src/api/types/BatchChangeInventoryRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BatchChangeInventoryRequest { /** @@ -13,7 +13,7 @@ export interface BatchChangeInventoryRequest { * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more * information. */ - idempotencyKey: string; + idempotency_key: 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 @@ -24,5 +24,5 @@ export interface BatchChangeInventoryRequest { * Indicates whether the current physical count should be ignored if * the quantity is unchanged since the last physical count. Default: `true`. */ - ignoreUnchangedCounts?: boolean | null; + ignore_unchanged_counts?: boolean | null; } diff --git a/src/api/types/BatchChangeInventoryResponse.ts b/src/api/types/BatchChangeInventoryResponse.ts index cbda27c7c..d6476ce94 100644 --- a/src/api/types/BatchChangeInventoryResponse.ts +++ b/src/api/types/BatchChangeInventoryResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BatchChangeInventoryResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/BatchCreateTeamMembersResponse.ts b/src/api/types/BatchCreateTeamMembersResponse.ts index cdcb977b4..d4e260178 100644 --- a/src/api/types/BatchCreateTeamMembersResponse.ts +++ b/src/api/types/BatchCreateTeamMembersResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + team_members?: 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 index 80ac755e2..e9fbf165d 100644 --- a/src/api/types/BatchCreateVendorsResponse.ts +++ b/src/api/types/BatchCreateVendorsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an output from a call to [BulkCreateVendors](api-endpoint:Vendors-BulkCreateVendors). diff --git a/src/api/types/BatchDeleteCatalogObjectsResponse.ts b/src/api/types/BatchDeleteCatalogObjectsResponse.ts index 18104eca4..bb90012f0 100644 --- a/src/api/types/BatchDeleteCatalogObjectsResponse.ts +++ b/src/api/types/BatchDeleteCatalogObjectsResponse.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BatchDeleteCatalogObjectsResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The IDs of all CatalogObjects deleted by this request. */ - deletedObjectIds?: string[]; + deleted_object_ids?: 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; + deleted_at?: string; } diff --git a/src/api/types/BatchGetCatalogObjectsResponse.ts b/src/api/types/BatchGetCatalogObjectsResponse.ts index 55ec80255..5691c018e 100644 --- a/src/api/types/BatchGetCatalogObjectsResponse.ts +++ b/src/api/types/BatchGetCatalogObjectsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BatchGetCatalogObjectsResponse { /** Any errors that occurred during the request. */ @@ -10,5 +10,5 @@ export interface BatchGetCatalogObjectsResponse { /** 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[]; + related_objects?: Square.CatalogObject[]; } diff --git a/src/api/types/BatchGetInventoryChangesResponse.ts b/src/api/types/BatchGetInventoryChangesResponse.ts index 9921d17fe..c6706fc62 100644 --- a/src/api/types/BatchGetInventoryChangesResponse.ts +++ b/src/api/types/BatchGetInventoryChangesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BatchGetInventoryChangesResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/BatchGetInventoryCountsRequest.ts b/src/api/types/BatchGetInventoryCountsRequest.ts index 2a606e459..abf08725f 100644 --- a/src/api/types/BatchGetInventoryCountsRequest.ts +++ b/src/api/types/BatchGetInventoryCountsRequest.ts @@ -2,25 +2,25 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + catalog_object_ids?: string[] | null; /** * The filter to return results by `Location` ID. * This filter is applicable only when set. The default is null. */ - locationIds?: string[] | null; + location_ids?: 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; + updated_after?: 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. diff --git a/src/api/types/BatchGetInventoryCountsResponse.ts b/src/api/types/BatchGetInventoryCountsResponse.ts index 3f436778a..3acbc6d64 100644 --- a/src/api/types/BatchGetInventoryCountsResponse.ts +++ b/src/api/types/BatchGetInventoryCountsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BatchGetInventoryCountsResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/BatchGetOrdersResponse.ts b/src/api/types/BatchGetOrdersResponse.ts index 82b088f50..cfb2d1197 100644 --- a/src/api/types/BatchGetOrdersResponse.ts +++ b/src/api/types/BatchGetOrdersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/BatchGetVendorsResponse.ts b/src/api/types/BatchGetVendorsResponse.ts index 3c3cb05d1..4a6fb46a0 100644 --- a/src/api/types/BatchGetVendorsResponse.ts +++ b/src/api/types/BatchGetVendorsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an output from a call to [BulkRetrieveVendors](api-endpoint:Vendors-BulkRetrieveVendors). diff --git a/src/api/types/BatchRetrieveInventoryChangesRequest.ts b/src/api/types/BatchRetrieveInventoryChangesRequest.ts index 66c6c1cb7..8af7e06f0 100644 --- a/src/api/types/BatchRetrieveInventoryChangesRequest.ts +++ b/src/api/types/BatchRetrieveInventoryChangesRequest.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + catalog_object_ids?: 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; + location_ids?: string[] | null; /** * The filter to return results by `InventoryChangeType` values other than `TRANSFER`. * The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. @@ -31,13 +31,13 @@ export interface BatchRetrieveInventoryChangesRequest { * 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; + updated_after?: 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; + updated_before?: 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. diff --git a/src/api/types/BatchUpdateTeamMembersResponse.ts b/src/api/types/BatchUpdateTeamMembersResponse.ts index c3b6d9cb7..5594b9e1d 100644 --- a/src/api/types/BatchUpdateTeamMembersResponse.ts +++ b/src/api/types/BatchUpdateTeamMembersResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + team_members?: 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 index e9e88cd75..4f899ab60 100644 --- a/src/api/types/BatchUpdateVendorsResponse.ts +++ b/src/api/types/BatchUpdateVendorsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an output from a call to [BulkUpdateVendors](api-endpoint:Vendors-BulkUpdateVendors). diff --git a/src/api/types/BatchUpsertCatalogObjectsResponse.ts b/src/api/types/BatchUpsertCatalogObjectsResponse.ts index 96bb78280..036e0c942 100644 --- a/src/api/types/BatchUpsertCatalogObjectsResponse.ts +++ b/src/api/types/BatchUpsertCatalogObjectsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BatchUpsertCatalogObjectsResponse { /** Any errors that occurred during the request. */ @@ -10,7 +10,7 @@ export interface BatchUpsertCatalogObjectsResponse { /** 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; + updated_at?: string; /** The mapping between client and server IDs for this upsert. */ - idMappings?: Square.CatalogIdMapping[]; + id_mappings?: Square.CatalogIdMapping[]; } diff --git a/src/api/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts b/src/api/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts index ee0132735..b3635f63b 100644 --- a/src/api/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts +++ b/src/api/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest { /** The ID of the target [customer profile](entity:Customer). */ - customerId: string; + customer_id: string; /** * The custom attribute to create or update, with following fields: * @@ -25,10 +25,10 @@ export interface BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttribu * 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; + custom_attribute: 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; + idempotency_key?: string | null; } diff --git a/src/api/types/BatchUpsertCustomerCustomAttributesResponse.ts b/src/api/types/BatchUpsertCustomerCustomAttributesResponse.ts index 800dbb96e..bc75e45eb 100644 --- a/src/api/types/BatchUpsertCustomerCustomAttributesResponse.ts +++ b/src/api/types/BatchUpsertCustomerCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) response, diff --git a/src/api/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts b/src/api/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts index 3436be474..70fe39e65 100644 --- a/src/api/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts +++ b/src/api/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + customer_id?: string; /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index c861453d3..62f71c1a1 100644 --- a/src/api/types/Booking.ts +++ b/src/api/types/Booking.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service @@ -19,38 +19,38 @@ export interface Booking { */ status?: Square.BookingStatus; /** The RFC 3339 timestamp specifying the creation time of this booking. */ - createdAt?: string; + created_at?: string; /** The RFC 3339 timestamp specifying the most recent update time of this booking. */ - updatedAt?: string; + updated_at?: string; /** The RFC 3339 timestamp specifying the starting time of this booking. */ - startAt?: string | null; + start_at?: 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; + location_id?: string | null; /** The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service. */ - customerId?: string | null; + customer_id?: 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; + customer_note?: 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; + seller_note?: string | null; /** A list of appointment segments for this booking. */ - appointmentSegments?: Square.AppointmentSegment[] | null; + appointment_segments?: 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; + transition_time_minutes?: number; /** Whether the booking is of a full business day. */ - allDay?: boolean; + all_day?: boolean; /** * The type of location where the booking is held. * See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values */ - locationType?: Square.BusinessAppointmentSettingsBookingLocationType; + location_type?: Square.BusinessAppointmentSettingsBookingLocationType; /** Information about the booking creator. */ - creatorDetails?: Square.BookingCreatorDetails; + creator_details?: Square.BookingCreatorDetails; /** * The source of the booking. * Access to this field requires seller-level permissions. diff --git a/src/api/types/BookingCreatedEvent.ts b/src/api/types/BookingCreatedEvent.ts index 646208cca..72aba8262 100644 --- a/src/api/types/BookingCreatedEvent.ts +++ b/src/api/types/BookingCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking is created. @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface BookingCreatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.BookingCreatedEventData; } diff --git a/src/api/types/BookingCreatedEventData.ts b/src/api/types/BookingCreatedEventData.ts index ec3d1584d..9dae81ff2 100644 --- a/src/api/types/BookingCreatedEventData.ts +++ b/src/api/types/BookingCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BookingCreatedEventData { /** The type of the event data object. The value is `"booking"`. */ diff --git a/src/api/types/BookingCreatedEventObject.ts b/src/api/types/BookingCreatedEventObject.ts index 1d59263ab..fb143c3c0 100644 --- a/src/api/types/BookingCreatedEventObject.ts +++ b/src/api/types/BookingCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BookingCreatedEventObject { /** The created booking. */ diff --git a/src/api/types/BookingCreatorDetails.ts b/src/api/types/BookingCreatorDetails.ts index 95337d4ca..cba8c4fa7 100644 --- a/src/api/types/BookingCreatorDetails.ts +++ b/src/api/types/BookingCreatorDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Information about a booking creator. @@ -12,15 +12,15 @@ export interface BookingCreatorDetails { * The seller-accessible type of the creator of the booking. * See [BookingCreatorDetailsCreatorType](#type-bookingcreatordetailscreatortype) for possible values */ - creatorType?: Square.BookingCreatorDetailsCreatorType; + creator_type?: 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; + team_member_id?: 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; + customer_id?: string; } diff --git a/src/api/types/BookingCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/api/types/BookingCustomAttributeDefinitionOwnedCreatedEvent.ts index d0fa96275..830e0e917 100644 --- a/src/api/types/BookingCustomAttributeDefinitionOwnedCreatedEvent.ts +++ b/src/api/types/BookingCustomAttributeDefinitionOwnedCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeDefinitionOwnedCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute_definition.owned.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/BookingCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/api/types/BookingCustomAttributeDefinitionOwnedDeletedEvent.ts index 6088ec85c..22abca6a1 100644 --- a/src/api/types/BookingCustomAttributeDefinitionOwnedDeletedEvent.ts +++ b/src/api/types/BookingCustomAttributeDefinitionOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeDefinitionOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute_definition.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/BookingCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/api/types/BookingCustomAttributeDefinitionOwnedUpdatedEvent.ts index 426ba305f..0afd3ca98 100644 --- a/src/api/types/BookingCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ b/src/api/types/BookingCustomAttributeDefinitionOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeDefinitionOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute_definition.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/BookingCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/api/types/BookingCustomAttributeDefinitionVisibleCreatedEvent.ts index 42a436488..6631f0afc 100644 --- a/src/api/types/BookingCustomAttributeDefinitionVisibleCreatedEvent.ts +++ b/src/api/types/BookingCustomAttributeDefinitionVisibleCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeDefinitionVisibleCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute_definition.visible.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/BookingCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/api/types/BookingCustomAttributeDefinitionVisibleDeletedEvent.ts index 9f4cb79d4..67122b3ef 100644 --- a/src/api/types/BookingCustomAttributeDefinitionVisibleDeletedEvent.ts +++ b/src/api/types/BookingCustomAttributeDefinitionVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeDefinitionVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute_definition.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/BookingCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/api/types/BookingCustomAttributeDefinitionVisibleUpdatedEvent.ts index 01afeca30..3d4833845 100644 --- a/src/api/types/BookingCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ b/src/api/types/BookingCustomAttributeDefinitionVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeDefinitionVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute_definition.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/BookingCustomAttributeDeleteRequest.ts b/src/api/types/BookingCustomAttributeDeleteRequest.ts index 216588d1b..a86902fbd 100644 --- a/src/api/types/BookingCustomAttributeDeleteRequest.ts +++ b/src/api/types/BookingCustomAttributeDeleteRequest.ts @@ -8,7 +8,7 @@ */ export interface BookingCustomAttributeDeleteRequest { /** The ID of the target [booking](entity:Booking). */ - bookingId: string; + booking_id: 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 diff --git a/src/api/types/BookingCustomAttributeDeleteResponse.ts b/src/api/types/BookingCustomAttributeDeleteResponse.ts index fd2712f24..cde1facd6 100644 --- a/src/api/types/BookingCustomAttributeDeleteResponse.ts +++ b/src/api/types/BookingCustomAttributeDeleteResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + booking_id?: string; /** Any errors that occurred while processing the individual request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/BookingCustomAttributeOwnedDeletedEvent.ts b/src/api/types/BookingCustomAttributeOwnedDeletedEvent.ts index 00ea41bcb..32742eff2 100644 --- a/src/api/types/BookingCustomAttributeOwnedDeletedEvent.ts +++ b/src/api/types/BookingCustomAttributeOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute](entity:CustomAttribute) @@ -13,13 +13,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/BookingCustomAttributeOwnedUpdatedEvent.ts b/src/api/types/BookingCustomAttributeOwnedUpdatedEvent.ts index 60c9a8944..2d65ff299 100644 --- a/src/api/types/BookingCustomAttributeOwnedUpdatedEvent.ts +++ b/src/api/types/BookingCustomAttributeOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute](entity:CustomAttribute) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/BookingCustomAttributeUpsertRequest.ts b/src/api/types/BookingCustomAttributeUpsertRequest.ts index 1635a8103..0e80d9d18 100644 --- a/src/api/types/BookingCustomAttributeUpsertRequest.ts +++ b/src/api/types/BookingCustomAttributeUpsertRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeUpsertRequest { /** The ID of the target [booking](entity:Booking). */ - bookingId: string; + booking_id: string; /** * The custom attribute to create or update, with following fields: * @@ -25,10 +25,10 @@ export interface BookingCustomAttributeUpsertRequest { * 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; + custom_attribute: 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; + idempotency_key?: string | null; } diff --git a/src/api/types/BookingCustomAttributeUpsertResponse.ts b/src/api/types/BookingCustomAttributeUpsertResponse.ts index bcd008f99..a224e82f7 100644 --- a/src/api/types/BookingCustomAttributeUpsertResponse.ts +++ b/src/api/types/BookingCustomAttributeUpsertResponse.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + booking_id?: string; /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: Square.CustomAttribute; /** Any errors that occurred while processing the individual request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/BookingCustomAttributeVisibleDeletedEvent.ts b/src/api/types/BookingCustomAttributeVisibleDeletedEvent.ts index b3c26f81a..0179fe377 100644 --- a/src/api/types/BookingCustomAttributeVisibleDeletedEvent.ts +++ b/src/api/types/BookingCustomAttributeVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute](entity:CustomAttribute) with @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/BookingCustomAttributeVisibleUpdatedEvent.ts b/src/api/types/BookingCustomAttributeVisibleUpdatedEvent.ts index 8451ca112..77301d576 100644 --- a/src/api/types/BookingCustomAttributeVisibleUpdatedEvent.ts +++ b/src/api/types/BookingCustomAttributeVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking [custom attribute](entity:CustomAttribute) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface BookingCustomAttributeVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.custom_attribute.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/BookingUpdatedEvent.ts b/src/api/types/BookingUpdatedEvent.ts index 5304a624b..8ccacb134 100644 --- a/src/api/types/BookingUpdatedEvent.ts +++ b/src/api/types/BookingUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a booking is updated or cancelled. @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface BookingUpdatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"booking.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.BookingUpdatedEventData; } diff --git a/src/api/types/BookingUpdatedEventData.ts b/src/api/types/BookingUpdatedEventData.ts index 9bf4fd8f5..3feebb722 100644 --- a/src/api/types/BookingUpdatedEventData.ts +++ b/src/api/types/BookingUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BookingUpdatedEventData { /** The type of the event data object. The value is `"booking"`. */ diff --git a/src/api/types/BookingUpdatedEventObject.ts b/src/api/types/BookingUpdatedEventObject.ts index 98f157bb1..a1ba6118d 100644 --- a/src/api/types/BookingUpdatedEventObject.ts +++ b/src/api/types/BookingUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface BookingUpdatedEventObject { /** The updated booking. */ diff --git a/src/api/types/Break.ts b/src/api/types/Break.ts index 431faeb27..decb10a50 100644 --- a/src/api/types/Break.ts +++ b/src/api/types/Break.ts @@ -12,14 +12,14 @@ export interface Break { * RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to * the minute is respected; seconds are truncated. */ - startAt: string; + start_at: string; /** * RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to * the minute is respected; seconds are truncated. */ - endAt?: string | null; + end_at?: string | null; /** The [BreakType](entity:BreakType) that this break was templated on. */ - breakTypeId: string; + break_type_id: string; /** A human-readable name. */ name: string; /** @@ -28,10 +28,10 @@ export interface Break { * * Example for break expected duration of 15 minutes: PT15M */ - expectedDuration: string; + expected_duration: string; /** * Whether this break counts towards time worked for compensation * purposes. */ - isPaid: boolean; + is_paid: boolean; } diff --git a/src/api/types/BreakType.ts b/src/api/types/BreakType.ts index d27453549..1f341915f 100644 --- a/src/api/types/BreakType.ts +++ b/src/api/types/BreakType.ts @@ -10,24 +10,24 @@ export interface BreakType { /** The UUID for this object. */ id?: string; /** The ID of the business location this type of break applies to. */ - locationId: string; + location_id: string; /** * A human-readable name for this type of break. The name is displayed to * team members in Square products. */ - breakName: string; + break_name: 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: PT15M */ - expectedDuration: string; + expected_duration: string; /** * Whether this break counts towards time worked for compensation * purposes. */ - isPaid: boolean; + is_paid: 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 @@ -36,7 +36,7 @@ export interface BreakType { */ version?: number; /** A read-only timestamp in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** A read-only timestamp in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/BulkCreateCustomerData.ts b/src/api/types/BulkCreateCustomerData.ts index 855023880..8d9f0b480 100644 --- a/src/api/types/BulkCreateCustomerData.ts +++ b/src/api/types/BulkCreateCustomerData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the customer data provided in individual create requests for a @@ -10,15 +10,15 @@ import * as Square from "../index"; */ export interface BulkCreateCustomerData { /** The given name (that is, the first name) associated with the customer profile. */ - givenName?: string | null; + given_name?: string | null; /** The family name (that is, the last name) associated with the customer profile. */ - familyName?: string | null; + family_name?: string | null; /** A business name associated with the customer profile. */ - companyName?: string | null; + company_name?: string | null; /** A nickname for the customer profile. */ nickname?: string | null; /** The email address associated with the customer profile. */ - emailAddress?: string | null; + email_address?: 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). @@ -30,12 +30,12 @@ export interface BulkCreateCustomerData { * 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; + phone_number?: string | null; /** * An optional second ID used to associate the customer profile with an * entity in another system. */ - referenceId?: string | null; + reference_id?: string | null; /** A custom note associated with the customer profile. */ note?: string | null; /** @@ -50,5 +50,5 @@ export interface BulkCreateCustomerData { * 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; + tax_ids?: Square.CustomerTaxIds; } diff --git a/src/api/types/BulkCreateCustomersResponse.ts b/src/api/types/BulkCreateCustomersResponse.ts index e9c805cb1..a8e68272b 100644 --- a/src/api/types/BulkCreateCustomersResponse.ts +++ b/src/api/types/BulkCreateCustomersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields included in the response body from the diff --git a/src/api/types/BulkDeleteBookingCustomAttributesResponse.ts b/src/api/types/BulkDeleteBookingCustomAttributesResponse.ts index 74b016507..fb7ca80fe 100644 --- a/src/api/types/BulkDeleteBookingCustomAttributesResponse.ts +++ b/src/api/types/BulkDeleteBookingCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) response, diff --git a/src/api/types/BulkDeleteCustomersResponse.ts b/src/api/types/BulkDeleteCustomersResponse.ts index 85c1433f0..634e2d949 100644 --- a/src/api/types/BulkDeleteCustomersResponse.ts +++ b/src/api/types/BulkDeleteCustomersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields included in the response body from the diff --git a/src/api/types/BulkDeleteLocationCustomAttributesResponse.ts b/src/api/types/BulkDeleteLocationCustomAttributesResponse.ts index 468fdcc14..db2da9b9b 100644 --- a/src/api/types/BulkDeleteLocationCustomAttributesResponse.ts +++ b/src/api/types/BulkDeleteLocationCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) response, diff --git a/src/api/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts b/src/api/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts index 66e4519b1..12a5431dd 100644 --- a/src/api/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts +++ b/src/api/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse { /** The ID of the location associated with the custom attribute. */ - locationId?: string; + location_id?: string; /** Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request */ errors?: Square.Error_[]; } diff --git a/src/api/types/BulkDeleteMerchantCustomAttributesResponse.ts b/src/api/types/BulkDeleteMerchantCustomAttributesResponse.ts index 226851e80..e6820b07a 100644 --- a/src/api/types/BulkDeleteMerchantCustomAttributesResponse.ts +++ b/src/api/types/BulkDeleteMerchantCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) response, diff --git a/src/api/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts b/src/api/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts index e2d3355fe..048ba06be 100644 --- a/src/api/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts +++ b/src/api/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) diff --git a/src/api/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts b/src/api/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts index ac779af87..d43b42548 100644 --- a/src/api/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts +++ b/src/api/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts @@ -12,5 +12,5 @@ export interface BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute { */ key?: string; /** The ID of the target [order](entity:Order). */ - orderId: string; + order_id: string; } diff --git a/src/api/types/BulkDeleteOrderCustomAttributesResponse.ts b/src/api/types/BulkDeleteOrderCustomAttributesResponse.ts index c163ac122..d05f1782c 100644 --- a/src/api/types/BulkDeleteOrderCustomAttributesResponse.ts +++ b/src/api/types/BulkDeleteOrderCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from deleting one or more order custom attributes. diff --git a/src/api/types/BulkPublishScheduledShiftsResponse.ts b/src/api/types/BulkPublishScheduledShiftsResponse.ts index 9bd347fb8..bbbe47371 100644 --- a/src/api/types/BulkPublishScheduledShiftsResponse.ts +++ b/src/api/types/BulkPublishScheduledShiftsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) response. diff --git a/src/api/types/BulkRetrieveBookingsResponse.ts b/src/api/types/BulkRetrieveBookingsResponse.ts index 5f852656a..77fd1ac1f 100644 --- a/src/api/types/BulkRetrieveBookingsResponse.ts +++ b/src/api/types/BulkRetrieveBookingsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Response payload for bulk retrieval of bookings. diff --git a/src/api/types/BulkRetrieveCustomersResponse.ts b/src/api/types/BulkRetrieveCustomersResponse.ts index 3fb4abeca..48b0b574d 100644 --- a/src/api/types/BulkRetrieveCustomersResponse.ts +++ b/src/api/types/BulkRetrieveCustomersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields included in the response body from the diff --git a/src/api/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts b/src/api/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts index 0b7f776e2..d8837d598 100644 --- a/src/api/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts +++ b/src/api/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + team_member_booking_profiles?: Record; /** Errors that occurred during the request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/BulkSwapPlanResponse.ts b/src/api/types/BulkSwapPlanResponse.ts index 6dcd1f10c..88bf861a6 100644 --- a/src/api/types/BulkSwapPlanResponse.ts +++ b/src/api/types/BulkSwapPlanResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response of the @@ -12,5 +12,5 @@ export interface BulkSwapPlanResponse { /** Errors encountered during the request. */ errors?: Square.Error_[]; /** The number of affected subscriptions. */ - affectedSubscriptions?: number; + affected_subscriptions?: number; } diff --git a/src/api/types/BulkUpdateCustomerData.ts b/src/api/types/BulkUpdateCustomerData.ts index 64c458abb..75024d4ed 100644 --- a/src/api/types/BulkUpdateCustomerData.ts +++ b/src/api/types/BulkUpdateCustomerData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the customer data provided in individual update requests for a @@ -10,15 +10,15 @@ import * as Square from "../index"; */ export interface BulkUpdateCustomerData { /** The given name (that is, the first name) associated with the customer profile. */ - givenName?: string | null; + given_name?: string | null; /** The family name (that is, the last name) associated with the customer profile. */ - familyName?: string | null; + family_name?: string | null; /** A business name associated with the customer profile. */ - companyName?: string | null; + company_name?: string | null; /** A nickname for the customer profile. */ nickname?: string | null; /** The email address associated with the customer profile. */ - emailAddress?: string | null; + email_address?: 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). @@ -30,12 +30,12 @@ export interface BulkUpdateCustomerData { * 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; + phone_number?: string | null; /** * An optional second ID used to associate the customer profile with an * entity in another system. */ - referenceId?: string | null; + reference_id?: string | null; /** An custom note associates with the customer profile. */ note?: string | null; /** @@ -50,7 +50,7 @@ export interface BulkUpdateCustomerData { * 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; + tax_ids?: Square.CustomerTaxIds; /** * The current version of the customer profile. * @@ -58,5 +58,5 @@ export interface BulkUpdateCustomerData { * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) * control. */ - version?: bigint; + version?: number | bigint; } diff --git a/src/api/types/BulkUpdateCustomersResponse.ts b/src/api/types/BulkUpdateCustomersResponse.ts index 484c88cd0..6263317c0 100644 --- a/src/api/types/BulkUpdateCustomersResponse.ts +++ b/src/api/types/BulkUpdateCustomersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields included in the response body from the diff --git a/src/api/types/BulkUpsertBookingCustomAttributesResponse.ts b/src/api/types/BulkUpsertBookingCustomAttributesResponse.ts index 9a7bd6c32..c1cb2886a 100644 --- a/src/api/types/BulkUpsertBookingCustomAttributesResponse.ts +++ b/src/api/types/BulkUpsertBookingCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) response, diff --git a/src/api/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts b/src/api/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts index a41ba1c28..492b180fb 100644 --- a/src/api/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts +++ b/src/api/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest { /** The ID of the target [location](entity:Location). */ - locationId: string; + location_id: 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 @@ -22,10 +22,10 @@ export interface BulkUpsertLocationCustomAttributesRequestLocationCustomAttribut * 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; + custom_attribute: 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; + idempotency_key?: string | null; } diff --git a/src/api/types/BulkUpsertLocationCustomAttributesResponse.ts b/src/api/types/BulkUpsertLocationCustomAttributesResponse.ts index f32c5792c..841923a7b 100644 --- a/src/api/types/BulkUpsertLocationCustomAttributesResponse.ts +++ b/src/api/types/BulkUpsertLocationCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) response, diff --git a/src/api/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts b/src/api/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts index 29be7dcb1..eea0b2112 100644 --- a/src/api/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts +++ b/src/api/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + location_id?: string; /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index 83382ffe7..f635ee2d2 100644 --- a/src/api/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts +++ b/src/api/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest { /** The ID of the target [merchant](entity:Merchant). */ - merchantId: string; + merchant_id: 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 @@ -22,10 +22,10 @@ export interface BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttribut * [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; + custom_attribute: 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; + idempotency_key?: string | null; } diff --git a/src/api/types/BulkUpsertMerchantCustomAttributesResponse.ts b/src/api/types/BulkUpsertMerchantCustomAttributesResponse.ts index 6e6845881..c66fafd3f 100644 --- a/src/api/types/BulkUpsertMerchantCustomAttributesResponse.ts +++ b/src/api/types/BulkUpsertMerchantCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) response, diff --git a/src/api/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts b/src/api/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts index 50e9680b5..24887d544 100644 --- a/src/api/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts +++ b/src/api/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + merchant_id?: string; /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index acf829020..7c010a2ea 100644 --- a/src/api/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts +++ b/src/api/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents one upsert within the bulk operation. @@ -17,12 +17,12 @@ export interface BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute { * - `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; + custom_attribute: 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; + idempotency_key?: string | null; /** The ID of the target [order](entity:Order). */ - orderId: string; + order_id: string; } diff --git a/src/api/types/BulkUpsertOrderCustomAttributesResponse.ts b/src/api/types/BulkUpsertOrderCustomAttributesResponse.ts index 2cccbde11..11d17f66e 100644 --- a/src/api/types/BulkUpsertOrderCustomAttributesResponse.ts +++ b/src/api/types/BulkUpsertOrderCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from a bulk upsert of order custom attributes. diff --git a/src/api/types/BusinessAppointmentSettings.ts b/src/api/types/BusinessAppointmentSettings.ts index f95139f7a..068789b09 100644 --- a/src/api/types/BusinessAppointmentSettings.ts +++ b/src/api/types/BusinessAppointmentSettings.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The service appointment settings, including where and how the service is provided. @@ -12,42 +12,42 @@ export interface BusinessAppointmentSettings { * Types of the location allowed for bookings. * See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values */ - locationTypes?: Square.BusinessAppointmentSettingsBookingLocationType[] | null; + location_types?: Square.BusinessAppointmentSettingsBookingLocationType[] | null; /** * The time unit of the service duration for bookings. * See [BusinessAppointmentSettingsAlignmentTime](#type-businessappointmentsettingsalignmenttime) for possible values */ - alignmentTime?: Square.BusinessAppointmentSettingsAlignmentTime; + alignment_time?: 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; + min_booking_lead_time_seconds?: 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; + max_booking_lead_time_seconds?: 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; + any_team_member_booking_enabled?: boolean | null; /** Indicates whether a customer can book multiple services in a single online booking. */ - multipleServiceBookingEnabled?: boolean | null; + multiple_service_booking_enabled?: 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; + max_appointments_per_day_limit_type?: Square.BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType; /** The maximum number of daily appointments per team member or per location. */ - maxAppointmentsPerDayLimit?: number | null; + max_appointments_per_day_limit?: number | null; /** The cut-off time in seconds for allowing clients to cancel or reschedule an appointment. */ - cancellationWindowSeconds?: number | null; + cancellation_window_seconds?: number | null; /** The flat-fee amount charged for a no-show booking. */ - cancellationFeeMoney?: Square.Money; + cancellation_fee_money?: Square.Money; /** * The cancellation policy adopted by the seller. * See [BusinessAppointmentSettingsCancellationPolicy](#type-businessappointmentsettingscancellationpolicy) for possible values */ - cancellationPolicy?: Square.BusinessAppointmentSettingsCancellationPolicy; + cancellation_policy?: Square.BusinessAppointmentSettingsCancellationPolicy; /** The free-form text of the seller's cancellation policy. */ - cancellationPolicyText?: string | null; + cancellation_policy_text?: string | null; /** Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`). */ - skipBookingFlowStaffSelection?: boolean | null; + skip_booking_flow_staff_selection?: boolean | null; } diff --git a/src/api/types/BusinessBookingProfile.ts b/src/api/types/BusinessBookingProfile.ts index f3ab7bd24..90e4b0703 100644 --- a/src/api/types/BusinessBookingProfile.ts +++ b/src/api/types/BusinessBookingProfile.ts @@ -2,34 +2,34 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + seller_id?: string | null; /** The RFC 3339 timestamp specifying the booking's creation time. */ - createdAt?: string; + created_at?: string; /** Indicates whether the seller is open for booking. */ - bookingEnabled?: boolean | null; + booking_enabled?: 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; + customer_timezone_choice?: 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; + booking_policy?: Square.BusinessBookingProfileBookingPolicy; /** Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`). */ - allowUserCancel?: boolean | null; + allow_user_cancel?: boolean | null; /** Settings for appointment-type bookings. */ - businessAppointmentSettings?: Square.BusinessAppointmentSettings; + business_appointment_settings?: 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; + support_seller_level_writes?: boolean | null; } diff --git a/src/api/types/BusinessHours.ts b/src/api/types/BusinessHours.ts index 5f2d1a5a5..d65294374 100644 --- a/src/api/types/BusinessHours.ts +++ b/src/api/types/BusinessHours.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The hours of operation for a location. diff --git a/src/api/types/BusinessHoursPeriod.ts b/src/api/types/BusinessHoursPeriod.ts index 3391a95d4..6a94ce5f4 100644 --- a/src/api/types/BusinessHoursPeriod.ts +++ b/src/api/types/BusinessHoursPeriod.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a period of time during which a business location is open. @@ -12,17 +12,17 @@ export interface BusinessHoursPeriod { * The day of the week for this time period. * See [DayOfWeek](#type-dayofweek) for possible values */ - dayOfWeek?: Square.DayOfWeek; + day_of_week?: 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; + start_local_time?: 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; + end_local_time?: string | null; } diff --git a/src/api/types/BuyNowPayLaterDetails.ts b/src/api/types/BuyNowPayLaterDetails.ts index 74b151f09..3e12959ff 100644 --- a/src/api/types/BuyNowPayLaterDetails.ts +++ b/src/api/types/BuyNowPayLaterDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Additional details about a Buy Now Pay Later payment type. @@ -17,10 +17,10 @@ export interface BuyNowPayLaterDetails { * Details about an Afterpay payment. These details are only populated if the `brand` is * `AFTERPAY`. */ - afterpayDetails?: Square.AfterpayDetails; + afterpay_details?: Square.AfterpayDetails; /** * Details about a Clearpay payment. These details are only populated if the `brand` is * `CLEARPAY`. */ - clearpayDetails?: Square.ClearpayDetails; + clearpay_details?: Square.ClearpayDetails; } diff --git a/src/api/types/CalculateLoyaltyPointsResponse.ts b/src/api/types/CalculateLoyaltyPointsResponse.ts index e970b5d91..161ed93bb 100644 --- a/src/api/types/CalculateLoyaltyPointsResponse.ts +++ b/src/api/types/CalculateLoyaltyPointsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) response. @@ -17,5 +17,5 @@ export interface CalculateLoyaltyPointsResponse { * 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; + promotion_points?: number; } diff --git a/src/api/types/CalculateOrderResponse.ts b/src/api/types/CalculateOrderResponse.ts index 055766021..5e15d7437 100644 --- a/src/api/types/CalculateOrderResponse.ts +++ b/src/api/types/CalculateOrderResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CalculateOrderResponse { /** The calculated version of the order provided in the request. */ diff --git a/src/api/types/CancelBookingResponse.ts b/src/api/types/CancelBookingResponse.ts index ccfb89b2c..fd76a0d3a 100644 --- a/src/api/types/CancelBookingResponse.ts +++ b/src/api/types/CancelBookingResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CancelBookingResponse { /** The booking that was cancelled. */ diff --git a/src/api/types/CancelInvoiceResponse.ts b/src/api/types/CancelInvoiceResponse.ts index 47bc03cca..4ba9a3922 100644 --- a/src/api/types/CancelInvoiceResponse.ts +++ b/src/api/types/CancelInvoiceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response returned by the `CancelInvoice` request. diff --git a/src/api/types/CancelLoyaltyPromotionResponse.ts b/src/api/types/CancelLoyaltyPromotionResponse.ts index 720b5817c..670c9762d 100644 --- a/src/api/types/CancelLoyaltyPromotionResponse.ts +++ b/src/api/types/CancelLoyaltyPromotionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CancelLoyaltyPromotion](api-endpoint:Loyalty-CancelLoyaltyPromotion) response. @@ -12,5 +12,5 @@ export interface CancelLoyaltyPromotionResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The canceled loyalty promotion. */ - loyaltyPromotion?: Square.LoyaltyPromotion; + loyalty_promotion?: Square.LoyaltyPromotion; } diff --git a/src/api/types/CancelPaymentByIdempotencyKeyResponse.ts b/src/api/types/CancelPaymentByIdempotencyKeyResponse.ts index 8df4ee330..664b4bd99 100644 --- a/src/api/types/CancelPaymentByIdempotencyKeyResponse.ts +++ b/src/api/types/CancelPaymentByIdempotencyKeyResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by diff --git a/src/api/types/CancelPaymentResponse.ts b/src/api/types/CancelPaymentResponse.ts index de09f1426..4005eec0a 100644 --- a/src/api/types/CancelPaymentResponse.ts +++ b/src/api/types/CancelPaymentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by [CancelPayment](api-endpoint:Payments-CancelPayment). diff --git a/src/api/types/CancelSubscriptionResponse.ts b/src/api/types/CancelSubscriptionResponse.ts index 96950aacf..3e2ec118d 100644 --- a/src/api/types/CancelSubscriptionResponse.ts +++ b/src/api/types/CancelSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the diff --git a/src/api/types/CancelTerminalActionResponse.ts b/src/api/types/CancelTerminalActionResponse.ts index 1bae43a82..173b853c1 100644 --- a/src/api/types/CancelTerminalActionResponse.ts +++ b/src/api/types/CancelTerminalActionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CancelTerminalActionResponse { /** Information on errors encountered during the request. */ diff --git a/src/api/types/CancelTerminalCheckoutResponse.ts b/src/api/types/CancelTerminalCheckoutResponse.ts index 280f22b90..d92c5a6c8 100644 --- a/src/api/types/CancelTerminalCheckoutResponse.ts +++ b/src/api/types/CancelTerminalCheckoutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CancelTerminalCheckoutResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/CancelTerminalRefundResponse.ts b/src/api/types/CancelTerminalRefundResponse.ts index 5929fc431..2d6573e57 100644 --- a/src/api/types/CancelTerminalRefundResponse.ts +++ b/src/api/types/CancelTerminalRefundResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CancelTerminalRefundResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/CaptureTransactionResponse.ts b/src/api/types/CaptureTransactionResponse.ts index 32224c29a..30e1e0f92 100644 --- a/src/api/types/CaptureTransactionResponse.ts +++ b/src/api/types/CaptureTransactionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/Card.ts b/src/api/types/Card.ts index 4be90d322..63ae38532 100644 --- a/src/api/types/Card.ts +++ b/src/api/types/Card.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the payment details of a card to be used for payments. These @@ -15,21 +15,21 @@ export interface Card { * The card's brand. * See [CardBrand](#type-cardbrand) for possible values */ - cardBrand?: Square.CardBrand; + card_brand?: Square.CardBrand; /** The last 4 digits of the card number. */ - last4?: string; + last_4?: string; /** The expiration month of the associated card as an integer between 1 and 12. */ - expMonth?: bigint | null; + exp_month?: (number | bigint) | null; /** The four-digit year of the card's expiration date. */ - expYear?: bigint | null; + exp_year?: (number | bigint) | null; /** The name of the cardholder. */ - cardholderName?: string | null; + cardholder_name?: string | null; /** * The billing address for this card. `US` postal codes can be provided as a 5-digit zip code * or 9-digit ZIP+4 (example: `12345-6789`). For a full list of field meanings by country, see * [Working with Addresses](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-addresses). */ - billingAddress?: Square.Address; + billing_address?: Square.Address; /** * Intended as a Square-assigned identifier, based * on the card number, to identify the card across multiple locations within a @@ -37,15 +37,15 @@ export interface Card { */ fingerprint?: string; /** **Required** The ID of a [customer](entity:Customer) to be associated with the card. */ - customerId?: string | null; + customer_id?: string | null; /** The ID of the merchant associated with the card. */ - merchantId?: string; + merchant_id?: 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; + reference_id?: string | null; /** Indicates whether or not a card can be used for payments. */ enabled?: boolean; /** @@ -53,12 +53,12 @@ export interface Card { * The Card object includes this field only in response to Payments API calls. * See [CardType](#type-cardtype) for possible values */ - cardType?: Square.CardType; + card_type?: Square.CardType; /** * Indicates whether the card is prepaid or not. * See [CardPrepaidType](#type-cardprepaidtype) for possible values */ - prepaidType?: Square.CardPrepaidType; + prepaid_type?: Square.CardPrepaidType; /** * The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API * returns this field. @@ -69,13 +69,13 @@ export interface Card { * existing Card object will be rejected unless the version in the request matches the current * version for the Card. */ - version?: bigint; + version?: number | 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; + card_co_brand?: Square.CardCoBrand; /** * An alert from the issuing bank about the card status. Alerts can indicate whether * future charges to the card are likely to fail. For more information, see @@ -84,17 +84,17 @@ export interface Card { * This field is present only if there's an active issuer alert. * See [IssuerAlert](#type-issueralert) for possible values */ - issuerAlert?: Square.CardIssuerAlert; + issuer_alert?: Square.CardIssuerAlert; /** * The timestamp of when the current issuer alert was received and processed, in * RFC 3339 format. * * This field is present only if there's an active issuer alert. */ - issuerAlertAt?: string; + issuer_alert_at?: string; /** * Indicates whether the card is linked to a Health Savings Account (HSA) or Flexible * Spending Account (FSA), based on the card BIN. */ - hsaFsa?: boolean; + hsa_fsa?: boolean; } diff --git a/src/api/types/CardAutomaticallyUpdatedEvent.ts b/src/api/types/CardAutomaticallyUpdatedEvent.ts index 552768192..55ea4a53e 100644 --- a/src/api/types/CardAutomaticallyUpdatedEvent.ts +++ b/src/api/types/CardAutomaticallyUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when Square automatically updates the expiration date or @@ -10,13 +10,13 @@ import * as Square from "../index"; */ export interface CardAutomaticallyUpdatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"card.automatically_updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CardAutomaticallyUpdatedEventData; } diff --git a/src/api/types/CardAutomaticallyUpdatedEventData.ts b/src/api/types/CardAutomaticallyUpdatedEventData.ts index 73ff03d7a..777d391c5 100644 --- a/src/api/types/CardAutomaticallyUpdatedEventData.ts +++ b/src/api/types/CardAutomaticallyUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardAutomaticallyUpdatedEventData { /** The type of the event data object. The value is `"card"`. */ diff --git a/src/api/types/CardAutomaticallyUpdatedEventObject.ts b/src/api/types/CardAutomaticallyUpdatedEventObject.ts index 7c5569acd..24ba07c3c 100644 --- a/src/api/types/CardAutomaticallyUpdatedEventObject.ts +++ b/src/api/types/CardAutomaticallyUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardAutomaticallyUpdatedEventObject { /** The automatically updated card. */ diff --git a/src/api/types/CardCreatedEvent.ts b/src/api/types/CardCreatedEvent.ts index 810bc27f7..03b304732 100644 --- a/src/api/types/CardCreatedEvent.ts +++ b/src/api/types/CardCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [card](entity:Card) is created or imported. */ export interface CardCreatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"card.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CardCreatedEventData; } diff --git a/src/api/types/CardCreatedEventData.ts b/src/api/types/CardCreatedEventData.ts index 054e9e4bb..25af6c6c9 100644 --- a/src/api/types/CardCreatedEventData.ts +++ b/src/api/types/CardCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardCreatedEventData { /** The type of the event data object. The value is `"card"`. */ diff --git a/src/api/types/CardCreatedEventObject.ts b/src/api/types/CardCreatedEventObject.ts index 2dafa7445..5bcf3c482 100644 --- a/src/api/types/CardCreatedEventObject.ts +++ b/src/api/types/CardCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardCreatedEventObject { /** The created card. */ diff --git a/src/api/types/CardDisabledEvent.ts b/src/api/types/CardDisabledEvent.ts index 2ecede520..d69761d8d 100644 --- a/src/api/types/CardDisabledEvent.ts +++ b/src/api/types/CardDisabledEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [card](entity:Card) is disabled. */ export interface CardDisabledEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"card.disabled"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CardDisabledEventData; } diff --git a/src/api/types/CardDisabledEventData.ts b/src/api/types/CardDisabledEventData.ts index 24cbc2d0b..17fc9e7c8 100644 --- a/src/api/types/CardDisabledEventData.ts +++ b/src/api/types/CardDisabledEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardDisabledEventData { /** The type of the event data object. The value is `"card"`. */ diff --git a/src/api/types/CardDisabledEventObject.ts b/src/api/types/CardDisabledEventObject.ts index f5f765ed1..9f36e7efb 100644 --- a/src/api/types/CardDisabledEventObject.ts +++ b/src/api/types/CardDisabledEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardDisabledEventObject { /** The disabled card. */ diff --git a/src/api/types/CardForgottenEvent.ts b/src/api/types/CardForgottenEvent.ts index fff5cdcc0..6c563b609 100644 --- a/src/api/types/CardForgottenEvent.ts +++ b/src/api/types/CardForgottenEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [card](entity:Card) is GDPR forgotten or vaulted. */ export interface CardForgottenEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"card.forgotten"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CardForgottenEventData; } diff --git a/src/api/types/CardForgottenEventCard.ts b/src/api/types/CardForgottenEventCard.ts index af07de106..c79ca8c9f 100644 --- a/src/api/types/CardForgottenEventCard.ts +++ b/src/api/types/CardForgottenEventCard.ts @@ -6,7 +6,7 @@ export interface CardForgottenEventCard { /** Unique ID for this card. Generated by Square. */ id?: string; /** The ID of a customer created using the Customers API associated with the card. */ - customerId?: string | null; + customer_id?: string | null; /** Indicates whether or not a card can be used for payments. */ enabled?: boolean | null; /** @@ -14,13 +14,13 @@ export interface CardForgottenEventCard { * another entity in an external system. For example, a customer ID from an * external customer management system. */ - referenceId?: string | null; + reference_id?: string | null; /** * 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; + version?: number | bigint; /** The ID of the merchant associated with the card. */ - merchantId?: string | null; + merchant_id?: string | null; } diff --git a/src/api/types/CardForgottenEventData.ts b/src/api/types/CardForgottenEventData.ts index b6dcb0633..909d706fd 100644 --- a/src/api/types/CardForgottenEventData.ts +++ b/src/api/types/CardForgottenEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardForgottenEventData { /** The type of the event data object. The value is `"card"`. */ diff --git a/src/api/types/CardForgottenEventObject.ts b/src/api/types/CardForgottenEventObject.ts index 0c49c64d6..72bba14ef 100644 --- a/src/api/types/CardForgottenEventObject.ts +++ b/src/api/types/CardForgottenEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardForgottenEventObject { /** The forgotten card. */ diff --git a/src/api/types/CardPaymentDetails.ts b/src/api/types/CardPaymentDetails.ts index f0bdb9504..c75215241 100644 --- a/src/api/types/CardPaymentDetails.ts +++ b/src/api/types/CardPaymentDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Reflects the current status of a card payment. Contains only non-confidential information. @@ -19,58 +19,58 @@ export interface CardPaymentDetails { * 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; + entry_method?: 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; + cvv_status?: 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; + avs_status?: string | null; /** * The status code returned by the card issuer that describes the payment's * authorization status. */ - authResultCode?: string | null; + auth_result_code?: string | null; /** For EMV payments, the application ID identifies the EMV application used for the payment. */ - applicationIdentifier?: string | null; + application_identifier?: string | null; /** For EMV payments, the human-readable name of the EMV application used for the payment. */ - applicationName?: string | null; + application_name?: string | null; /** For EMV payments, the cryptogram generated for the payment. */ - applicationCryptogram?: string | null; + application_cryptogram?: 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; + verification_method?: string | null; /** * For EMV payments, the results of the cardholder verification. The result can be * `SUCCESS`, `FAILURE`, or `UNKNOWN`. */ - verificationResults?: string | null; + verification_results?: 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; + statement_description?: string | null; /** * __Deprecated__: Use `Payment.device_details` instead. * * Details about the device that took the payment. */ - deviceDetails?: Square.DeviceDetails; + device_details?: Square.DeviceDetails; /** The timeline for card payments. */ - cardPaymentTimeline?: Square.CardPaymentTimeline; + card_payment_timeline?: 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; + refund_requires_card_presence?: 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 index ceb53d0e4..40f7b3daf 100644 --- a/src/api/types/CardPaymentTimeline.ts +++ b/src/api/types/CardPaymentTimeline.ts @@ -7,9 +7,9 @@ */ export interface CardPaymentTimeline { /** The timestamp when the payment was authorized, in RFC 3339 format. */ - authorizedAt?: string | null; + authorized_at?: string | null; /** The timestamp when the payment was captured, in RFC 3339 format. */ - capturedAt?: string | null; + captured_at?: string | null; /** The timestamp when the payment was voided, in RFC 3339 format. */ - voidedAt?: string | null; + voided_at?: string | null; } diff --git a/src/api/types/CardUpdatedEvent.ts b/src/api/types/CardUpdatedEvent.ts index 2ac6ab047..7034a1fb7 100644 --- a/src/api/types/CardUpdatedEvent.ts +++ b/src/api/types/CardUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [card](entity:Card) is updated by the seller in the Square Dashboard. */ export interface CardUpdatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"card.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CardUpdatedEventData; } diff --git a/src/api/types/CardUpdatedEventData.ts b/src/api/types/CardUpdatedEventData.ts index 1185c80fe..cb4bbcee2 100644 --- a/src/api/types/CardUpdatedEventData.ts +++ b/src/api/types/CardUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardUpdatedEventData { /** The type of the event data object. The value is `"card"`. */ diff --git a/src/api/types/CardUpdatedEventObject.ts b/src/api/types/CardUpdatedEventObject.ts index 8bf011a65..ce3b36d6e 100644 --- a/src/api/types/CardUpdatedEventObject.ts +++ b/src/api/types/CardUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CardUpdatedEventObject { /** The updated card. */ diff --git a/src/api/types/CashAppDetails.ts b/src/api/types/CashAppDetails.ts index b1b2528b8..c0254d10f 100644 --- a/src/api/types/CashAppDetails.ts +++ b/src/api/types/CashAppDetails.ts @@ -7,13 +7,13 @@ */ export interface CashAppDetails { /** The name of the Cash App account holder. */ - buyerFullName?: string | null; + buyer_full_name?: 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; + buyer_country_code?: string | null; /** $Cashtag of the Cash App account holder. */ - buyerCashtag?: string; + buyer_cashtag?: string; } diff --git a/src/api/types/CashDrawerShift.ts b/src/api/types/CashDrawerShift.ts index 5d8254395..192e5e3f4 100644 --- a/src/api/types/CashDrawerShift.ts +++ b/src/api/types/CashDrawerShift.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * This model gives the details of a cash drawer shift. @@ -19,43 +19,43 @@ export interface CashDrawerShift { */ state?: Square.CashDrawerShiftState; /** The time when the shift began, in ISO 8601 format. */ - openedAt?: string | null; + opened_at?: string | null; /** The time when the shift ended, in ISO 8601 format. */ - endedAt?: string | null; + ended_at?: string | null; /** The time when the shift was closed, in ISO 8601 format. */ - closedAt?: string | null; + closed_at?: 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; + opened_cash_money?: 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; + cash_payment_money?: 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; + cash_refunds_money?: 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; + cash_paid_in_money?: 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; + cash_paid_out_money?: 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. @@ -65,32 +65,32 @@ export interface CashDrawerShift { * 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; + expected_cash_money?: 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; + closed_cash_money?: 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; + created_at?: string; /** The shift updated at time in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The ID of the location the cash drawer shift belongs to. */ - locationId?: string; + location_id?: 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[]; + team_member_ids?: string[]; /** The ID of the team member that started the cash drawer shift. */ - openingTeamMemberId?: string; + opening_team_member_id?: string; /** The ID of the team member that ended the cash drawer shift. */ - endingTeamMemberId?: string; + ending_team_member_id?: string; /** * The ID of the team member that closed the cash drawer shift by auditing * the cash drawer contents. */ - closingTeamMemberId?: string; + closing_team_member_id?: string; } diff --git a/src/api/types/CashDrawerShiftEvent.ts b/src/api/types/CashDrawerShiftEvent.ts index ed6a3bf76..334c326aa 100644 --- a/src/api/types/CashDrawerShiftEvent.ts +++ b/src/api/types/CashDrawerShiftEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CashDrawerShiftEvent { /** The unique ID of the event. */ @@ -11,21 +11,21 @@ export interface CashDrawerShiftEvent { * The type of cash drawer shift event. * See [CashDrawerEventType](#type-cashdrawereventtype) for possible values */ - eventType?: Square.CashDrawerEventType; + event_type?: 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; + event_money?: Square.Money; /** The event time in RFC 3339 format. */ - createdAt?: string; + created_at?: 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; + team_member_id?: string; } diff --git a/src/api/types/CashDrawerShiftSummary.ts b/src/api/types/CashDrawerShiftSummary.ts index b4053996b..473b13119 100644 --- a/src/api/types/CashDrawerShiftSummary.ts +++ b/src/api/types/CashDrawerShiftSummary.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The summary of a closed cash drawer shift. @@ -19,18 +19,18 @@ export interface CashDrawerShiftSummary { */ state?: Square.CashDrawerShiftState; /** The shift start time in ISO 8601 format. */ - openedAt?: string | null; + opened_at?: string | null; /** The shift end time in ISO 8601 format. */ - endedAt?: string | null; + ended_at?: string | null; /** The shift close time in ISO 8601 format. */ - closedAt?: string | null; + closed_at?: 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; + opened_cash_money?: 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. @@ -38,16 +38,16 @@ export interface CashDrawerShiftSummary { * 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; + expected_cash_money?: 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; + closed_cash_money?: Square.Money; /** The shift start time in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The shift updated at time in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The ID of the location the cash drawer shift belongs to. */ - locationId?: string; + location_id?: string; } diff --git a/src/api/types/CashPaymentDetails.ts b/src/api/types/CashPaymentDetails.ts index baa0bfe5a..2db1825b9 100644 --- a/src/api/types/CashPaymentDetails.ts +++ b/src/api/types/CashPaymentDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Stores details about a cash payment. Contains only non-confidential information. For more information, see @@ -10,11 +10,11 @@ import * as Square from "../index"; */ export interface CashPaymentDetails { /** The amount and currency of the money supplied by the buyer. */ - buyerSuppliedMoney: Square.Money; + buyer_supplied_money: 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; + change_back_money?: Square.Money; } diff --git a/src/api/types/CatalogAvailabilityPeriod.ts b/src/api/types/CatalogAvailabilityPeriod.ts index 5400f1e59..945e62e71 100644 --- a/src/api/types/CatalogAvailabilityPeriod.ts +++ b/src/api/types/CatalogAvailabilityPeriod.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a time period of availability. @@ -13,16 +13,16 @@ export interface CatalogAvailabilityPeriod { * 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; + start_local_time?: 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; + end_local_time?: string | null; /** * The day of the week for this availability period. * See [DayOfWeek](#type-dayofweek) for possible values */ - dayOfWeek?: Square.DayOfWeek; + day_of_week?: Square.DayOfWeek; } diff --git a/src/api/types/CatalogCategory.ts b/src/api/types/CatalogCategory.ts index 0abeda8e8..c782e5e9e 100644 --- a/src/api/types/CatalogCategory.ts +++ b/src/api/types/CatalogCategory.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A category to which a `CatalogItem` instance belongs. @@ -14,29 +14,29 @@ export interface CatalogCategory { * 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; + image_ids?: string[] | null; /** * The type of the category. * See [CatalogCategoryType](#type-catalogcategorytype) for possible values */ - categoryType?: Square.CatalogCategoryType; + category_type?: Square.CatalogCategoryType; /** The ID of the parent category of this category instance. */ - parentCategory?: Square.CatalogObjectCategory; + parent_category?: Square.CatalogObjectCategory; /** Indicates whether a category is a top level category, which does not have any parent_category. */ - isTopLevel?: boolean | null; + is_top_level?: 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; + availability_period_ids?: string[] | null; /** Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites. */ - onlineVisibility?: boolean | null; + online_visibility?: boolean | null; /** The top-level category in a category hierarchy. */ - rootCategory?: string; + root_category?: string; /** The SEO data for a seller's Square Online store. */ - ecomSeoData?: Square.CatalogEcomSeoData; + ecom_seo_data?: 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; + path_to_root?: Square.CategoryPathToRootNode[] | null; } diff --git a/src/api/types/CatalogCustomAttributeDefinition.ts b/src/api/types/CatalogCustomAttributeDefinition.ts index 550c1c5ae..42250d0de 100644 --- a/src/api/types/CatalogCustomAttributeDefinition.ts +++ b/src/api/types/CatalogCustomAttributeDefinition.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains information defining a custom attribute. Custom attributes are @@ -33,38 +33,38 @@ export interface CatalogCustomAttributeDefinition { * __Read only.__ Contains information about the application that * created this custom attribute definition. */ - sourceApplication?: Square.SourceApplication; + source_application?: 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[]; + allowed_object_types: 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; + seller_visibility?: 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; + app_visibility?: Square.CatalogCustomAttributeDefinitionAppVisibility; /** Optionally, populated when `type` = `STRING`, unset otherwise. */ - stringConfig?: Square.CatalogCustomAttributeDefinitionStringConfig; + string_config?: Square.CatalogCustomAttributeDefinitionStringConfig; /** Optionally, populated when `type` = `NUMBER`, unset otherwise. */ - numberConfig?: Square.CatalogCustomAttributeDefinitionNumberConfig; + number_config?: Square.CatalogCustomAttributeDefinitionNumberConfig; /** Populated when `type` is set to `SELECTION`, unset otherwise. */ - selectionConfig?: Square.CatalogCustomAttributeDefinitionSelectionConfig; + selection_config?: 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; + custom_attribute_usage_count?: 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 diff --git a/src/api/types/CatalogCustomAttributeDefinitionSelectionConfig.ts b/src/api/types/CatalogCustomAttributeDefinitionSelectionConfig.ts index 46e7f6cba..95845798e 100644 --- a/src/api/types/CatalogCustomAttributeDefinitionSelectionConfig.ts +++ b/src/api/types/CatalogCustomAttributeDefinitionSelectionConfig.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Configuration associated with `SELECTION`-type custom attribute definitions. @@ -14,10 +14,10 @@ export interface CatalogCustomAttributeDefinitionSelectionConfig { * 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; + max_allowed_selections?: number | null; /** * The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100 * selections can be defined. Can be modified. */ - allowedSelections?: Square.CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[] | null; + allowed_selections?: Square.CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[] | null; } diff --git a/src/api/types/CatalogCustomAttributeDefinitionStringConfig.ts b/src/api/types/CatalogCustomAttributeDefinitionStringConfig.ts index ece421219..9967e383a 100644 --- a/src/api/types/CatalogCustomAttributeDefinitionStringConfig.ts +++ b/src/api/types/CatalogCustomAttributeDefinitionStringConfig.ts @@ -13,5 +13,5 @@ export interface CatalogCustomAttributeDefinitionStringConfig { * duplicated within a seller's catalog. May not be modified after the * definition has been created. */ - enforceUniqueness?: boolean | null; + enforce_uniqueness?: boolean | null; } diff --git a/src/api/types/CatalogCustomAttributeValue.ts b/src/api/types/CatalogCustomAttributeValue.ts index 17709bb8a..41888891b 100644 --- a/src/api/types/CatalogCustomAttributeValue.ts +++ b/src/api/types/CatalogCustomAttributeValue.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An instance of a custom attribute. Custom attributes can be defined and @@ -13,9 +13,9 @@ 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; + string_value?: string | null; /** The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to. */ - customAttributeDefinitionId?: string; + custom_attribute_definition_id?: string; /** * A copy of type from the associated `CatalogCustomAttributeDefinition`. * See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values @@ -25,11 +25,11 @@ export interface CatalogCustomAttributeValue { * Populated if `type` = `NUMBER`. Contains a string * representation of a decimal number, using a `.` as the decimal separator. */ - numberValue?: string | null; + number_value?: string | null; /** A `true` or `false` value. Populated if `type` = `BOOLEAN`. */ - booleanValue?: boolean | null; + boolean_value?: boolean | null; /** One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`. */ - selectionUidValues?: string[] | null; + selection_uid_values?: 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" diff --git a/src/api/types/CatalogDiscount.ts b/src/api/types/CatalogDiscount.ts index d152f7f98..52bca764a 100644 --- a/src/api/types/CatalogDiscount.ts +++ b/src/api/types/CatalogDiscount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A discount applicable to items. @@ -14,7 +14,7 @@ export interface CatalogDiscount { * 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; + discount_type?: 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` @@ -28,14 +28,14 @@ export interface CatalogDiscount { * * Do not use this field for percentage-based or variable discounts. */ - amountMoney?: Square.Money; + amount_money?: 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; + pin_required?: 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; + label_color?: string | null; /** * Indicates whether this discount should reduce the price used to calculate tax. * @@ -49,11 +49,11 @@ export interface CatalogDiscount { * 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; + modify_tax_basis?: 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; + maximum_amount_money?: Square.Money; } diff --git a/src/api/types/CatalogEcomSeoData.ts b/src/api/types/CatalogEcomSeoData.ts index a5191e257..7b9e92ac7 100644 --- a/src/api/types/CatalogEcomSeoData.ts +++ b/src/api/types/CatalogEcomSeoData.ts @@ -7,9 +7,9 @@ */ export interface CatalogEcomSeoData { /** The SEO title used for the Square Online store. */ - pageTitle?: string | null; + page_title?: string | null; /** The SEO description used for the Square Online store. */ - pageDescription?: string | null; + page_description?: 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 index 6a64c6733..e96dbef54 100644 --- a/src/api/types/CatalogIdMapping.ts +++ b/src/api/types/CatalogIdMapping.ts @@ -17,7 +17,7 @@ */ export interface CatalogIdMapping { /** The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`. */ - clientObjectId?: string | null; + client_object_id?: string | null; /** The permanent ID for the CatalogObject created by the server. */ - objectId?: string | null; + object_id?: string | null; } diff --git a/src/api/types/CatalogImage.ts b/src/api/types/CatalogImage.ts index 702f7a63f..132beac0e 100644 --- a/src/api/types/CatalogImage.ts +++ b/src/api/types/CatalogImage.ts @@ -31,5 +31,5 @@ export interface CatalogImage { */ caption?: string | null; /** The immutable order ID for this image object created by the Photo Studio service in Square Online Store. */ - photoStudioOrderId?: string | null; + photo_studio_order_id?: string | null; } diff --git a/src/api/types/CatalogInfoResponse.ts b/src/api/types/CatalogInfoResponse.ts index 74498a909..02f5b5fab 100644 --- a/src/api/types/CatalogInfoResponse.ts +++ b/src/api/types/CatalogInfoResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogInfoResponse { /** Any errors that occurred during the request. */ @@ -10,5 +10,5 @@ export interface CatalogInfoResponse { /** Limits that apply to this API. */ limits?: Square.CatalogInfoResponseLimits; /** Names and abbreviations for standard units. */ - standardUnitDescriptionGroup?: Square.StandardUnitDescriptionGroup; + standard_unit_description_group?: Square.StandardUnitDescriptionGroup; } diff --git a/src/api/types/CatalogInfoResponseLimits.ts b/src/api/types/CatalogInfoResponseLimits.ts index 882ba531e..598a21aad 100644 --- a/src/api/types/CatalogInfoResponseLimits.ts +++ b/src/api/types/CatalogInfoResponseLimits.ts @@ -7,55 +7,55 @@ 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; + batch_upsert_max_objects_per_batch?: number | null; /** * The maximum number of objects that may appear across all batches in a * `/v2/catalog/batch-upsert` request. */ - batchUpsertMaxTotalObjects?: number | null; + batch_upsert_max_total_objects?: number | null; /** * The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve` * request. */ - batchRetrieveMaxObjectIds?: number | null; + batch_retrieve_max_object_ids?: number | null; /** * The maximum number of results that may be returned in a page of a * `/v2/catalog/search` response. */ - searchMaxPageLimit?: number | null; + search_max_page_limit?: number | null; /** * The maximum number of object IDs that may be included in a single * `/v2/catalog/batch-delete` request. */ - batchDeleteMaxObjectIds?: number | null; + batch_delete_max_object_ids?: number | null; /** * The maximum number of item IDs that may be included in a single * `/v2/catalog/update-item-taxes` request. */ - updateItemTaxesMaxItemIds?: number | null; + update_item_taxes_max_item_ids?: 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; + update_item_taxes_max_taxes_to_enable?: 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; + update_item_taxes_max_taxes_to_disable?: 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; + update_item_modifier_lists_max_item_ids?: 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; + update_item_modifier_lists_max_modifier_lists_to_enable?: 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; + update_item_modifier_lists_max_modifier_lists_to_disable?: number | null; } diff --git a/src/api/types/CatalogItem.ts b/src/api/types/CatalogItem.ts index 3a60ac7e0..831e63e1e 100644 --- a/src/api/types/CatalogItem.ts +++ b/src/api/types/CatalogItem.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A [CatalogObject](entity:CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. @@ -26,24 +26,24 @@ export interface CatalogItem { */ 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; + label_color?: string | null; /** Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`. */ - isTaxable?: boolean | null; + is_taxable?: boolean | null; /** The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. */ - categoryId?: string | null; + category_id?: 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; + tax_ids?: 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; + modifier_list_info?: Square.CatalogItemModifierListInfo[] | null; /** * A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have * at least one variation. @@ -56,7 +56,7 @@ export interface CatalogItem { * but cannot be created using the API. * See [CatalogItemProductType](#type-catalogitemproducttype) for possible values */ - productType?: Square.CatalogItemProductType; + product_type?: 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 @@ -67,31 +67,31 @@ export interface CatalogItem { * * Third-party clients are encouraged to implement similar behaviors. */ - skipModifierScreen?: boolean | null; + skip_modifier_screen?: 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; + item_options?: Square.CatalogItemOptionForItem[] | null; /** Deprecated. A URI pointing to a published e-commerce product page for the Item. */ - ecomUri?: string | null; + ecom_uri?: string | null; /** Deprecated. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item. */ - ecomImageUris?: string[] | null; + ecom_image_uris?: string[] | 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; + image_ids?: 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; + sort_name?: string | null; /** The list of categories. */ categories?: Square.CatalogObjectCategory[] | null; /** @@ -120,22 +120,22 @@ export interface CatalogItem { * - `rel`: Relationship between link's target and source * - `target`: Place to open the linked document */ - descriptionHtml?: string | null; + description_html?: string | null; /** A server-generated plaintext version of the `description_html` field, without formatting tags. */ - descriptionPlaintext?: string; + description_plaintext?: 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; + is_archived?: boolean | null; /** The SEO data for a seller's Square Online store. */ - ecomSeoData?: Square.CatalogEcomSeoData; + ecom_seo_data?: Square.CatalogEcomSeoData; /** The food and beverage-specific details for the `FOOD_AND_BEV` item. */ - foodAndBeverageDetails?: Square.CatalogItemFoodAndBeverageDetails; + food_and_beverage_details?: Square.CatalogItemFoodAndBeverageDetails; /** The item's reporting category. */ - reportingCategory?: Square.CatalogObjectCategory; + reporting_category?: Square.CatalogObjectCategory; /** Indicates whether this item is alcoholic (`true`) or not (`false`). */ - isAlcoholic?: boolean | null; + is_alcoholic?: boolean | null; } diff --git a/src/api/types/CatalogItemFoodAndBeverageDetails.ts b/src/api/types/CatalogItemFoodAndBeverageDetails.ts index eace1998d..c889af4b4 100644 --- a/src/api/types/CatalogItemFoodAndBeverageDetails.ts +++ b/src/api/types/CatalogItemFoodAndBeverageDetails.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + calorie_count?: number | null; /** The dietary preferences for the `FOOD_AND_BEV` item. */ - dietaryPreferences?: Square.CatalogItemFoodAndBeverageDetailsDietaryPreference[] | null; + dietary_preferences?: 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 index 9b5123a8b..d9b58dc40 100644 --- a/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts +++ b/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. @@ -17,7 +17,7 @@ export interface CatalogItemFoodAndBeverageDetailsDietaryPreference { * 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; + standard_name?: 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; + custom_name?: string | null; } diff --git a/src/api/types/CatalogItemFoodAndBeverageDetailsIngredient.ts b/src/api/types/CatalogItemFoodAndBeverageDetailsIngredient.ts index 95e34bd26..618bd33c2 100644 --- a/src/api/types/CatalogItemFoodAndBeverageDetailsIngredient.ts +++ b/src/api/types/CatalogItemFoodAndBeverageDetailsIngredient.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes the ingredient used in a `FOOD_AND_BEV` item. @@ -17,7 +17,7 @@ export interface CatalogItemFoodAndBeverageDetailsIngredient { * 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; + standard_name?: Square.CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient; /** The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference. */ - customName?: string | null; + custom_name?: string | null; } diff --git a/src/api/types/CatalogItemModifierListInfo.ts b/src/api/types/CatalogItemModifierListInfo.ts index de2ce69c0..1807e1fc1 100644 --- a/src/api/types/CatalogItemModifierListInfo.ts +++ b/src/api/types/CatalogItemModifierListInfo.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Controls how a modifier list is applied to a specific item. This object allows for item-specific customization of modifier list behavior @@ -10,9 +10,9 @@ import * as Square from "../index"; */ export interface CatalogItemModifierListInfo { /** The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`. */ - modifierListId: string; + modifier_list_id: string; /** A set of `CatalogModifierOverride` objects that override default modifier settings for this item. */ - modifierOverrides?: Square.CatalogModifierOverride[] | null; + modifier_overrides?: Square.CatalogModifierOverride[] | null; /** * The minimum number of modifiers that must be selected from this modifier list. * Values: @@ -23,7 +23,7 @@ export interface CatalogItemModifierListInfo { * - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. * - < -1: Invalid. Treated as no selection required. */ - minSelectedModifiers?: number | null; + min_selected_modifiers?: number | null; /** * The maximum number of modifiers that can be selected. * Values: @@ -34,7 +34,7 @@ export interface CatalogItemModifierListInfo { * - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. * - < -1: Invalid. Treated as no maximum limit. */ - maxSelectedModifiers?: number | null; + max_selected_modifiers?: number | null; /** If `true`, enable this `CatalogModifierList`. The default value is `true`. */ enabled?: boolean | null; /** @@ -42,7 +42,7 @@ export interface CatalogItemModifierListInfo { * to a `CatalogItem` instance. */ ordinal?: number | null; - allowQuantities?: unknown; - isConversational?: unknown; - hiddenFromCustomerOverride?: unknown; + allow_quantities?: unknown; + is_conversational?: unknown; + hidden_from_customer_override?: unknown; } diff --git a/src/api/types/CatalogItemOption.ts b/src/api/types/CatalogItemOption.ts index fa15b7904..504e99c76 100644 --- a/src/api/types/CatalogItemOption.ts +++ b/src/api/types/CatalogItemOption.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A group of variations for a `CatalogItem`. @@ -14,7 +14,7 @@ export interface CatalogItemOption { */ 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; + display_name?: 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 @@ -22,7 +22,7 @@ export interface CatalogItemOption { */ description?: string | null; /** If true, display colors for entries in `values` when present. */ - showColors?: boolean | null; + show_colors?: boolean | null; /** * A list of CatalogObjects containing the * `CatalogItemOptionValue`s for this item. diff --git a/src/api/types/CatalogItemOptionForItem.ts b/src/api/types/CatalogItemOptionForItem.ts index 1dc6995d2..f916631a5 100644 --- a/src/api/types/CatalogItemOptionForItem.ts +++ b/src/api/types/CatalogItemOptionForItem.ts @@ -8,5 +8,5 @@ */ 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; + item_option_id?: string | null; } diff --git a/src/api/types/CatalogItemOptionValue.ts b/src/api/types/CatalogItemOptionValue.ts index 3be28f3f6..b814a9b6a 100644 --- a/src/api/types/CatalogItemOptionValue.ts +++ b/src/api/types/CatalogItemOptionValue.ts @@ -9,7 +9,7 @@ */ export interface CatalogItemOptionValue { /** Unique ID of the associated item option. */ - itemOptionId?: string | null; + item_option_id?: 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. */ diff --git a/src/api/types/CatalogItemOptionValueForItemVariation.ts b/src/api/types/CatalogItemOptionValueForItemVariation.ts index 5a23de8aa..ba42bc332 100644 --- a/src/api/types/CatalogItemOptionValueForItemVariation.ts +++ b/src/api/types/CatalogItemOptionValueForItemVariation.ts @@ -10,7 +10,7 @@ */ export interface CatalogItemOptionValueForItemVariation { /** The unique id of an item option. */ - itemOptionId?: string | null; + item_option_id?: string | null; /** The unique id of the selected value for the item option. */ - itemOptionValueId?: string | null; + item_option_value_id?: string | null; } diff --git a/src/api/types/CatalogItemVariation.ts b/src/api/types/CatalogItemVariation.ts index 59b92d315..fb7ffccf9 100644 --- a/src/api/types/CatalogItemVariation.ts +++ b/src/api/types/CatalogItemVariation.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An item variation, representing a product for sale, in the Catalog object model. Each [item](entity:CatalogItem) must have at least one @@ -18,7 +18,7 @@ import * as Square from "../index"; */ export interface CatalogItemVariation { /** The ID of the `CatalogItem` associated with this item variation. */ - itemId?: string | null; + item_id?: string | null; /** * The item variation's name. This is a searchable attribute for use in applicable query filters. * @@ -49,51 +49,51 @@ export interface CatalogItemVariation { * of sale. * See [CatalogPricingType](#type-catalogpricingtype) for possible values */ - pricingType?: Square.CatalogPricingType; + pricing_type?: Square.CatalogPricingType; /** The item variation's price, if fixed pricing is used. */ - priceMoney?: Square.Money; + price_money?: Square.Money; /** Per-location price and inventory overrides. */ - locationOverrides?: Square.ItemVariationLocationOverrides[] | null; + location_overrides?: Square.ItemVariationLocationOverrides[] | null; /** If `true`, inventory tracking is active for the variation. */ - trackInventory?: boolean | null; + track_inventory?: 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; + inventory_alert_type?: 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; + inventory_alert_threshold?: (number | bigint) | null; /** Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points. */ - userData?: string | null; + user_data?: 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; + service_duration?: (number | 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; + available_for_booking?: 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; + item_option_values?: 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; + measurement_unit_id?: 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, @@ -110,12 +110,12 @@ export interface CatalogItemVariation { * The IDs of images associated with this `CatalogItemVariation` instance. * These images will be shown to customers in Square Online Store. */ - imageIds?: string[] | null; + image_ids?: 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; + team_member_ids?: 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 @@ -123,5 +123,5 @@ export interface CatalogItemVariation { * you can accurately track inventory when an item variation is sold in one unit, but stocked in * another unit. */ - stockableConversion?: Square.CatalogStockConversion; + stockable_conversion?: Square.CatalogStockConversion; } diff --git a/src/api/types/CatalogMeasurementUnit.ts b/src/api/types/CatalogMeasurementUnit.ts index 9e37e5874..dd5140dae 100644 --- a/src/api/types/CatalogMeasurementUnit.ts +++ b/src/api/types/CatalogMeasurementUnit.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the unit used to measure a `CatalogItemVariation` and @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface CatalogMeasurementUnit { /** Indicates the unit used to measure the quantity of a catalog item variation. */ - measurementUnit?: Square.MeasurementUnit; + measurement_unit?: 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. diff --git a/src/api/types/CatalogModifier.ts b/src/api/types/CatalogModifier.ts index 240e396db..3f7bb2210 100644 --- a/src/api/types/CatalogModifier.ts +++ b/src/api/types/CatalogModifier.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A modifier that can be applied to items at the time of sale. For example, a cheese modifier for a burger, or a flavor modifier for a serving of ice cream. @@ -11,23 +11,23 @@ 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; + price_money?: Square.Money; /** * When `true`, this modifier is selected by default when displaying the modifier list. * This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`. */ - onByDefault?: boolean | null; + on_by_default?: boolean | null; /** Determines where this `CatalogModifier` appears in the `CatalogModifierList`. */ ordinal?: number | null; /** The ID of the `CatalogModifierList` associated with this modifier. */ - modifierListId?: string | null; + modifier_list_id?: string | null; /** Location-specific price overrides. */ - locationOverrides?: Square.ModifierLocationOverrides[] | null; + location_overrides?: 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; + image_id?: string | null; /** When `true`, this modifier is hidden from online ordering channels. This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`. */ - hiddenOnline?: boolean | null; + hidden_online?: boolean | null; } diff --git a/src/api/types/CatalogModifierList.ts b/src/api/types/CatalogModifierList.ts index 8c58b90e9..1fbcb6133 100644 --- a/src/api/types/CatalogModifierList.ts +++ b/src/api/types/CatalogModifierList.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A container for a list of modifiers, or a text-based modifier. @@ -24,7 +24,7 @@ export interface CatalogModifierList { * `min_selected_modifiers` and `max_selected_modifiers` instead. * See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values */ - selectionType?: Square.CatalogModifierListSelectionType; + selection_type?: 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 @@ -42,11 +42,11 @@ export interface CatalogModifierList { * 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; + image_ids?: string[] | null; /** When `true`, allows multiple quantities of the same modifier to be selected. */ - allowQuantities?: boolean | null; + allow_quantities?: boolean | null; /** True if modifiers belonging to this list can be used conversationally. */ - isConversational?: boolean | null; + is_conversational?: boolean | null; /** * The type of the modifier. * @@ -54,17 +54,17 @@ export interface CatalogModifierList { * 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; + modifier_type?: 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; + max_length?: 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; + text_required?: boolean | null; /** * A note for internal use by the business. * @@ -75,7 +75,7 @@ export interface CatalogModifierList { * 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; + internal_name?: string | null; /** * The minimum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`. * @@ -86,7 +86,7 @@ export interface CatalogModifierList { * - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. * - < -1: Invalid. Treated as no selection required. */ - minSelectedModifiers?: bigint | null; + min_selected_modifiers?: (number | bigint) | null; /** * The maximum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`. * @@ -97,10 +97,10 @@ export interface CatalogModifierList { * - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. * - < -1: Invalid. Treated as no maximum limit. */ - maxSelectedModifiers?: bigint | null; + max_selected_modifiers?: (number | bigint) | null; /** * If `true`, modifiers from this list are hidden from customer receipts. The default value is `false`. * This setting can be overridden with `CatalogItemModifierListInfo.hidden_from_customer_override`. */ - hiddenFromCustomer?: boolean | null; + hidden_from_customer?: boolean | null; } diff --git a/src/api/types/CatalogModifierOverride.ts b/src/api/types/CatalogModifierOverride.ts index ceefe9122..26db8e363 100644 --- a/src/api/types/CatalogModifierOverride.ts +++ b/src/api/types/CatalogModifierOverride.ts @@ -7,9 +7,9 @@ */ export interface CatalogModifierOverride { /** The ID of the `CatalogModifier` whose default behavior is being overridden. */ - modifierId: string; + modifier_id: string; /** __Deprecated__: Use `on_by_default_override` instead. */ - onByDefault?: boolean | null; - hiddenOnlineOverride?: unknown; - onByDefaultOverride?: unknown; + on_by_default?: boolean | null; + hidden_online_override?: unknown; + on_by_default_override?: unknown; } diff --git a/src/api/types/CatalogObject.ts b/src/api/types/CatalogObject.ts index 0a9bb9766..d716047fd 100644 --- a/src/api/types/CatalogObject.ts +++ b/src/api/types/CatalogObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The wrapper object for the catalog entries of a given object type. diff --git a/src/api/types/CatalogObjectAvailabilityPeriod.ts b/src/api/types/CatalogObjectAvailabilityPeriod.ts index 84fade229..f06e7660b 100644 --- a/src/api/types/CatalogObjectAvailabilityPeriod.ts +++ b/src/api/types/CatalogObjectAvailabilityPeriod.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectAvailabilityPeriod extends Square.CatalogObjectBase { /** Structured data for a `CatalogAvailabilityPeriod`, set for CatalogObjects of type `AVAILABILITY_PERIOD`. */ - availabilityPeriodData?: Square.CatalogAvailabilityPeriod; + availability_period_data?: Square.CatalogAvailabilityPeriod; } diff --git a/src/api/types/CatalogObjectBase.ts b/src/api/types/CatalogObjectBase.ts index 27fea738d..a489b4839 100644 --- a/src/api/types/CatalogObjectBase.ts +++ b/src/api/types/CatalogObjectBase.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectBase { /** @@ -19,17 +19,17 @@ export interface CatalogObjectBase { * 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; + updated_at?: 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; + version?: number | 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; + is_deleted?: 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 @@ -48,29 +48,29 @@ export interface CatalogObjectBase { * 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; + custom_attribute_values?: 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[]; + catalog_v1_ids?: 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; + present_at_all_locations?: 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[]; + present_at_location_ids?: 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[]; + absent_at_location_ids?: string[]; /** Identifies the `CatalogImage` attached to this `CatalogObject`. */ - imageId?: string; + image_id?: string; } diff --git a/src/api/types/CatalogObjectBatch.ts b/src/api/types/CatalogObjectBatch.ts index e64670b38..d0f4fbca7 100644 --- a/src/api/types/CatalogObjectBatch.ts +++ b/src/api/types/CatalogObjectBatch.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A batch of catalog objects. diff --git a/src/api/types/CatalogObjectCategory.ts b/src/api/types/CatalogObjectCategory.ts index 1f73ec2e7..ef5f15d0f 100644 --- a/src/api/types/CatalogObjectCategory.ts +++ b/src/api/types/CatalogObjectCategory.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A category that can be assigned to an item or a parent category that can be assigned @@ -13,24 +13,24 @@ 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; + ordinal?: (number | bigint) | null; /** Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`. */ - categoryData?: Square.CatalogCategory; + category_data?: 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; + updated_at?: 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; + version?: number | 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; + is_deleted?: 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 @@ -49,29 +49,29 @@ export interface CatalogObjectCategory { * 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; + custom_attribute_values?: 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[]; + catalog_v1_ids?: 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; + present_at_all_locations?: 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[]; + present_at_location_ids?: 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[]; + absent_at_location_ids?: string[]; /** Identifies the `CatalogImage` attached to this `CatalogObject`. */ - imageId?: string; + image_id?: string; } diff --git a/src/api/types/CatalogObjectCustomAttributeDefinition.ts b/src/api/types/CatalogObjectCustomAttributeDefinition.ts index 90777ecf4..23f81a58b 100644 --- a/src/api/types/CatalogObjectCustomAttributeDefinition.ts +++ b/src/api/types/CatalogObjectCustomAttributeDefinition.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectCustomAttributeDefinition extends Square.CatalogObjectBase { /** Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`. */ - customAttributeDefinitionData?: Square.CatalogCustomAttributeDefinition; + custom_attribute_definition_data?: Square.CatalogCustomAttributeDefinition; } diff --git a/src/api/types/CatalogObjectDiscount.ts b/src/api/types/CatalogObjectDiscount.ts index cd8623cbb..0e902364c 100644 --- a/src/api/types/CatalogObjectDiscount.ts +++ b/src/api/types/CatalogObjectDiscount.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectDiscount extends Square.CatalogObjectBase { /** Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`. */ - discountData?: Square.CatalogDiscount; + discount_data?: Square.CatalogDiscount; } diff --git a/src/api/types/CatalogObjectImage.ts b/src/api/types/CatalogObjectImage.ts index 85ee6f5d7..0f289013e 100644 --- a/src/api/types/CatalogObjectImage.ts +++ b/src/api/types/CatalogObjectImage.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectImage extends Square.CatalogObjectBase { /** Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`. */ - imageData?: Square.CatalogImage; + image_data?: Square.CatalogImage; } diff --git a/src/api/types/CatalogObjectItem.ts b/src/api/types/CatalogObjectItem.ts index 041ad742e..c4d5ea398 100644 --- a/src/api/types/CatalogObjectItem.ts +++ b/src/api/types/CatalogObjectItem.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectItem extends Square.CatalogObjectBase { /** Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`. */ - itemData?: Square.CatalogItem; + item_data?: Square.CatalogItem; } diff --git a/src/api/types/CatalogObjectItemOption.ts b/src/api/types/CatalogObjectItemOption.ts index aa14a0a27..af6ab1c0d 100644 --- a/src/api/types/CatalogObjectItemOption.ts +++ b/src/api/types/CatalogObjectItemOption.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectItemOption extends Square.CatalogObjectBase { /** Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`. */ - itemOptionData?: Square.CatalogItemOption; + item_option_data?: Square.CatalogItemOption; } diff --git a/src/api/types/CatalogObjectItemOptionValue.ts b/src/api/types/CatalogObjectItemOptionValue.ts index e2538bd44..e14b469e9 100644 --- a/src/api/types/CatalogObjectItemOptionValue.ts +++ b/src/api/types/CatalogObjectItemOptionValue.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectItemOptionValue extends Square.CatalogObjectBase { /** Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`. */ - itemOptionValueData?: Square.CatalogItemOptionValue; + item_option_value_data?: Square.CatalogItemOptionValue; } diff --git a/src/api/types/CatalogObjectItemVariation.ts b/src/api/types/CatalogObjectItemVariation.ts index e3db4f88e..4a215a0d8 100644 --- a/src/api/types/CatalogObjectItemVariation.ts +++ b/src/api/types/CatalogObjectItemVariation.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectItemVariation extends Square.CatalogObjectBase { /** Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`. */ - itemVariationData?: Square.CatalogItemVariation; + item_variation_data?: Square.CatalogItemVariation; } diff --git a/src/api/types/CatalogObjectMeasurementUnit.ts b/src/api/types/CatalogObjectMeasurementUnit.ts index 617db0199..d54a1b75f 100644 --- a/src/api/types/CatalogObjectMeasurementUnit.ts +++ b/src/api/types/CatalogObjectMeasurementUnit.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectMeasurementUnit extends Square.CatalogObjectBase { /** Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`. */ - measurementUnitData?: Square.CatalogMeasurementUnit; + measurement_unit_data?: Square.CatalogMeasurementUnit; } diff --git a/src/api/types/CatalogObjectModifier.ts b/src/api/types/CatalogObjectModifier.ts index 4035903a2..d873bb7c4 100644 --- a/src/api/types/CatalogObjectModifier.ts +++ b/src/api/types/CatalogObjectModifier.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectModifier extends Square.CatalogObjectBase { /** Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`. */ - modifierData?: Square.CatalogModifier; + modifier_data?: Square.CatalogModifier; } diff --git a/src/api/types/CatalogObjectModifierList.ts b/src/api/types/CatalogObjectModifierList.ts index ba19d39a3..32c57aa27 100644 --- a/src/api/types/CatalogObjectModifierList.ts +++ b/src/api/types/CatalogObjectModifierList.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectModifierList extends Square.CatalogObjectBase { /** Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`. */ - modifierListData?: Square.CatalogModifierList; + modifier_list_data?: Square.CatalogModifierList; } diff --git a/src/api/types/CatalogObjectPricingRule.ts b/src/api/types/CatalogObjectPricingRule.ts index 7ebc2203b..7bb1b23c5 100644 --- a/src/api/types/CatalogObjectPricingRule.ts +++ b/src/api/types/CatalogObjectPricingRule.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + pricing_rule_data?: Square.CatalogPricingRule; } diff --git a/src/api/types/CatalogObjectProductSet.ts b/src/api/types/CatalogObjectProductSet.ts index 8a8ac48d0..53c8d74b4 100644 --- a/src/api/types/CatalogObjectProductSet.ts +++ b/src/api/types/CatalogObjectProductSet.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectProductSet extends Square.CatalogObjectBase { /** Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`. */ - productSetData?: Square.CatalogProductSet; + product_set_data?: Square.CatalogProductSet; } diff --git a/src/api/types/CatalogObjectQuickAmountsSettings.ts b/src/api/types/CatalogObjectQuickAmountsSettings.ts index 96dfaae14..cf479a221 100644 --- a/src/api/types/CatalogObjectQuickAmountsSettings.ts +++ b/src/api/types/CatalogObjectQuickAmountsSettings.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectQuickAmountsSettings extends Square.CatalogObjectBase { /** Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`. */ - quickAmountsSettingsData?: Square.CatalogQuickAmountsSettings; + quick_amounts_settings_data?: Square.CatalogQuickAmountsSettings; } diff --git a/src/api/types/CatalogObjectReference.ts b/src/api/types/CatalogObjectReference.ts index bae12f831..d6d0b58ff 100644 --- a/src/api/types/CatalogObjectReference.ts +++ b/src/api/types/CatalogObjectReference.ts @@ -9,7 +9,7 @@ */ export interface CatalogObjectReference { /** The ID of the referenced object. */ - objectId?: string | null; + object_id?: string | null; /** The version of the object. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; } diff --git a/src/api/types/CatalogObjectSubscriptionPlan.ts b/src/api/types/CatalogObjectSubscriptionPlan.ts index cc8f91f21..7b611f02f 100644 --- a/src/api/types/CatalogObjectSubscriptionPlan.ts +++ b/src/api/types/CatalogObjectSubscriptionPlan.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectSubscriptionPlan extends Square.CatalogObjectBase { /** Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`. */ - subscriptionPlanData?: Square.CatalogSubscriptionPlan; + subscription_plan_data?: Square.CatalogSubscriptionPlan; } diff --git a/src/api/types/CatalogObjectSubscriptionPlanVariation.ts b/src/api/types/CatalogObjectSubscriptionPlanVariation.ts index e7ad55b81..8f81b09a7 100644 --- a/src/api/types/CatalogObjectSubscriptionPlanVariation.ts +++ b/src/api/types/CatalogObjectSubscriptionPlanVariation.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectSubscriptionPlanVariation extends Square.CatalogObjectBase { /** Structured data for a `CatalogSubscriptionPlanVariation`, set for CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`. */ - subscriptionPlanVariationData?: Square.CatalogSubscriptionPlanVariation; + subscription_plan_variation_data?: Square.CatalogSubscriptionPlanVariation; } diff --git a/src/api/types/CatalogObjectTax.ts b/src/api/types/CatalogObjectTax.ts index 9bd1f77c9..049d7fdf0 100644 --- a/src/api/types/CatalogObjectTax.ts +++ b/src/api/types/CatalogObjectTax.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectTax extends Square.CatalogObjectBase { /** Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`. */ - taxData?: Square.CatalogTax; + tax_data?: Square.CatalogTax; } diff --git a/src/api/types/CatalogObjectTimePeriod.ts b/src/api/types/CatalogObjectTimePeriod.ts index 7e550db1a..e0b296a09 100644 --- a/src/api/types/CatalogObjectTimePeriod.ts +++ b/src/api/types/CatalogObjectTimePeriod.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogObjectTimePeriod extends Square.CatalogObjectBase { /** Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`. */ - timePeriodData?: Square.CatalogTimePeriod; + time_period_data?: Square.CatalogTimePeriod; } diff --git a/src/api/types/CatalogPricingRule.ts b/src/api/types/CatalogPricingRule.ts index 7097f093e..9a5e3e74f 100644 --- a/src/api/types/CatalogPricingRule.ts +++ b/src/api/types/CatalogPricingRule.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines how discounts are automatically applied to a set of items that match the pricing rule @@ -19,17 +19,17 @@ export interface CatalogPricingRule { * this pricing rule is in effect. If left unset, the pricing rule is always * in effect. */ - timePeriodIds?: string[] | null; + time_period_ids?: string[] | null; /** * Unique ID for the `CatalogDiscount` to take off * the price of all matched items. */ - discountId?: string | null; + discount_id?: 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; + match_products_id?: string | null; /** * __Deprecated__: Please use the `exclude_products_id` field to apply * an exclude set instead. Exclude sets allow better control over quantity @@ -41,7 +41,7 @@ export interface CatalogPricingRule { * 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; + apply_products_id?: 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). @@ -49,21 +49,21 @@ export interface CatalogPricingRule { * 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; + exclude_products_id?: string | null; /** Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD). */ - validFromDate?: string | null; + valid_from_date?: 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; + valid_from_local_time?: string | null; /** Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD). */ - validUntilDate?: string | null; + valid_until_date?: 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; + valid_until_local_time?: string | null; /** * If an `exclude_products_id` was given, controls which subset of matched * products is excluded from any discounts. @@ -71,12 +71,12 @@ export interface CatalogPricingRule { * Default value: `LEAST_EXPENSIVE` * See [ExcludeStrategy](#type-excludestrategy) for possible values */ - excludeStrategy?: Square.ExcludeStrategy; + exclude_strategy?: 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; + minimum_order_subtotal_money?: 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. @@ -84,5 +84,5 @@ export interface CatalogPricingRule { * 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; + customer_group_ids_any?: string[] | null; } diff --git a/src/api/types/CatalogProductSet.ts b/src/api/types/CatalogProductSet.ts index af45500a6..1d83dfda8 100644 --- a/src/api/types/CatalogProductSet.ts +++ b/src/api/types/CatalogProductSet.ts @@ -27,7 +27,7 @@ export interface CatalogProductSet { * * Max: 500 catalog object IDs. */ - productIdsAny?: string[] | null; + product_ids_any?: 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. @@ -36,28 +36,28 @@ export interface CatalogProductSet { * * Max: 500 catalog object IDs. */ - productIdsAll?: string[] | null; + product_ids_all?: 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; + quantity_exact?: (number | 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; + quantity_min?: (number | 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; + quantity_max?: (number | 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; + all_products?: boolean | null; } diff --git a/src/api/types/CatalogQuery.ts b/src/api/types/CatalogQuery.ts index e4e09f74f..8574d404a 100644 --- a/src/api/types/CatalogQuery.ts +++ b/src/api/types/CatalogQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. @@ -34,44 +34,44 @@ import * as Square from "../index"; */ export interface CatalogQuery { /** A query expression to sort returned query result by the given attribute. */ - sortedAttributeQuery?: Square.CatalogQuerySortedAttribute; + sorted_attribute_query?: 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; + exact_query?: 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; + set_query?: 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; + prefix_query?: Square.CatalogQueryPrefix; /** * A range query expression to return objects with numeric values * that lie in the specified range. */ - rangeQuery?: Square.CatalogQueryRange; + range_query?: 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; + text_query?: 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; + items_for_tax_query?: 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; + items_for_modifier_list_query?: Square.CatalogQueryItemsForModifierList; /** A query expression to return items that contains the specified item options (as identified the corresponding `CatalogItemOption` IDs). */ - itemsForItemOptionsQuery?: Square.CatalogQueryItemsForItemOptions; + items_for_item_options_query?: 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; + item_variations_for_item_option_values_query?: Square.CatalogQueryItemVariationsForItemOptionValues; } diff --git a/src/api/types/CatalogQueryExact.ts b/src/api/types/CatalogQueryExact.ts index 762749a7d..20b6a8374 100644 --- a/src/api/types/CatalogQueryExact.ts +++ b/src/api/types/CatalogQueryExact.ts @@ -7,10 +7,10 @@ */ export interface CatalogQueryExact { /** The name of the attribute to be searched. Matching of the attribute name is exact. */ - attributeName: string; + attribute_name: 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; + attribute_value: string; } diff --git a/src/api/types/CatalogQueryItemVariationsForItemOptionValues.ts b/src/api/types/CatalogQueryItemVariationsForItemOptionValues.ts index 9f3a4f122..6049ed314 100644 --- a/src/api/types/CatalogQueryItemVariationsForItemOptionValues.ts +++ b/src/api/types/CatalogQueryItemVariationsForItemOptionValues.ts @@ -11,5 +11,5 @@ export interface CatalogQueryItemVariationsForItemOptionValues { * `CatalogItemVariation`s. All ItemVariations that contain all of the given * Item Option Values (in any order) will be returned. */ - itemOptionValueIds?: string[] | null; + item_option_value_ids?: string[] | null; } diff --git a/src/api/types/CatalogQueryItemsForItemOptions.ts b/src/api/types/CatalogQueryItemsForItemOptions.ts index 39e525afb..88c02789a 100644 --- a/src/api/types/CatalogQueryItemsForItemOptions.ts +++ b/src/api/types/CatalogQueryItemsForItemOptions.ts @@ -11,5 +11,5 @@ export interface CatalogQueryItemsForItemOptions { * `CatalogItem`s. All Items that contain all of the given Item Options (in any order) * will be returned. */ - itemOptionIds?: string[] | null; + item_option_ids?: string[] | null; } diff --git a/src/api/types/CatalogQueryItemsForModifierList.ts b/src/api/types/CatalogQueryItemsForModifierList.ts index b1b539be4..4818f99f3 100644 --- a/src/api/types/CatalogQueryItemsForModifierList.ts +++ b/src/api/types/CatalogQueryItemsForModifierList.ts @@ -7,5 +7,5 @@ */ export interface CatalogQueryItemsForModifierList { /** A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s. */ - modifierListIds: string[]; + modifier_list_ids: string[]; } diff --git a/src/api/types/CatalogQueryItemsForTax.ts b/src/api/types/CatalogQueryItemsForTax.ts index 74186305a..aa3e08799 100644 --- a/src/api/types/CatalogQueryItemsForTax.ts +++ b/src/api/types/CatalogQueryItemsForTax.ts @@ -7,5 +7,5 @@ */ export interface CatalogQueryItemsForTax { /** A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s. */ - taxIds: string[]; + tax_ids: string[]; } diff --git a/src/api/types/CatalogQueryPrefix.ts b/src/api/types/CatalogQueryPrefix.ts index a834d4c3d..da0d79e5d 100644 --- a/src/api/types/CatalogQueryPrefix.ts +++ b/src/api/types/CatalogQueryPrefix.ts @@ -7,7 +7,7 @@ */ export interface CatalogQueryPrefix { /** The name of the attribute to be searched. */ - attributeName: string; + attribute_name: string; /** The desired prefix of the search attribute value. */ - attributePrefix: string; + attribute_prefix: string; } diff --git a/src/api/types/CatalogQueryRange.ts b/src/api/types/CatalogQueryRange.ts index c1a96a683..88767d322 100644 --- a/src/api/types/CatalogQueryRange.ts +++ b/src/api/types/CatalogQueryRange.ts @@ -7,9 +7,9 @@ */ export interface CatalogQueryRange { /** The name of the attribute to be searched. */ - attributeName: string; + attribute_name: string; /** The desired minimum value for the search attribute (inclusive). */ - attributeMinValue?: bigint | null; + attribute_min_value?: (number | bigint) | null; /** The desired maximum value for the search attribute (inclusive). */ - attributeMaxValue?: bigint | null; + attribute_max_value?: (number | bigint) | null; } diff --git a/src/api/types/CatalogQuerySet.ts b/src/api/types/CatalogQuerySet.ts index 316819065..2713e6aea 100644 --- a/src/api/types/CatalogQuerySet.ts +++ b/src/api/types/CatalogQuerySet.ts @@ -8,10 +8,10 @@ */ export interface CatalogQuerySet { /** The name of the attribute to be searched. Matching of the attribute name is exact. */ - attributeName: string; + attribute_name: 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[]; + attribute_values: string[]; } diff --git a/src/api/types/CatalogQuerySortedAttribute.ts b/src/api/types/CatalogQuerySortedAttribute.ts index 44807e89f..178287c30 100644 --- a/src/api/types/CatalogQuerySortedAttribute.ts +++ b/src/api/types/CatalogQuerySortedAttribute.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + attribute_name: 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; + initial_attribute_value?: string | null; /** * The desired sort order, `"ASC"` (ascending) or `"DESC"` (descending). * See [SortOrder](#type-sortorder) for possible values */ - sortOrder?: Square.SortOrder; + sort_order?: Square.SortOrder; } diff --git a/src/api/types/CatalogQuickAmount.ts b/src/api/types/CatalogQuickAmount.ts index 8771b7c83..a47945887 100644 --- a/src/api/types/CatalogQuickAmount.ts +++ b/src/api/types/CatalogQuickAmount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a Quick Amount in the Catalog. @@ -19,7 +19,7 @@ export interface CatalogQuickAmount { * 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; + score?: (number | bigint) | null; /** The order in which this Quick Amount should be displayed. */ - ordinal?: bigint | null; + ordinal?: (number | bigint) | null; } diff --git a/src/api/types/CatalogQuickAmountsSettings.ts b/src/api/types/CatalogQuickAmountsSettings.ts index f10fa63d9..0427c8831 100644 --- a/src/api/types/CatalogQuickAmountsSettings.ts +++ b/src/api/types/CatalogQuickAmountsSettings.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. @@ -17,7 +17,7 @@ export interface CatalogQuickAmountsSettings { * Represents location's eligibility for auto amounts * The boolean should be consistent with whether there are AUTO amounts in the `amounts`. */ - eligibleForAutoAmounts?: boolean | null; + eligible_for_auto_amounts?: boolean | null; /** Represents a set of Quick Amounts at this location. */ amounts?: Square.CatalogQuickAmount[] | null; } diff --git a/src/api/types/CatalogStockConversion.ts b/src/api/types/CatalogStockConversion.ts index 2293c944f..c36b173de 100644 --- a/src/api/types/CatalogStockConversion.ts +++ b/src/api/types/CatalogStockConversion.ts @@ -15,14 +15,14 @@ export interface CatalogStockConversion { * This immutable field must reference a stockable `CatalogItemVariation` * that shares the parent [CatalogItem](entity:CatalogItem) of the converted `CatalogItemVariation.` */ - stockableItemVariationId: string; + stockable_item_variation_id: 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; + stockable_quantity: 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 @@ -30,5 +30,5 @@ export interface CatalogStockConversion { * 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; + nonstockable_quantity: string; } diff --git a/src/api/types/CatalogSubscriptionPlan.ts b/src/api/types/CatalogSubscriptionPlan.ts index a649ce62e..a2d8748fe 100644 --- a/src/api/types/CatalogSubscriptionPlan.ts +++ b/src/api/types/CatalogSubscriptionPlan.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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. @@ -17,11 +17,11 @@ export interface CatalogSubscriptionPlan { */ phases?: Square.SubscriptionPhase[] | null; /** The list of subscription plan variations available for this product */ - subscriptionPlanVariations?: Square.CatalogObject[] | null; + subscription_plan_variations?: Square.CatalogObject[] | null; /** The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations. */ - eligibleItemIds?: string[] | null; + eligible_item_ids?: string[] | null; /** The list of IDs of `CatalogCategory` that are eligible for subscription by this SubscriptionPlan's variations. */ - eligibleCategoryIds?: string[] | null; + eligible_category_ids?: string[] | null; /** If true, all items in the merchant's catalog are subscribable by this SubscriptionPlan. */ - allItems?: boolean | null; + all_items?: boolean | null; } diff --git a/src/api/types/CatalogSubscriptionPlanVariation.ts b/src/api/types/CatalogSubscriptionPlanVariation.ts index a3b24149d..6263abf91 100644 --- a/src/api/types/CatalogSubscriptionPlanVariation.ts +++ b/src/api/types/CatalogSubscriptionPlanVariation.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a subscription plan variation. A subscription plan variation represents how the subscription for a product or service is sold. @@ -14,15 +14,15 @@ export interface CatalogSubscriptionPlanVariation { /** A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation. */ phases: Square.SubscriptionPhase[]; /** The id of the subscription plan, if there is one. */ - subscriptionPlanId?: string | null; + subscription_plan_id?: string | null; /** The day of the month the billing period starts. */ - monthlyBillingAnchorDate?: bigint | null; + monthly_billing_anchor_date?: (number | bigint) | null; /** Whether bills for this plan variation can be split for proration. */ - canProrate?: boolean | null; + can_prorate?: 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; + successor_plan_variation_id?: string | null; } diff --git a/src/api/types/CatalogTax.ts b/src/api/types/CatalogTax.ts index 7333f2886..3d6d7e5a6 100644 --- a/src/api/types/CatalogTax.ts +++ b/src/api/types/CatalogTax.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A tax applicable to an item. @@ -14,12 +14,12 @@ export interface CatalogTax { * Whether the tax is calculated based on a payment's subtotal or total. * See [TaxCalculationPhase](#type-taxcalculationphase) for possible values */ - calculationPhase?: Square.TaxCalculationPhase; + calculation_phase?: Square.TaxCalculationPhase; /** * Whether the tax is `ADDITIVE` or `INCLUSIVE`. * See [TaxInclusionType](#type-taxinclusiontype) for possible values */ - inclusionType?: Square.TaxInclusionType; + inclusion_type?: 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. @@ -29,9 +29,9 @@ export interface CatalogTax { * 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; + applies_to_custom_amounts?: 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; + applies_to_product_set_id?: string | null; } diff --git a/src/api/types/CatalogV1Id.ts b/src/api/types/CatalogV1Id.ts index 7e8e9b68c..a3432955d 100644 --- a/src/api/types/CatalogV1Id.ts +++ b/src/api/types/CatalogV1Id.ts @@ -7,7 +7,7 @@ */ 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; + catalog_v1_id?: string | null; /** The ID of the `Location` this Connect V1 ID is associated with. */ - locationId?: string | null; + location_id?: string | null; } diff --git a/src/api/types/CatalogVersionUpdatedEvent.ts b/src/api/types/CatalogVersionUpdatedEvent.ts index d7cf3d759..65975eec3 100644 --- a/src/api/types/CatalogVersionUpdatedEvent.ts +++ b/src/api/types/CatalogVersionUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when the catalog is updated. */ export interface CatalogVersionUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.CatalogVersionUpdatedEventData; } diff --git a/src/api/types/CatalogVersionUpdatedEventCatalogVersion.ts b/src/api/types/CatalogVersionUpdatedEventCatalogVersion.ts index 917e5cf61..5e7b6160a 100644 --- a/src/api/types/CatalogVersionUpdatedEventCatalogVersion.ts +++ b/src/api/types/CatalogVersionUpdatedEventCatalogVersion.ts @@ -4,5 +4,5 @@ export interface CatalogVersionUpdatedEventCatalogVersion { /** Last modification timestamp in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/CatalogVersionUpdatedEventData.ts b/src/api/types/CatalogVersionUpdatedEventData.ts index c554fd6ee..a22f486e4 100644 --- a/src/api/types/CatalogVersionUpdatedEventData.ts +++ b/src/api/types/CatalogVersionUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogVersionUpdatedEventData { /** Name of the affected object’s type. */ diff --git a/src/api/types/CatalogVersionUpdatedEventObject.ts b/src/api/types/CatalogVersionUpdatedEventObject.ts index d2ee6eaa8..15d440b19 100644 --- a/src/api/types/CatalogVersionUpdatedEventObject.ts +++ b/src/api/types/CatalogVersionUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CatalogVersionUpdatedEventObject { /** The version of the object. */ - catalogVersion?: Square.CatalogVersionUpdatedEventCatalogVersion; + catalog_version?: Square.CatalogVersionUpdatedEventCatalogVersion; } diff --git a/src/api/types/CategoryPathToRootNode.ts b/src/api/types/CategoryPathToRootNode.ts index 3b8994258..b5f4431e3 100644 --- a/src/api/types/CategoryPathToRootNode.ts +++ b/src/api/types/CategoryPathToRootNode.ts @@ -7,7 +7,7 @@ */ export interface CategoryPathToRootNode { /** The category's ID. */ - categoryId?: string | null; + category_id?: string | null; /** The category's name. */ - categoryName?: string | null; + category_name?: string | null; } diff --git a/src/api/types/ChangeBillingAnchorDateResponse.ts b/src/api/types/ChangeBillingAnchorDateResponse.ts index f05bb0771..ec8a3398f 100644 --- a/src/api/types/ChangeBillingAnchorDateResponse.ts +++ b/src/api/types/ChangeBillingAnchorDateResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a request to the diff --git a/src/api/types/ChargeRequestAdditionalRecipient.ts b/src/api/types/ChargeRequestAdditionalRecipient.ts index 86f123eca..2cb536881 100644 --- a/src/api/types/ChargeRequestAdditionalRecipient.ts +++ b/src/api/types/ChargeRequestAdditionalRecipient.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an additional recipient (other than the merchant) entitled to a portion of the tender. @@ -10,9 +10,9 @@ import * as Square from "../index"; */ export interface ChargeRequestAdditionalRecipient { /** The location ID for a recipient (other than the merchant) receiving a portion of the tender. */ - locationId: string; + location_id: string; /** The description of the additional recipient. */ description: string; /** The amount of money distributed to the recipient. */ - amountMoney: Square.Money; + amount_money: Square.Money; } diff --git a/src/api/types/Checkout.ts b/src/api/types/Checkout.ts index 377cb8125..3fdd52347 100644 --- a/src/api/types/Checkout.ts +++ b/src/api/types/Checkout.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Square Checkout lets merchants accept online payments for supported @@ -15,7 +15,7 @@ export interface Checkout { * The URL that the buyer's browser should be redirected to after the * checkout is completed. */ - checkoutPageUrl?: string | null; + checkout_page_url?: string | null; /** * If `true`, Square Checkout will collect shipping information on your * behalf and store that information with the transaction information in your @@ -23,7 +23,7 @@ export interface Checkout { * * Default: `false`. */ - askForShippingAddress?: boolean | null; + ask_for_shipping_address?: 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. @@ -33,21 +33,21 @@ export interface Checkout { * * Default: none; only exists if explicitly set. */ - merchantSupportEmail?: string | null; + merchant_support_email?: 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; + pre_populate_buyer_email?: 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; + pre_populate_shipping_address?: Square.Address; /** * The URL to redirect to after checkout is completed with `checkoutId`, * Square's `orderId`, `transactionId`, and `referenceId` appended as URL @@ -62,14 +62,14 @@ export interface Checkout { * 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; + redirect_url?: string | null; /** Order to be checked out. */ order?: Square.Order; /** The time when the checkout was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: 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; + additional_recipients?: Square.AdditionalRecipient[] | null; } diff --git a/src/api/types/CheckoutLocationSettings.ts b/src/api/types/CheckoutLocationSettings.ts index 5f4ddd1a5..e47badfbf 100644 --- a/src/api/types/CheckoutLocationSettings.ts +++ b/src/api/types/CheckoutLocationSettings.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CheckoutLocationSettings { /** The ID of the location that these settings apply to. */ - locationId?: string | null; + location_id?: string | null; /** Indicates whether customers are allowed to leave notes at checkout. */ - customerNotesEnabled?: boolean | null; + customer_notes_enabled?: boolean | null; /** * Policy information is displayed at the bottom of the checkout pages. * You can set a maximum of two policies. @@ -26,5 +26,5 @@ export interface CheckoutLocationSettings { * UTC: 2020-01-26T02:25:34Z * Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00 */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/CheckoutLocationSettingsBranding.ts b/src/api/types/CheckoutLocationSettingsBranding.ts index 1c87ae6c4..5c45a8bb1 100644 --- a/src/api/types/CheckoutLocationSettingsBranding.ts +++ b/src/api/types/CheckoutLocationSettingsBranding.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CheckoutLocationSettingsBranding { /** * Show the location logo on the checkout page. * See [HeaderType](#type-headertype) for possible values */ - headerType?: Square.CheckoutLocationSettingsBrandingHeaderType; + header_type?: Square.CheckoutLocationSettingsBrandingHeaderType; /** The HTML-supported hex color for the button on the checkout page (for example, "#FFFFFF"). */ - buttonColor?: string | null; + button_color?: string | null; /** * The shape of the button on the checkout page. * See [ButtonShape](#type-buttonshape) for possible values */ - buttonShape?: Square.CheckoutLocationSettingsBrandingButtonShape; + button_shape?: Square.CheckoutLocationSettingsBrandingButtonShape; } diff --git a/src/api/types/CheckoutLocationSettingsTipping.ts b/src/api/types/CheckoutLocationSettingsTipping.ts index 5f7bb7342..8ab76938b 100644 --- a/src/api/types/CheckoutLocationSettingsTipping.ts +++ b/src/api/types/CheckoutLocationSettingsTipping.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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. */ @@ -13,11 +13,11 @@ export interface CheckoutLocationSettingsTipping { * 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; + smart_tipping_enabled?: 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; + default_percent?: number | null; /** Show the Smart Tip Amounts for this location. */ - smartTips?: Square.Money[] | null; + smart_tips?: 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; + default_smart_tip?: Square.Money; } diff --git a/src/api/types/CheckoutMerchantSettings.ts b/src/api/types/CheckoutMerchantSettings.ts index 1f28f467a..2b4bb0c29 100644 --- a/src/api/types/CheckoutMerchantSettings.ts +++ b/src/api/types/CheckoutMerchantSettings.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CheckoutMerchantSettings { /** The set of payment methods accepted for the merchant's account. */ - paymentMethods?: Square.CheckoutMerchantSettingsPaymentMethods; + payment_methods?: 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; + updated_at?: string; } diff --git a/src/api/types/CheckoutMerchantSettingsPaymentMethods.ts b/src/api/types/CheckoutMerchantSettingsPaymentMethods.ts index 586a93755..606a81e06 100644 --- a/src/api/types/CheckoutMerchantSettingsPaymentMethods.ts +++ b/src/api/types/CheckoutMerchantSettingsPaymentMethods.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CheckoutMerchantSettingsPaymentMethods { - applePay?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; - googlePay?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; - cashApp?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; - afterpayClearpay?: Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay; + apple_pay?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; + google_pay?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; + cash_app?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; + afterpay_clearpay?: Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay; } diff --git a/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts b/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts index f485e9053..b482cd5e0 100644 --- a/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts +++ b/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + order_eligibility_range?: Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange; /** Afterpay is shown as an option for item totals falling within the configured range. */ - itemEligibilityRange?: Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange; + item_eligibility_range?: 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 index d43e503b5..8ed119d29 100644 --- a/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts +++ b/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A range of purchase price that qualifies. diff --git a/src/api/types/CheckoutOptions.ts b/src/api/types/CheckoutOptions.ts index 0a598f295..37343381d 100644 --- a/src/api/types/CheckoutOptions.ts +++ b/src/api/types/CheckoutOptions.ts @@ -2,26 +2,26 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CheckoutOptions { /** Indicates whether the payment allows tipping. */ - allowTipping?: boolean | null; + allow_tipping?: boolean | null; /** The custom fields requesting information from the buyer. */ - customFields?: Square.CustomField[] | null; + custom_fields?: 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; + subscription_plan_id?: string | null; /** The confirmation page URL to redirect the buyer to after Square processes the payment. */ - redirectUrl?: string | null; + redirect_url?: string | null; /** The email address that buyers can use to contact the seller. */ - merchantSupportEmail?: string | null; + merchant_support_email?: string | null; /** Indicates whether to include the address fields in the payment form. */ - askForShippingAddress?: boolean | null; + ask_for_shipping_address?: boolean | null; /** The methods allowed for buyers during checkout. */ - acceptedPaymentMethods?: Square.AcceptedPaymentMethods; + accepted_payment_methods?: Square.AcceptedPaymentMethods; /** * The amount of money that the developer is taking as a fee for facilitating the payment on behalf of the seller. * @@ -33,11 +33,11 @@ export interface CheckoutOptions { * * 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; + app_fee_money?: Square.Money; /** The fee associated with shipping to be applied to the `Order` as a service charge. */ - shippingFee?: Square.ShippingFee; + shipping_fee?: 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; + enable_coupon?: 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; + enable_loyalty?: boolean | null; } diff --git a/src/api/types/ClearpayDetails.ts b/src/api/types/ClearpayDetails.ts index f704dcb5a..8cdd4f4cc 100644 --- a/src/api/types/ClearpayDetails.ts +++ b/src/api/types/ClearpayDetails.ts @@ -7,5 +7,5 @@ */ export interface ClearpayDetails { /** Email address on the buyer's Clearpay account. */ - emailAddress?: string | null; + email_address?: string | null; } diff --git a/src/api/types/CloneOrderResponse.ts b/src/api/types/CloneOrderResponse.ts index 94e715021..e3d03fbb0 100644 --- a/src/api/types/CloneOrderResponse.ts +++ b/src/api/types/CloneOrderResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CollectedData.ts b/src/api/types/CollectedData.ts index 0c1544f0a..fe87ef8c7 100644 --- a/src/api/types/CollectedData.ts +++ b/src/api/types/CollectedData.ts @@ -4,5 +4,5 @@ export interface CollectedData { /** The buyer's input text. */ - inputText?: string; + input_text?: string; } diff --git a/src/api/types/CompletePaymentResponse.ts b/src/api/types/CompletePaymentResponse.ts index 0421416db..d514ce188 100644 --- a/src/api/types/CompletePaymentResponse.ts +++ b/src/api/types/CompletePaymentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by[CompletePayment](api-endpoint:Payments-CompletePayment). diff --git a/src/api/types/Component.ts b/src/api/types/Component.ts index d6c9ed530..9cc178838 100644 --- a/src/api/types/Component.ts +++ b/src/api/types/Component.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The wrapper object for the component entries of a given component type. @@ -15,13 +15,13 @@ export interface Component { */ type: Square.ComponentComponentType; /** Structured data for an `Application`, set for Components of type `APPLICATION`. */ - applicationDetails?: Square.DeviceComponentDetailsApplicationDetails; + application_details?: Square.DeviceComponentDetailsApplicationDetails; /** Structured data for a `CardReader`, set for Components of type `CARD_READER`. */ - cardReaderDetails?: Square.DeviceComponentDetailsCardReaderDetails; + card_reader_details?: Square.DeviceComponentDetailsCardReaderDetails; /** Structured data for a `Battery`, set for Components of type `BATTERY`. */ - batteryDetails?: Square.DeviceComponentDetailsBatteryDetails; + battery_details?: Square.DeviceComponentDetailsBatteryDetails; /** Structured data for a `WiFi` interface, set for Components of type `WIFI`. */ - wifiDetails?: Square.DeviceComponentDetailsWiFiDetails; + wifi_details?: Square.DeviceComponentDetailsWiFiDetails; /** Structured data for an `Ethernet` interface, set for Components of type `ETHERNET`. */ - ethernetDetails?: Square.DeviceComponentDetailsEthernetDetails; + ethernet_details?: Square.DeviceComponentDetailsEthernetDetails; } diff --git a/src/api/types/ConfirmationDecision.ts b/src/api/types/ConfirmationDecision.ts index 5fe860a59..72c48e91a 100644 --- a/src/api/types/ConfirmationDecision.ts +++ b/src/api/types/ConfirmationDecision.ts @@ -4,5 +4,5 @@ export interface ConfirmationDecision { /** The buyer's decision to the displayed terms. */ - hasAgreed?: boolean; + has_agreed?: boolean; } diff --git a/src/api/types/ConfirmationOptions.ts b/src/api/types/ConfirmationOptions.ts index 8a5614f98..4bcb3828e 100644 --- a/src/api/types/ConfirmationOptions.ts +++ b/src/api/types/ConfirmationOptions.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ConfirmationOptions { /** The title text to display in the confirmation screen flow on the Terminal. */ @@ -10,9 +10,9 @@ export interface ConfirmationOptions { /** 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; + agree_button_text: string; /** The button text to display indicating the customer does not agree to the displayed terms. */ - disagreeButtonText?: string | null; + disagree_button_text?: string | null; /** The result of the buyer’s actions when presented with the confirmation screen. */ decision?: Square.ConfirmationDecision; } diff --git a/src/api/types/CreateBookingCustomAttributeDefinitionResponse.ts b/src/api/types/CreateBookingCustomAttributeDefinitionResponse.ts index 9ddf6dc41..24abe4dc6 100644 --- a/src/api/types/CreateBookingCustomAttributeDefinitionResponse.ts +++ b/src/api/types/CreateBookingCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-CreateBookingCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface CreateBookingCustomAttributeDefinitionResponse { /** The newly created custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 6926c089a..101cdb7a1 100644 --- a/src/api/types/CreateBookingResponse.ts +++ b/src/api/types/CreateBookingResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreateBookingResponse { /** The booking that was created. */ diff --git a/src/api/types/CreateBreakTypeResponse.ts b/src/api/types/CreateBreakTypeResponse.ts index f63265cca..9fef0dbb7 100644 --- a/src/api/types/CreateBreakTypeResponse.ts +++ b/src/api/types/CreateBreakTypeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to the request to create a `BreakType`. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface CreateBreakTypeResponse { /** The `BreakType` that was created by the request. */ - breakType?: Square.BreakType; + break_type?: 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 index dd2f132be..418f3c1bd 100644 --- a/src/api/types/CreateCardResponse.ts +++ b/src/api/types/CreateCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CreateCatalogImageRequest.ts b/src/api/types/CreateCatalogImageRequest.ts index 42a34f4db..b6a7e8ada 100644 --- a/src/api/types/CreateCatalogImageRequest.ts +++ b/src/api/types/CreateCatalogImageRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreateCatalogImageRequest { /** @@ -11,13 +11,13 @@ export interface CreateCatalogImageRequest { * * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: 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; + object_id?: string; /** The new `CatalogObject` of the `IMAGE` type, namely, a `CatalogImage` object, to encapsulate the specified image file. */ image: Square.CatalogObject; /** @@ -27,5 +27,5 @@ export interface CreateCatalogImageRequest { * * With Square API version 2021-12-15 or later, the default value is `false`. Otherwise, the effective default value is `true`. */ - isPrimary?: boolean; + is_primary?: boolean; } diff --git a/src/api/types/CreateCatalogImageResponse.ts b/src/api/types/CreateCatalogImageResponse.ts index b8bdff543..99ecc6758 100644 --- a/src/api/types/CreateCatalogImageResponse.ts +++ b/src/api/types/CreateCatalogImageResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreateCatalogImageResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/CreateCheckoutResponse.ts b/src/api/types/CreateCheckoutResponse.ts index d2fd0c058..472fa8b4b 100644 --- a/src/api/types/CreateCheckoutResponse.ts +++ b/src/api/types/CreateCheckoutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CreateCustomerCardResponse.ts b/src/api/types/CreateCustomerCardResponse.ts index a44fac41c..6fe3aa6d8 100644 --- a/src/api/types/CreateCustomerCardResponse.ts +++ b/src/api/types/CreateCustomerCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CreateCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/CreateCustomerCustomAttributeDefinitionResponse.ts index ee62749c2..e2e360a47 100644 --- a/src/api/types/CreateCustomerCustomAttributeDefinitionResponse.ts +++ b/src/api/types/CreateCustomerCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface CreateCustomerCustomAttributeDefinitionResponse { /** The new custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 4b2a3c26e..246bbf9f8 100644 --- a/src/api/types/CreateCustomerGroupResponse.ts +++ b/src/api/types/CreateCustomerGroupResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CreateCustomerResponse.ts b/src/api/types/CreateCustomerResponse.ts index c4df8272e..55fc719c1 100644 --- a/src/api/types/CreateCustomerResponse.ts +++ b/src/api/types/CreateCustomerResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CreateDeviceCodeResponse.ts b/src/api/types/CreateDeviceCodeResponse.ts index 81fc1db4d..d82101dd1 100644 --- a/src/api/types/CreateDeviceCodeResponse.ts +++ b/src/api/types/CreateDeviceCodeResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + device_code?: Square.DeviceCode; } diff --git a/src/api/types/CreateDisputeEvidenceFileRequest.ts b/src/api/types/CreateDisputeEvidenceFileRequest.ts index b618a355f..fe1c01173 100644 --- a/src/api/types/CreateDisputeEvidenceFileRequest.ts +++ b/src/api/types/CreateDisputeEvidenceFileRequest.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + idempotency_key: string; /** * The type of evidence you are uploading. * See [DisputeEvidenceType](#type-disputeevidencetype) for possible values */ - evidenceType?: Square.DisputeEvidenceType; + evidence_type?: 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; + content_type?: string; } diff --git a/src/api/types/CreateDisputeEvidenceFileResponse.ts b/src/api/types/CreateDisputeEvidenceFileResponse.ts index 8eaae103c..506b7ea5e 100644 --- a/src/api/types/CreateDisputeEvidenceFileResponse.ts +++ b/src/api/types/CreateDisputeEvidenceFileResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields in a `CreateDisputeEvidenceFile` response. diff --git a/src/api/types/CreateDisputeEvidenceTextResponse.ts b/src/api/types/CreateDisputeEvidenceTextResponse.ts index 2f5ec1d8a..fa7fef15d 100644 --- a/src/api/types/CreateDisputeEvidenceTextResponse.ts +++ b/src/api/types/CreateDisputeEvidenceTextResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields in a `CreateDisputeEvidenceText` response. diff --git a/src/api/types/CreateGiftCardActivityResponse.ts b/src/api/types/CreateGiftCardActivityResponse.ts index 9815bd3a5..cb2b45605 100644 --- a/src/api/types/CreateGiftCardActivityResponse.ts +++ b/src/api/types/CreateGiftCardActivityResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains a `GiftCardActivity` that was created. @@ -12,5 +12,5 @@ export interface CreateGiftCardActivityResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The gift card activity that was created. */ - giftCardActivity?: Square.GiftCardActivity; + gift_card_activity?: Square.GiftCardActivity; } diff --git a/src/api/types/CreateGiftCardResponse.ts b/src/api/types/CreateGiftCardResponse.ts index a5705662b..9e4024955 100644 --- a/src/api/types/CreateGiftCardResponse.ts +++ b/src/api/types/CreateGiftCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains a `GiftCard`. The response might contain a set of `Error` objects if the request @@ -12,5 +12,5 @@ export interface CreateGiftCardResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The new gift card. */ - giftCard?: Square.GiftCard; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/CreateInvoiceAttachmentRequestData.ts b/src/api/types/CreateInvoiceAttachmentRequestData.ts index 731d8f7f0..522ba9f02 100644 --- a/src/api/types/CreateInvoiceAttachmentRequestData.ts +++ b/src/api/types/CreateInvoiceAttachmentRequestData.ts @@ -10,7 +10,7 @@ export interface CreateInvoiceAttachmentRequestData { * 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; + idempotency_key?: string; /** The description of the attachment to display on the invoice. */ description?: string; } diff --git a/src/api/types/CreateInvoiceAttachmentResponse.ts b/src/api/types/CreateInvoiceAttachmentResponse.ts index b14cfba0f..dbe86e15e 100644 --- a/src/api/types/CreateInvoiceAttachmentResponse.ts +++ b/src/api/types/CreateInvoiceAttachmentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) response. diff --git a/src/api/types/CreateInvoiceResponse.ts b/src/api/types/CreateInvoiceResponse.ts index e7f5e3396..df4fb5295 100644 --- a/src/api/types/CreateInvoiceResponse.ts +++ b/src/api/types/CreateInvoiceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response returned by the `CreateInvoice` request. diff --git a/src/api/types/CreateJobResponse.ts b/src/api/types/CreateJobResponse.ts index 78e3ce0ff..b31f88f09 100644 --- a/src/api/types/CreateJobResponse.ts +++ b/src/api/types/CreateJobResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateJob](api-endpoint:Team-CreateJob) response. Either `job` or `errors` diff --git a/src/api/types/CreateLocationCustomAttributeDefinitionResponse.ts b/src/api/types/CreateLocationCustomAttributeDefinitionResponse.ts index dc836c484..8a51ff9f2 100644 --- a/src/api/types/CreateLocationCustomAttributeDefinitionResponse.ts +++ b/src/api/types/CreateLocationCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface CreateLocationCustomAttributeDefinitionResponse { /** The new custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index e625beaaf..fcd7c9bfc 100644 --- a/src/api/types/CreateLocationResponse.ts +++ b/src/api/types/CreateLocationResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response object returned by the [CreateLocation](api-endpoint:Locations-CreateLocation) endpoint. diff --git a/src/api/types/CreateLoyaltyAccountResponse.ts b/src/api/types/CreateLoyaltyAccountResponse.ts index 8deca79e7..b7bb928d5 100644 --- a/src/api/types/CreateLoyaltyAccountResponse.ts +++ b/src/api/types/CreateLoyaltyAccountResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that includes loyalty account created. @@ -11,5 +11,5 @@ export interface CreateLoyaltyAccountResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The newly created loyalty account. */ - loyaltyAccount?: Square.LoyaltyAccount; + loyalty_account?: Square.LoyaltyAccount; } diff --git a/src/api/types/CreateLoyaltyPromotionResponse.ts b/src/api/types/CreateLoyaltyPromotionResponse.ts index e9fddfd36..e50b20785 100644 --- a/src/api/types/CreateLoyaltyPromotionResponse.ts +++ b/src/api/types/CreateLoyaltyPromotionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateLoyaltyPromotion](api-endpoint:Loyalty-CreateLoyaltyPromotion) response. @@ -12,5 +12,5 @@ export interface CreateLoyaltyPromotionResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The new loyalty promotion. */ - loyaltyPromotion?: Square.LoyaltyPromotion; + loyalty_promotion?: Square.LoyaltyPromotion; } diff --git a/src/api/types/CreateLoyaltyRewardResponse.ts b/src/api/types/CreateLoyaltyRewardResponse.ts index d7895312f..6f2277a84 100644 --- a/src/api/types/CreateLoyaltyRewardResponse.ts +++ b/src/api/types/CreateLoyaltyRewardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that includes the loyalty reward created. diff --git a/src/api/types/CreateMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/CreateMerchantCustomAttributeDefinitionResponse.ts index 48eaa375b..b4c485894 100644 --- a/src/api/types/CreateMerchantCustomAttributeDefinitionResponse.ts +++ b/src/api/types/CreateMerchantCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface CreateMerchantCustomAttributeDefinitionResponse { /** The new custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 51b82b007..e482bd967 100644 --- a/src/api/types/CreateMobileAuthorizationCodeResponse.ts +++ b/src/api/types/CreateMobileAuthorizationCodeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -13,12 +13,12 @@ export interface CreateMobileAuthorizationCodeResponse { * The generated authorization code that connects a mobile application instance * to a Square account. */ - authorizationCode?: string; + authorization_code?: 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; + expires_at?: 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 index 2cb47336e..dc4595a6a 100644 --- a/src/api/types/CreateOrderCustomAttributeDefinitionResponse.ts +++ b/src/api/types/CreateOrderCustomAttributeDefinitionResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from creating an order custom attribute definition. */ export interface CreateOrderCustomAttributeDefinitionResponse { /** The new custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 7d0bcab65..5b65b26b5 100644 --- a/src/api/types/CreateOrderRequest.ts +++ b/src/api/types/CreateOrderRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreateOrderRequest { /** @@ -20,5 +20,5 @@ export interface CreateOrderRequest { * * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string; + idempotency_key?: string; } diff --git a/src/api/types/CreateOrderResponse.ts b/src/api/types/CreateOrderResponse.ts index 3f049e6fb..269208cf9 100644 --- a/src/api/types/CreateOrderResponse.ts +++ b/src/api/types/CreateOrderResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CreatePaymentLinkResponse.ts b/src/api/types/CreatePaymentLinkResponse.ts index e77451368..35dbf23d3 100644 --- a/src/api/types/CreatePaymentLinkResponse.ts +++ b/src/api/types/CreatePaymentLinkResponse.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreatePaymentLinkResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The created payment link. */ - paymentLink?: Square.PaymentLink; + payment_link?: Square.PaymentLink; /** The list of related objects. */ - relatedResources?: Square.PaymentLinkRelatedResources; + related_resources?: Square.PaymentLinkRelatedResources; } diff --git a/src/api/types/CreatePaymentResponse.ts b/src/api/types/CreatePaymentResponse.ts index c8d39c720..00fa9f160 100644 --- a/src/api/types/CreatePaymentResponse.ts +++ b/src/api/types/CreatePaymentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by [CreatePayment](api-endpoint:Payments-CreatePayment). diff --git a/src/api/types/CreateScheduledShiftResponse.ts b/src/api/types/CreateScheduledShiftResponse.ts index 2e16a71b9..7b5038bc1 100644 --- a/src/api/types/CreateScheduledShiftResponse.ts +++ b/src/api/types/CreateScheduledShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [CreateScheduledShift](api-endpoint:Labor-CreateScheduledShift) response. @@ -14,7 +14,7 @@ export interface CreateScheduledShiftResponse { * [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or * [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts). */ - scheduledShift?: Square.ScheduledShift; + scheduled_shift?: Square.ScheduledShift; /** Any errors that occurred during the request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/CreateShiftResponse.ts b/src/api/types/CreateShiftResponse.ts index 1b9200fe0..0abd43c1b 100644 --- a/src/api/types/CreateShiftResponse.ts +++ b/src/api/types/CreateShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to create a `Shift`. The response contains diff --git a/src/api/types/CreateSubscriptionResponse.ts b/src/api/types/CreateSubscriptionResponse.ts index 4e562b14b..2955e95f0 100644 --- a/src/api/types/CreateSubscriptionResponse.ts +++ b/src/api/types/CreateSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the diff --git a/src/api/types/CreateTeamMemberRequest.ts b/src/api/types/CreateTeamMemberRequest.ts index 163ad0994..78f7495cc 100644 --- a/src/api/types/CreateTeamMemberRequest.ts +++ b/src/api/types/CreateTeamMemberRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a create request for a `TeamMember` object. @@ -15,10 +15,10 @@ export interface CreateTeamMemberRequest { * * The minimum length is 1 and the maximum length is 45. */ - idempotencyKey?: string; + idempotency_key?: 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; + team_member?: Square.TeamMember; } diff --git a/src/api/types/CreateTeamMemberResponse.ts b/src/api/types/CreateTeamMemberResponse.ts index 28ef6df03..4c149bd32 100644 --- a/src/api/types/CreateTeamMemberResponse.ts +++ b/src/api/types/CreateTeamMemberResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + team_member?: 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 index cc9d6233e..714153798 100644 --- a/src/api/types/CreateTerminalActionResponse.ts +++ b/src/api/types/CreateTerminalActionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreateTerminalActionResponse { /** Information on errors encountered during the request. */ diff --git a/src/api/types/CreateTerminalCheckoutResponse.ts b/src/api/types/CreateTerminalCheckoutResponse.ts index 212fbe7c7..0e850c5a0 100644 --- a/src/api/types/CreateTerminalCheckoutResponse.ts +++ b/src/api/types/CreateTerminalCheckoutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreateTerminalCheckoutResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/CreateTerminalRefundResponse.ts b/src/api/types/CreateTerminalRefundResponse.ts index 7ef0c70d1..eebe8e0e8 100644 --- a/src/api/types/CreateTerminalRefundResponse.ts +++ b/src/api/types/CreateTerminalRefundResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CreateTerminalRefundResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/CreateTimecardResponse.ts b/src/api/types/CreateTimecardResponse.ts index 26ea8b8f8..185a8623c 100644 --- a/src/api/types/CreateTimecardResponse.ts +++ b/src/api/types/CreateTimecardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to create a `Timecard`. The response contains diff --git a/src/api/types/CreateVendorResponse.ts b/src/api/types/CreateVendorResponse.ts index fc742ce16..5892ebdab 100644 --- a/src/api/types/CreateVendorResponse.ts +++ b/src/api/types/CreateVendorResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an output from a call to [CreateVendor](api-endpoint:Vendors-CreateVendor). diff --git a/src/api/types/CreateWebhookSubscriptionResponse.ts b/src/api/types/CreateWebhookSubscriptionResponse.ts index 26321d45b..f147436a0 100644 --- a/src/api/types/CreateWebhookSubscriptionResponse.ts +++ b/src/api/types/CreateWebhookSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/CustomAttribute.ts b/src/api/types/CustomAttribute.ts index 78cde8e8f..82f926db7 100644 --- a/src/api/types/CustomAttribute.ts +++ b/src/api/types/CustomAttribute.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A custom attribute value. Each custom attribute value has a corresponding @@ -47,7 +47,7 @@ export interface CustomAttribute { * The timestamp that indicates when the custom attribute was created or was most recently * updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The timestamp that indicates when the custom attribute was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; } diff --git a/src/api/types/CustomAttributeDefinition.ts b/src/api/types/CustomAttributeDefinition.ts index f5c5c5e37..2c0b8788b 100644 --- a/src/api/types/CustomAttributeDefinition.ts +++ b/src/api/types/CustomAttributeDefinition.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a definition for custom attribute values. A custom attribute definition @@ -67,7 +67,7 @@ export interface CustomAttributeDefinition { * The timestamp that indicates when the custom attribute definition was created or most recently updated, * in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The timestamp that indicates when the custom attribute definition was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; } diff --git a/src/api/types/CustomAttributeDefinitionEventData.ts b/src/api/types/CustomAttributeDefinitionEventData.ts index d128a0008..3b1b3e64f 100644 --- a/src/api/types/CustomAttributeDefinitionEventData.ts +++ b/src/api/types/CustomAttributeDefinitionEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an object in the CustomAttributeDefinition event notification diff --git a/src/api/types/CustomAttributeDefinitionEventDataObject.ts b/src/api/types/CustomAttributeDefinitionEventDataObject.ts index 597e74c37..db48a3588 100644 --- a/src/api/types/CustomAttributeDefinitionEventDataObject.ts +++ b/src/api/types/CustomAttributeDefinitionEventDataObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CustomAttributeDefinitionEventDataObject { /** The custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: Square.CustomAttributeDefinition; } diff --git a/src/api/types/CustomAttributeEventData.ts b/src/api/types/CustomAttributeEventData.ts index ff4eba0ac..93c079f43 100644 --- a/src/api/types/CustomAttributeEventData.ts +++ b/src/api/types/CustomAttributeEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CustomAttributeEventData { /** The type of the event data object. The value is `"custom_attribute"`. */ diff --git a/src/api/types/CustomAttributeEventDataObject.ts b/src/api/types/CustomAttributeEventDataObject.ts index fe08aa765..dcc694597 100644 --- a/src/api/types/CustomAttributeEventDataObject.ts +++ b/src/api/types/CustomAttributeEventDataObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface CustomAttributeEventDataObject { /** The custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: Square.CustomAttribute; } diff --git a/src/api/types/CustomAttributeFilter.ts b/src/api/types/CustomAttributeFilter.ts index 691eb9f87..806b6360d 100644 --- a/src/api/types/CustomAttributeFilter.ts +++ b/src/api/types/CustomAttributeFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Supported custom attribute query expressions for calling the @@ -15,7 +15,7 @@ export interface CustomAttributeFilter { * `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; + custom_attribute_definition_id?: string | null; /** * A query expression to filter items or item variations by matching their custom attributes' * `key` property value against the specified key. @@ -27,23 +27,23 @@ export interface CustomAttributeFilter { * `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; + string_filter?: 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; + number_filter?: 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; + selection_uids_filter?: 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; + bool_filter?: boolean | null; } diff --git a/src/api/types/Customer.ts b/src/api/types/Customer.ts index 9bf3d84b5..d8a414cb6 100644 --- a/src/api/types/Customer.ts +++ b/src/api/types/Customer.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a Square customer profile in the Customer Directory of a Square seller. @@ -16,23 +16,23 @@ export interface Customer { */ id?: string; /** The timestamp when the customer profile was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the customer profile was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The given name (that is, the first name) associated with the customer profile. */ - givenName?: string | null; + given_name?: string | null; /** The family name (that is, the last name) associated with the customer profile. */ - familyName?: string | null; + family_name?: string | null; /** A nickname for the customer profile. */ nickname?: string | null; /** A business name associated with the customer profile. */ - companyName?: string | null; + company_name?: string | null; /** The email address associated with the customer profile. */ - emailAddress?: string | null; + email_address?: string | null; /** The physical address associated with the customer profile. */ address?: Square.Address; /** The phone number associated with the customer profile. */ - phoneNumber?: string | null; + phone_number?: 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). @@ -42,7 +42,7 @@ export interface Customer { * An optional second ID used to associate the customer profile with an * entity in another system. */ - referenceId?: string | null; + reference_id?: string | null; /** A custom note associated with the customer profile. */ note?: string | null; /** Represents general customer preferences. */ @@ -51,16 +51,16 @@ export interface Customer { * The method used to create the customer profile. * See [CustomerCreationSource](#type-customercreationsource) for possible values */ - creationSource?: Square.CustomerCreationSource; + creation_source?: Square.CustomerCreationSource; /** The IDs of [customer groups](entity:CustomerGroup) the customer belongs to. */ - groupIds?: string[] | null; + group_ids?: string[] | null; /** The IDs of [customer segments](entity:CustomerSegment) the customer belongs to. */ - segmentIds?: string[] | null; + segment_ids?: 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; + version?: number | 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; + tax_ids?: Square.CustomerTaxIds; } diff --git a/src/api/types/CustomerAddressFilter.ts b/src/api/types/CustomerAddressFilter.ts index 174856341..c18dd61da 100644 --- a/src/api/types/CustomerAddressFilter.ts +++ b/src/api/types/CustomerAddressFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](entity:CustomerCustomAttributeFilterValue) filter when @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface CustomerAddressFilter { /** The postal code to search for. Only an `exact` match is supported. */ - postalCode?: Square.CustomerTextFilter; + postal_code?: Square.CustomerTextFilter; /** * The country code to search for. * See [Country](#type-country) for possible values diff --git a/src/api/types/CustomerCreatedEvent.ts b/src/api/types/CustomerCreatedEvent.ts index d990529e3..4e48221c7 100644 --- a/src/api/types/CustomerCreatedEvent.ts +++ b/src/api/types/CustomerCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [customer](entity:Customer) is created. Subscribe to this event to track customer profiles affected by a merge operation. @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface CustomerCreatedEvent { /** The ID of the seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this object, the value is `customer.created`. */ type?: string | null; /** The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomerCreatedEventData; } diff --git a/src/api/types/CustomerCreatedEventData.ts b/src/api/types/CustomerCreatedEventData.ts index b5462a273..f3a8aec48 100644 --- a/src/api/types/CustomerCreatedEventData.ts +++ b/src/api/types/CustomerCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with the event. diff --git a/src/api/types/CustomerCreatedEventEventContext.ts b/src/api/types/CustomerCreatedEventEventContext.ts index cffb661e6..d1a1099b3 100644 --- a/src/api/types/CustomerCreatedEventEventContext.ts +++ b/src/api/types/CustomerCreatedEventEventContext.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Information about the change that triggered the event. diff --git a/src/api/types/CustomerCreatedEventEventContextMerge.ts b/src/api/types/CustomerCreatedEventEventContextMerge.ts index 2fc291518..c26f228f0 100644 --- a/src/api/types/CustomerCreatedEventEventContextMerge.ts +++ b/src/api/types/CustomerCreatedEventEventContextMerge.ts @@ -7,7 +7,7 @@ */ export interface CustomerCreatedEventEventContextMerge { /** The IDs of the existing customers that were merged and then deleted. */ - fromCustomerIds?: string[] | null; + from_customer_ids?: string[] | null; /** The ID of the new customer created by the merge. */ - toCustomerId?: string | null; + to_customer_id?: string | null; } diff --git a/src/api/types/CustomerCreatedEventObject.ts b/src/api/types/CustomerCreatedEventObject.ts index 123408329..00d481e52 100644 --- a/src/api/types/CustomerCreatedEventObject.ts +++ b/src/api/types/CustomerCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the customer associated with the event. @@ -11,5 +11,5 @@ export interface CustomerCreatedEventObject { /** The new customer. */ customer?: Square.Customer; /** Information about the change that triggered the event. This field is returned only if the customer is created by a merge operation. */ - eventContext?: Square.CustomerCreatedEventEventContext; + event_context?: Square.CustomerCreatedEventEventContext; } diff --git a/src/api/types/CustomerCreationSourceFilter.ts b/src/api/types/CustomerCreationSourceFilter.ts index 01d0be76c..bfb512c4f 100644 --- a/src/api/types/CustomerCreationSourceFilter.ts +++ b/src/api/types/CustomerCreationSourceFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The creation source filter. diff --git a/src/api/types/CustomerCustomAttributeDefinitionCreatedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionCreatedEvent.ts index b7d19dab5..1850f88c8 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionCreatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -13,13 +13,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionCreatedPublicEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionCreatedPublicEvent.ts index e1226f9d7..c73d5f41b 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionCreatedPublicEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionCreatedPublicEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -15,13 +15,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionCreatedPublicEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.public.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionDeletedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionDeletedEvent.ts index 58b5c9d58..bd4e8e702 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionDeletedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -14,13 +14,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionDeletedPublicEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionDeletedPublicEvent.ts index 3b1c5fc47..5f01ebf5d 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionDeletedPublicEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionDeletedPublicEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -15,13 +15,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionDeletedPublicEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.public.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionOwnedCreatedEvent.ts index 4bdd8bdfa..b2abdb5a1 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionOwnedCreatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionOwnedCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -10,13 +10,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionOwnedCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.owned.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionOwnedDeletedEvent.ts index 485f48e57..a1852fb84 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionOwnedDeletedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionOwnedUpdatedEvent.ts index 72cf63c0c..d666ef00c 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionUpdatedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionUpdatedEvent.ts index d5fd169b3..275848646 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionUpdatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -14,13 +14,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionUpdatedPublicEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionUpdatedPublicEvent.ts index b457074b0..41657350a 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionUpdatedPublicEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionUpdatedPublicEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -15,13 +15,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionUpdatedPublicEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.public.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionVisibleCreatedEvent.ts index a5c4e8a57..514761395 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionVisibleCreatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionVisibleCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionVisibleCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.visible.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionVisibleDeletedEvent.ts index 9f69e1548..7b7d71a15 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionVisibleDeletedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -13,13 +13,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/api/types/CustomerCustomAttributeDefinitionVisibleUpdatedEvent.ts index 0f6ca331c..4972b0a1f 100644 --- a/src/api/types/CustomerCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDefinitionVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) @@ -13,13 +13,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDefinitionVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute_definition.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/CustomerCustomAttributeDeletedEvent.ts b/src/api/types/CustomerCustomAttributeDeletedEvent.ts index 67472d51f..032aa3c8a 100644 --- a/src/api/types/CustomerCustomAttributeDeletedEvent.ts +++ b/src/api/types/CustomerCustomAttributeDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) owned by the @@ -15,13 +15,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerCustomAttributeDeletedPublicEvent.ts b/src/api/types/CustomerCustomAttributeDeletedPublicEvent.ts index 905861835..8d562acc5 100644 --- a/src/api/types/CustomerCustomAttributeDeletedPublicEvent.ts +++ b/src/api/types/CustomerCustomAttributeDeletedPublicEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) that is visible @@ -15,13 +15,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeDeletedPublicEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.public.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerCustomAttributeFilter.ts b/src/api/types/CustomerCustomAttributeFilter.ts index 0d2b2ddc7..ae3aec649 100644 --- a/src/api/types/CustomerCustomAttributeFilter.ts +++ b/src/api/types/CustomerCustomAttributeFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The custom attribute filter. Use this filter in a set of [custom attribute filters](entity:CustomerCustomAttributeFilters) to search @@ -28,5 +28,5 @@ export interface CustomerCustomAttributeFilter { * * You must provide this `updated_at` field, the `filter` field, or both. */ - updatedAt?: Square.TimeRange; + updated_at?: Square.TimeRange; } diff --git a/src/api/types/CustomerCustomAttributeFilterValue.ts b/src/api/types/CustomerCustomAttributeFilterValue.ts index 25df2dfb4..344dffdb3 100644 --- a/src/api/types/CustomerCustomAttributeFilterValue.ts +++ b/src/api/types/CustomerCustomAttributeFilterValue.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A type-specific filter used in a [custom attribute filter](entity:CustomerCustomAttributeFilter) to search based on the value diff --git a/src/api/types/CustomerCustomAttributeFilters.ts b/src/api/types/CustomerCustomAttributeFilters.ts index bc9ac3f27..a964fa5ab 100644 --- a/src/api/types/CustomerCustomAttributeFilters.ts +++ b/src/api/types/CustomerCustomAttributeFilters.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The custom attribute filters in a set of [customer filters](entity:CustomerFilter) used in a search query. Use this filter diff --git a/src/api/types/CustomerCustomAttributeOwnedDeletedEvent.ts b/src/api/types/CustomerCustomAttributeOwnedDeletedEvent.ts index e2d18f053..0f074660f 100644 --- a/src/api/types/CustomerCustomAttributeOwnedDeletedEvent.ts +++ b/src/api/types/CustomerCustomAttributeOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) owned by the @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerCustomAttributeOwnedUpdatedEvent.ts b/src/api/types/CustomerCustomAttributeOwnedUpdatedEvent.ts index 307c5c9d7..c91a113a5 100644 --- a/src/api/types/CustomerCustomAttributeOwnedUpdatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) owned by the @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerCustomAttributeUpdatedEvent.ts b/src/api/types/CustomerCustomAttributeUpdatedEvent.ts index d426f098f..f489b3945 100644 --- a/src/api/types/CustomerCustomAttributeUpdatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) owned by the @@ -15,13 +15,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerCustomAttributeUpdatedPublicEvent.ts b/src/api/types/CustomerCustomAttributeUpdatedPublicEvent.ts index c4f4819e3..34d873efe 100644 --- a/src/api/types/CustomerCustomAttributeUpdatedPublicEvent.ts +++ b/src/api/types/CustomerCustomAttributeUpdatedPublicEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) that is visible @@ -15,13 +15,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeUpdatedPublicEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.public.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerCustomAttributeVisibleDeletedEvent.ts b/src/api/types/CustomerCustomAttributeVisibleDeletedEvent.ts index 1a12c2c3d..a2445937c 100644 --- a/src/api/types/CustomerCustomAttributeVisibleDeletedEvent.ts +++ b/src/api/types/CustomerCustomAttributeVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the @@ -17,13 +17,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerCustomAttributeVisibleUpdatedEvent.ts b/src/api/types/CustomerCustomAttributeVisibleUpdatedEvent.ts index 151a94dac..52ca10071 100644 --- a/src/api/types/CustomerCustomAttributeVisibleUpdatedEvent.ts +++ b/src/api/types/CustomerCustomAttributeVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the @@ -17,13 +17,13 @@ import * as Square from "../index"; */ export interface CustomerCustomAttributeVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"customer.custom_attribute.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/CustomerDeletedEvent.ts b/src/api/types/CustomerDeletedEvent.ts index 6b4f4a606..a7912f5a5 100644 --- a/src/api/types/CustomerDeletedEvent.ts +++ b/src/api/types/CustomerDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [customer](entity:Customer) is deleted. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface CustomerDeletedEvent { /** The ID of the seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this object, the value is `customer.deleted`. */ type?: string | null; /** The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomerDeletedEventData; } diff --git a/src/api/types/CustomerDeletedEventData.ts b/src/api/types/CustomerDeletedEventData.ts index 6f163c33e..b10a5d859 100644 --- a/src/api/types/CustomerDeletedEventData.ts +++ b/src/api/types/CustomerDeletedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with the event. diff --git a/src/api/types/CustomerDeletedEventEventContext.ts b/src/api/types/CustomerDeletedEventEventContext.ts index e9dc77218..ac0c87a90 100644 --- a/src/api/types/CustomerDeletedEventEventContext.ts +++ b/src/api/types/CustomerDeletedEventEventContext.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Information about the change that triggered the event. diff --git a/src/api/types/CustomerDeletedEventEventContextMerge.ts b/src/api/types/CustomerDeletedEventEventContextMerge.ts index edab8c7f9..194bc54aa 100644 --- a/src/api/types/CustomerDeletedEventEventContextMerge.ts +++ b/src/api/types/CustomerDeletedEventEventContextMerge.ts @@ -7,7 +7,7 @@ */ export interface CustomerDeletedEventEventContextMerge { /** The IDs of the existing customers that were merged and then deleted. */ - fromCustomerIds?: string[] | null; + from_customer_ids?: string[] | null; /** The ID of the new customer created by the merge. */ - toCustomerId?: string | null; + to_customer_id?: string | null; } diff --git a/src/api/types/CustomerDeletedEventObject.ts b/src/api/types/CustomerDeletedEventObject.ts index 1e347011a..067f25c11 100644 --- a/src/api/types/CustomerDeletedEventObject.ts +++ b/src/api/types/CustomerDeletedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the customer associated with the event. @@ -11,5 +11,5 @@ export interface CustomerDeletedEventObject { /** The deleted customer. */ customer?: Square.Customer; /** Information about the change that triggered the event. This field is returned only if the customer is deleted by a merge operation. */ - eventContext?: Square.CustomerDeletedEventEventContext; + event_context?: Square.CustomerDeletedEventEventContext; } diff --git a/src/api/types/CustomerDetails.ts b/src/api/types/CustomerDetails.ts index 6ffb58fd6..c472791ef 100644 --- a/src/api/types/CustomerDetails.ts +++ b/src/api/types/CustomerDetails.ts @@ -7,10 +7,10 @@ */ export interface CustomerDetails { /** Indicates whether the customer initiated the payment. */ - customerInitiated?: boolean | null; + customer_initiated?: 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; + seller_keyed_in?: boolean | null; } diff --git a/src/api/types/CustomerFilter.ts b/src/api/types/CustomerFilter.ts index c7546e024..adb1a8088 100644 --- a/src/api/types/CustomerFilter.ts +++ b/src/api/types/CustomerFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the filtering criteria in a [search query](entity:CustomerQuery) that defines how to filter @@ -10,11 +10,11 @@ import * as Square from "../index"; */ export interface CustomerFilter { /** A filter to select customers based on their creation source. */ - creationSource?: Square.CustomerCreationSourceFilter; + creation_source?: Square.CustomerCreationSourceFilter; /** A filter to select customers based on when they were created. */ - createdAt?: Square.TimeRange; + created_at?: Square.TimeRange; /** A filter to select customers based on when they were last updated. */ - updatedAt?: Square.TimeRange; + updated_at?: 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. @@ -35,7 +35,7 @@ export interface CustomerFilter { * found if a tokenized email address contains all the tokens in the search query, * irrespective of the token order. */ - emailAddress?: Square.CustomerTextFilter; + email_address?: 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. @@ -52,7 +52,7 @@ export interface CustomerFilter { * 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; + phone_number?: 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. @@ -69,7 +69,7 @@ export interface CustomerFilter { * 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; + reference_id?: Square.CustomerTextFilter; /** * A filter to select customers based on the [groups](entity:CustomerGroup) they belong to. * Group membership is controlled by sellers and developers. @@ -91,7 +91,7 @@ export interface CustomerFilter { * 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; + group_ids?: 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 @@ -104,7 +104,7 @@ export interface CustomerFilter { * 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; + custom_attribute?: 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. @@ -122,5 +122,5 @@ export interface CustomerFilter { * 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; + segment_ids?: Square.FilterValue; } diff --git a/src/api/types/CustomerGroup.ts b/src/api/types/CustomerGroup.ts index d7d65b7fa..4138398f4 100644 --- a/src/api/types/CustomerGroup.ts +++ b/src/api/types/CustomerGroup.ts @@ -14,7 +14,7 @@ export interface CustomerGroup { /** The name of the customer group. */ name: string; /** The timestamp when the customer group was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the customer group was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/CustomerPreferences.ts b/src/api/types/CustomerPreferences.ts index 2d50d372d..c50a4a497 100644 --- a/src/api/types/CustomerPreferences.ts +++ b/src/api/types/CustomerPreferences.ts @@ -7,5 +7,5 @@ */ 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; + email_unsubscribed?: boolean | null; } diff --git a/src/api/types/CustomerQuery.ts b/src/api/types/CustomerQuery.ts index 0cfacb26e..1baa5a502 100644 --- a/src/api/types/CustomerQuery.ts +++ b/src/api/types/CustomerQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents filtering and sorting criteria for a [SearchCustomers](api-endpoint:Customers-SearchCustomers) request. diff --git a/src/api/types/CustomerSegment.ts b/src/api/types/CustomerSegment.ts index 6137a846b..f1d6435c1 100644 --- a/src/api/types/CustomerSegment.ts +++ b/src/api/types/CustomerSegment.ts @@ -14,7 +14,7 @@ export interface CustomerSegment { /** The name of the segment. */ name?: string; /** The timestamp when the segment was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the segment was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/CustomerSort.ts b/src/api/types/CustomerSort.ts index 31fe8860b..0fe9c2993 100644 --- a/src/api/types/CustomerSort.ts +++ b/src/api/types/CustomerSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the sorting criteria in a [search query](entity:CustomerQuery) that defines how to sort diff --git a/src/api/types/CustomerTaxIds.ts b/src/api/types/CustomerTaxIds.ts index 93daf9e65..adf6e522b 100644 --- a/src/api/types/CustomerTaxIds.ts +++ b/src/api/types/CustomerTaxIds.ts @@ -8,5 +8,5 @@ */ export interface CustomerTaxIds { /** The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only. */ - euVat?: string | null; + eu_vat?: string | null; } diff --git a/src/api/types/CustomerUpdatedEvent.ts b/src/api/types/CustomerUpdatedEvent.ts index 9bbb4aa96..ed7befd3e 100644 --- a/src/api/types/CustomerUpdatedEvent.ts +++ b/src/api/types/CustomerUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [customer](entity:Customer) is updated. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface CustomerUpdatedEvent { /** The ID of the seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this object, the value is `customer.updated`. */ type?: string | null; /** The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomerUpdatedEventData; } diff --git a/src/api/types/CustomerUpdatedEventData.ts b/src/api/types/CustomerUpdatedEventData.ts index 143415a30..1e65bf857 100644 --- a/src/api/types/CustomerUpdatedEventData.ts +++ b/src/api/types/CustomerUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with the event. diff --git a/src/api/types/CustomerUpdatedEventObject.ts b/src/api/types/CustomerUpdatedEventObject.ts index 666d5fa91..bf9e9f732 100644 --- a/src/api/types/CustomerUpdatedEventObject.ts +++ b/src/api/types/CustomerUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the customer associated with the event. diff --git a/src/api/types/DataCollectionOptions.ts b/src/api/types/DataCollectionOptions.ts index c9fb89b7a..9b9166850 100644 --- a/src/api/types/DataCollectionOptions.ts +++ b/src/api/types/DataCollectionOptions.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DataCollectionOptions { /** The title text to display in the data collection flow on the Terminal. */ @@ -16,7 +16,7 @@ export interface DataCollectionOptions { * Represents the type of the input text. * See [InputType](#type-inputtype) for possible values */ - inputType: Square.DataCollectionOptionsInputType; + input_type: Square.DataCollectionOptionsInputType; /** The buyer’s input text from the data collection screen. */ - collectedData?: Square.CollectedData; + collected_data?: Square.CollectedData; } diff --git a/src/api/types/DateRange.ts b/src/api/types/DateRange.ts index d5b5c2a3f..7468f5521 100644 --- a/src/api/types/DateRange.ts +++ b/src/api/types/DateRange.ts @@ -12,11 +12,11 @@ export interface DateRange { * extended format for calendar dates. * The beginning of a date range (inclusive). */ - startDate?: string | null; + start_date?: 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; + end_date?: string | null; } diff --git a/src/api/types/DeleteBookingCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteBookingCustomAttributeDefinitionResponse.ts index a2aefe00c..dbbcbab05 100644 --- a/src/api/types/DeleteBookingCustomAttributeDefinitionResponse.ts +++ b/src/api/types/DeleteBookingCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [DeleteBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttributeDefinition) response diff --git a/src/api/types/DeleteBookingCustomAttributeResponse.ts b/src/api/types/DeleteBookingCustomAttributeResponse.ts index 57ab7546b..dc549481a 100644 --- a/src/api/types/DeleteBookingCustomAttributeResponse.ts +++ b/src/api/types/DeleteBookingCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [DeleteBookingCustomAttribute](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttribute) response. diff --git a/src/api/types/DeleteBreakTypeResponse.ts b/src/api/types/DeleteBreakTypeResponse.ts index c85ce0eb0..38b287c42 100644 --- a/src/api/types/DeleteBreakTypeResponse.ts +++ b/src/api/types/DeleteBreakTypeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to delete a `BreakType`. The response might contain a set diff --git a/src/api/types/DeleteCatalogObjectResponse.ts b/src/api/types/DeleteCatalogObjectResponse.ts index 734606657..569df3847 100644 --- a/src/api/types/DeleteCatalogObjectResponse.ts +++ b/src/api/types/DeleteCatalogObjectResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeleteCatalogObjectResponse { /** Any errors that occurred during the request. */ @@ -13,10 +13,10 @@ export interface DeleteCatalogObjectResponse { * a catalog item variation will be deleted (and its ID included in this field) * when its parent catalog item is deleted. */ - deletedObjectIds?: string[]; + deleted_object_ids?: 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; + deleted_at?: string; } diff --git a/src/api/types/DeleteCustomerCardResponse.ts b/src/api/types/DeleteCustomerCardResponse.ts index a5fcc3f81..d134c022a 100644 --- a/src/api/types/DeleteCustomerCardResponse.ts +++ b/src/api/types/DeleteCustomerCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/DeleteCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteCustomerCustomAttributeDefinitionResponse.ts index 66a5ca47b..4a3f0efe4 100644 --- a/src/api/types/DeleteCustomerCustomAttributeDefinitionResponse.ts +++ b/src/api/types/DeleteCustomerCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from a delete request containing error messages if there are any. diff --git a/src/api/types/DeleteCustomerCustomAttributeResponse.ts b/src/api/types/DeleteCustomerCustomAttributeResponse.ts index c4bdba587..268f01351 100644 --- a/src/api/types/DeleteCustomerCustomAttributeResponse.ts +++ b/src/api/types/DeleteCustomerCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [DeleteCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttribute) response. diff --git a/src/api/types/DeleteCustomerGroupResponse.ts b/src/api/types/DeleteCustomerGroupResponse.ts index 2a78946f7..f3d7bba5c 100644 --- a/src/api/types/DeleteCustomerGroupResponse.ts +++ b/src/api/types/DeleteCustomerGroupResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/DeleteCustomerResponse.ts b/src/api/types/DeleteCustomerResponse.ts index 225fa47cf..41f129cb4 100644 --- a/src/api/types/DeleteCustomerResponse.ts +++ b/src/api/types/DeleteCustomerResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/DeleteDisputeEvidenceResponse.ts b/src/api/types/DeleteDisputeEvidenceResponse.ts index a13499b2b..b9977fa0b 100644 --- a/src/api/types/DeleteDisputeEvidenceResponse.ts +++ b/src/api/types/DeleteDisputeEvidenceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields in a `DeleteDisputeEvidence` response. diff --git a/src/api/types/DeleteInvoiceAttachmentResponse.ts b/src/api/types/DeleteInvoiceAttachmentResponse.ts index adc386aaa..22c3a54e5 100644 --- a/src/api/types/DeleteInvoiceAttachmentResponse.ts +++ b/src/api/types/DeleteInvoiceAttachmentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) response. diff --git a/src/api/types/DeleteInvoiceResponse.ts b/src/api/types/DeleteInvoiceResponse.ts index f4a336074..d429447b4 100644 --- a/src/api/types/DeleteInvoiceResponse.ts +++ b/src/api/types/DeleteInvoiceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a `DeleteInvoice` response. diff --git a/src/api/types/DeleteLocationCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteLocationCustomAttributeDefinitionResponse.ts index 35143f1d1..07f864d88 100644 --- a/src/api/types/DeleteLocationCustomAttributeDefinitionResponse.ts +++ b/src/api/types/DeleteLocationCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from a delete request containing error messages if there are any. diff --git a/src/api/types/DeleteLocationCustomAttributeResponse.ts b/src/api/types/DeleteLocationCustomAttributeResponse.ts index e5f09f379..4d83b1ad4 100644 --- a/src/api/types/DeleteLocationCustomAttributeResponse.ts +++ b/src/api/types/DeleteLocationCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [DeleteLocationCustomAttribute](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttribute) response. diff --git a/src/api/types/DeleteLoyaltyRewardResponse.ts b/src/api/types/DeleteLoyaltyRewardResponse.ts index f53e6ca05..e53697f4d 100644 --- a/src/api/types/DeleteLoyaltyRewardResponse.ts +++ b/src/api/types/DeleteLoyaltyRewardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response returned by the API call. diff --git a/src/api/types/DeleteMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteMerchantCustomAttributeDefinitionResponse.ts index 76deacfa0..88d866ee0 100644 --- a/src/api/types/DeleteMerchantCustomAttributeDefinitionResponse.ts +++ b/src/api/types/DeleteMerchantCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from a delete request containing error messages if there are any. diff --git a/src/api/types/DeleteMerchantCustomAttributeResponse.ts b/src/api/types/DeleteMerchantCustomAttributeResponse.ts index d878ba548..c920700f5 100644 --- a/src/api/types/DeleteMerchantCustomAttributeResponse.ts +++ b/src/api/types/DeleteMerchantCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [DeleteMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttribute) response. diff --git a/src/api/types/DeleteOrderCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteOrderCustomAttributeDefinitionResponse.ts index 7f1d85972..214dbf80e 100644 --- a/src/api/types/DeleteOrderCustomAttributeDefinitionResponse.ts +++ b/src/api/types/DeleteOrderCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from deleting an order custom attribute definition. diff --git a/src/api/types/DeleteOrderCustomAttributeResponse.ts b/src/api/types/DeleteOrderCustomAttributeResponse.ts index 2f1d498b6..27847abe5 100644 --- a/src/api/types/DeleteOrderCustomAttributeResponse.ts +++ b/src/api/types/DeleteOrderCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from deleting an order custom attribute. diff --git a/src/api/types/DeletePaymentLinkResponse.ts b/src/api/types/DeletePaymentLinkResponse.ts index 6aef5e3e4..5d8a8ded3 100644 --- a/src/api/types/DeletePaymentLinkResponse.ts +++ b/src/api/types/DeletePaymentLinkResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeletePaymentLinkResponse { errors?: Square.Error_[]; @@ -12,5 +12,5 @@ export interface DeletePaymentLinkResponse { * 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; + cancelled_order_id?: string; } diff --git a/src/api/types/DeleteShiftResponse.ts b/src/api/types/DeleteShiftResponse.ts index 8c7b76899..53f4d1126 100644 --- a/src/api/types/DeleteShiftResponse.ts +++ b/src/api/types/DeleteShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to delete a `Shift`. The response might contain a set of diff --git a/src/api/types/DeleteSnippetResponse.ts b/src/api/types/DeleteSnippetResponse.ts index 2a768b803..1fd3e0ef9 100644 --- a/src/api/types/DeleteSnippetResponse.ts +++ b/src/api/types/DeleteSnippetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a `DeleteSnippet` response. diff --git a/src/api/types/DeleteSubscriptionActionResponse.ts b/src/api/types/DeleteSubscriptionActionResponse.ts index 5adb33949..b0ae6c22a 100644 --- a/src/api/types/DeleteSubscriptionActionResponse.ts +++ b/src/api/types/DeleteSubscriptionActionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response of the [DeleteSubscriptionAction](api-endpoint:Subscriptions-DeleteSubscriptionAction) diff --git a/src/api/types/DeleteTimecardResponse.ts b/src/api/types/DeleteTimecardResponse.ts index 6f2ff565b..9a951051c 100644 --- a/src/api/types/DeleteTimecardResponse.ts +++ b/src/api/types/DeleteTimecardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to delete a `Timecard`. The response might contain a set of diff --git a/src/api/types/DeleteWebhookSubscriptionResponse.ts b/src/api/types/DeleteWebhookSubscriptionResponse.ts index 5fd49d18f..0b710d84f 100644 --- a/src/api/types/DeleteWebhookSubscriptionResponse.ts +++ b/src/api/types/DeleteWebhookSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/Destination.ts b/src/api/types/Destination.ts index c677acd36..3b63cd41f 100644 --- a/src/api/types/Destination.ts +++ b/src/api/types/Destination.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Information about the destination against which the payout was made. diff --git a/src/api/types/DestinationDetails.ts b/src/api/types/DestinationDetails.ts index 5cdc3ccc7..4f0016ead 100644 --- a/src/api/types/DestinationDetails.ts +++ b/src/api/types/DestinationDetails.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + card_details?: Square.DestinationDetailsCardRefundDetails; /** Details about a cash refund. Only populated if the destination_type is `CASH`. */ - cashDetails?: Square.DestinationDetailsCashRefundDetails; + cash_details?: Square.DestinationDetailsCashRefundDetails; /** Details about an external refund. Only populated if the destination_type is `EXTERNAL`. */ - externalDetails?: Square.DestinationDetailsExternalRefundDetails; + external_details?: Square.DestinationDetailsExternalRefundDetails; } diff --git a/src/api/types/DestinationDetailsCardRefundDetails.ts b/src/api/types/DestinationDetailsCardRefundDetails.ts index dbeddd7e1..ad402d918 100644 --- a/src/api/types/DestinationDetailsCardRefundDetails.ts +++ b/src/api/types/DestinationDetailsCardRefundDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DestinationDetailsCardRefundDetails { /** The card's non-confidential details. */ @@ -11,7 +11,7 @@ export interface DestinationDetailsCardRefundDetails { * 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; + entry_method?: string | null; /** The authorization code provided by the issuer when a refund is approved. */ - authResultCode?: string | null; + auth_result_code?: string | null; } diff --git a/src/api/types/DestinationDetailsCashRefundDetails.ts b/src/api/types/DestinationDetailsCashRefundDetails.ts index c88e91e58..f3a6ea0d4 100644 --- a/src/api/types/DestinationDetailsCashRefundDetails.ts +++ b/src/api/types/DestinationDetailsCashRefundDetails.ts @@ -2,18 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + seller_supplied_money: 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; + change_back_money?: Square.Money; } diff --git a/src/api/types/DestinationDetailsExternalRefundDetails.ts b/src/api/types/DestinationDetailsExternalRefundDetails.ts index 1ebbbb2a8..e454fb01c 100644 --- a/src/api/types/DestinationDetailsExternalRefundDetails.ts +++ b/src/api/types/DestinationDetailsExternalRefundDetails.ts @@ -29,5 +29,5 @@ export interface DestinationDetailsExternalRefundDetails { */ source: string; /** An ID to associate the refund to its originating source. */ - sourceId?: string | null; + source_id?: string | null; } diff --git a/src/api/types/Device.ts b/src/api/types/Device.ts index 45d8ea2e0..e8093221d 100644 --- a/src/api/types/Device.ts +++ b/src/api/types/Device.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface Device { /** diff --git a/src/api/types/DeviceAttributes.ts b/src/api/types/DeviceAttributes.ts index 8c76e3e37..7111aced3 100644 --- a/src/api/types/DeviceAttributes.ts +++ b/src/api/types/DeviceAttributes.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceAttributes { /** @@ -20,14 +20,14 @@ export interface DeviceAttributes { * The manufacturer-supplied identifier for the device (where available). In many cases, * this identifier will be a serial number. */ - manufacturersId?: string | null; + manufacturers_id?: 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; + updated_at?: string; /** The current version of software installed on the device. */ version?: string; /** The merchant_token identifying the merchant controlling the device. */ - merchantToken?: string | null; + merchant_token?: string | null; } diff --git a/src/api/types/DeviceCheckoutOptions.ts b/src/api/types/DeviceCheckoutOptions.ts index 98d96f543..46daa73ca 100644 --- a/src/api/types/DeviceCheckoutOptions.ts +++ b/src/api/types/DeviceCheckoutOptions.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceCheckoutOptions { /** @@ -10,16 +10,16 @@ export interface DeviceCheckoutOptions { * 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; + device_id: string; /** Instructs the device to skip the receipt screen. Defaults to false. */ - skipReceiptScreen?: boolean | null; + skip_receipt_screen?: boolean | null; /** Indicates that signature collection is desired during checkout. Defaults to false. */ - collectSignature?: boolean | null; + collect_signature?: boolean | null; /** Tip-specific settings. */ - tipSettings?: Square.TipSettings; + tip_settings?: 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; + show_itemized_cart?: boolean | null; } diff --git a/src/api/types/DeviceCode.ts b/src/api/types/DeviceCode.ts index e762c9166..f8750f347 100644 --- a/src/api/types/DeviceCode.ts +++ b/src/api/types/DeviceCode.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceCode { /** The unique id for this device code. */ @@ -12,22 +12,22 @@ export interface DeviceCode { /** 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; + device_id?: string; /** The targeting product type of the device code. */ - productType: Square.ProductType; + product_type: Square.ProductType; /** The location assigned to this code. */ - locationId?: string | null; + location_id?: 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; + pair_by?: string; /** When this DeviceCode was created. Timestamp in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** When this DeviceCode's status was last changed. Timestamp in RFC 3339 format. */ - statusChangedAt?: string; + status_changed_at?: string; /** When this DeviceCode was paired. Timestamp in RFC 3339 format. */ - pairedAt?: string; + paired_at?: string; } diff --git a/src/api/types/DeviceCodePairedEvent.ts b/src/api/types/DeviceCodePairedEvent.ts index df8d3398d..c1213545a 100644 --- a/src/api/types/DeviceCodePairedEvent.ts +++ b/src/api/types/DeviceCodePairedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Square Terminal has been paired with a @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface DeviceCodePairedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"device.code.paired"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DeviceCodePairedEventData; } diff --git a/src/api/types/DeviceCodePairedEventData.ts b/src/api/types/DeviceCodePairedEventData.ts index a310beca5..0be07177b 100644 --- a/src/api/types/DeviceCodePairedEventData.ts +++ b/src/api/types/DeviceCodePairedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceCodePairedEventData { /** Name of the paired object’s type, `"device_code"`. */ diff --git a/src/api/types/DeviceCodePairedEventObject.ts b/src/api/types/DeviceCodePairedEventObject.ts index e634cc245..71503803a 100644 --- a/src/api/types/DeviceCodePairedEventObject.ts +++ b/src/api/types/DeviceCodePairedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceCodePairedEventObject { /** The created terminal checkout */ - deviceCode?: Square.DeviceCode; + device_code?: Square.DeviceCode; } diff --git a/src/api/types/DeviceComponentDetailsApplicationDetails.ts b/src/api/types/DeviceComponentDetailsApplicationDetails.ts index f514f19aa..a46def6fd 100644 --- a/src/api/types/DeviceComponentDetailsApplicationDetails.ts +++ b/src/api/types/DeviceComponentDetailsApplicationDetails.ts @@ -2,18 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceComponentDetailsApplicationDetails { /** * The type of application. * See [ApplicationType](#type-applicationtype) for possible values */ - applicationType?: Square.ApplicationType; + application_type?: Square.ApplicationType; /** The version of the application. */ version?: string; /** The location_id of the session for the application. */ - sessionLocation?: string | null; + session_location?: string | null; /** The id of the device code that was used to log in to the device. */ - deviceCodeId?: string | null; + device_code_id?: string | null; } diff --git a/src/api/types/DeviceComponentDetailsBatteryDetails.ts b/src/api/types/DeviceComponentDetailsBatteryDetails.ts index 3484279ff..5f429e1f0 100644 --- a/src/api/types/DeviceComponentDetailsBatteryDetails.ts +++ b/src/api/types/DeviceComponentDetailsBatteryDetails.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceComponentDetailsBatteryDetails { /** The battery charge percentage as displayed on the device. */ - visiblePercent?: number | null; + visible_percent?: number | null; /** * The status of external_power. * See [ExternalPower](#type-externalpower) for possible values */ - externalPower?: Square.DeviceComponentDetailsExternalPower; + external_power?: Square.DeviceComponentDetailsExternalPower; } diff --git a/src/api/types/DeviceComponentDetailsEthernetDetails.ts b/src/api/types/DeviceComponentDetailsEthernetDetails.ts index 80069b55e..8f424cdcc 100644 --- a/src/api/types/DeviceComponentDetailsEthernetDetails.ts +++ b/src/api/types/DeviceComponentDetailsEthernetDetails.ts @@ -6,5 +6,5 @@ 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; + ip_address_v4?: string | null; } diff --git a/src/api/types/DeviceComponentDetailsWiFiDetails.ts b/src/api/types/DeviceComponentDetailsWiFiDetails.ts index a4305877f..708af245e 100644 --- a/src/api/types/DeviceComponentDetailsWiFiDetails.ts +++ b/src/api/types/DeviceComponentDetailsWiFiDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceComponentDetailsWiFiDetails { /** A boolean to represent whether the WiFI interface is currently active. */ @@ -10,12 +10,12 @@ export interface DeviceComponentDetailsWiFiDetails { /** The name of the connected WIFI network. */ ssid?: string | null; /** The string representation of the device’s IPv4 address. */ - ipAddressV4?: string | null; + ip_address_v4?: string | null; /** * The security protocol for a secure connection (e.g. WPA2). None provided if the connection * is unsecured. */ - secureConnection?: string | null; + secure_connection?: string | null; /** A representation of signal strength of the WIFI network connection. */ - signalStrength?: Square.DeviceComponentDetailsMeasurement; + signal_strength?: Square.DeviceComponentDetailsMeasurement; } diff --git a/src/api/types/DeviceCreatedEvent.ts b/src/api/types/DeviceCreatedEvent.ts index c84998fe9..dcef1f54a 100644 --- a/src/api/types/DeviceCreatedEvent.ts +++ b/src/api/types/DeviceCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Device is created. */ export interface DeviceCreatedEvent { /** The merchant the newly created device belongs to. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents. The value is `"device.created"`. */ type?: string | null; /** A UUID that uniquely identifies this device creation event. */ - eventId?: string | null; + event_id?: string | null; /** The time when the device creation event was first created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The metadata associated with the device creation event. */ data?: Square.DeviceCreatedEventData; } diff --git a/src/api/types/DeviceCreatedEventData.ts b/src/api/types/DeviceCreatedEventData.ts index e28b29517..c2dee1e9e 100644 --- a/src/api/types/DeviceCreatedEventData.ts +++ b/src/api/types/DeviceCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceCreatedEventData { /** The type of the event data object. The value is `"device"`. */ diff --git a/src/api/types/DeviceCreatedEventObject.ts b/src/api/types/DeviceCreatedEventObject.ts index 849560516..2de575397 100644 --- a/src/api/types/DeviceCreatedEventObject.ts +++ b/src/api/types/DeviceCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceCreatedEventObject { /** The created device. */ diff --git a/src/api/types/DeviceDetails.ts b/src/api/types/DeviceDetails.ts index a2b401bd9..f7df1a6a0 100644 --- a/src/api/types/DeviceDetails.ts +++ b/src/api/types/DeviceDetails.ts @@ -7,9 +7,9 @@ */ export interface DeviceDetails { /** The Square-issued ID of the device. */ - deviceId?: string | null; + device_id?: string | null; /** The Square-issued installation ID for the device. */ - deviceInstallationId?: string | null; + device_installation_id?: string | null; /** The name of the device set by the seller. */ - deviceName?: string | null; + device_name?: string | null; } diff --git a/src/api/types/DeviceMetadata.ts b/src/api/types/DeviceMetadata.ts index 407c6ecc6..c466a97e5 100644 --- a/src/api/types/DeviceMetadata.ts +++ b/src/api/types/DeviceMetadata.ts @@ -4,39 +4,39 @@ export interface DeviceMetadata { /** The Terminal’s remaining battery percentage, between 1-100. */ - batteryPercentage?: string | null; + battery_percentage?: string | null; /** * The current charging state of the Terminal. * Options: `CHARGING`, `NOT_CHARGING` */ - chargingState?: string | null; + charging_state?: string | null; /** The ID of the Square seller business location associated with the Terminal. */ - locationId?: string | null; + location_id?: string | null; /** The ID of the Square merchant account that is currently signed-in to the Terminal. */ - merchantId?: string | null; + merchant_id?: string | null; /** * The Terminal’s current network connection type. * Options: `WIFI`, `ETHERNET` */ - networkConnectionType?: string | null; + network_connection_type?: string | null; /** The country in which the Terminal is authorized to take payments. */ - paymentRegion?: string | null; + payment_region?: string | null; /** * The unique identifier assigned to the Terminal, which can be found on the lower back * of the device. */ - serialNumber?: string | null; + serial_number?: string | null; /** The current version of the Terminal’s operating system. */ - osVersion?: string | null; + os_version?: string | null; /** The current version of the application running on the Terminal. */ - appVersion?: string | null; + app_version?: string | null; /** The name of the Wi-Fi network to which the Terminal is connected. */ - wifiNetworkName?: string | null; + wifi_network_name?: string | null; /** * The signal strength of the Wi-FI network connection. * Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT` */ - wifiNetworkStrength?: string | null; + wifi_network_strength?: string | null; /** The IP address of the Terminal. */ - ipAddress?: string | null; + ip_address?: string | null; } diff --git a/src/api/types/DeviceStatus.ts b/src/api/types/DeviceStatus.ts index 25843c08c..58602ba0d 100644 --- a/src/api/types/DeviceStatus.ts +++ b/src/api/types/DeviceStatus.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DeviceStatus { /** diff --git a/src/api/types/DigitalWalletDetails.ts b/src/api/types/DigitalWalletDetails.ts index d64610a55..f20be3af8 100644 --- a/src/api/types/DigitalWalletDetails.ts +++ b/src/api/types/DigitalWalletDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Additional details about `WALLET` type payments. Contains only non-confidential information. @@ -19,5 +19,5 @@ export interface DigitalWalletDetails { */ brand?: string | null; /** Brand-specific details for payments with the `brand` of `CASH_APP`. */ - cashAppDetails?: Square.CashAppDetails; + cash_app_details?: Square.CashAppDetails; } diff --git a/src/api/types/DisableCardResponse.ts b/src/api/types/DisableCardResponse.ts index 9b9a103db..b0feb6a91 100644 --- a/src/api/types/DisableCardResponse.ts +++ b/src/api/types/DisableCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/DisableEventsResponse.ts b/src/api/types/DisableEventsResponse.ts index 070f3298f..ace957d5d 100644 --- a/src/api/types/DisableEventsResponse.ts +++ b/src/api/types/DisableEventsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/DismissTerminalActionResponse.ts b/src/api/types/DismissTerminalActionResponse.ts index 2eb4d847e..3b1ff77fd 100644 --- a/src/api/types/DismissTerminalActionResponse.ts +++ b/src/api/types/DismissTerminalActionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DismissTerminalActionResponse { /** Information on errors encountered during the request. */ diff --git a/src/api/types/DismissTerminalCheckoutResponse.ts b/src/api/types/DismissTerminalCheckoutResponse.ts index 1cf11b8b8..d8c0e9d1e 100644 --- a/src/api/types/DismissTerminalCheckoutResponse.ts +++ b/src/api/types/DismissTerminalCheckoutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DismissTerminalCheckoutResponse { /** Information on errors encountered during the request. */ diff --git a/src/api/types/DismissTerminalRefundResponse.ts b/src/api/types/DismissTerminalRefundResponse.ts index e79e0f94b..dc6fe44c1 100644 --- a/src/api/types/DismissTerminalRefundResponse.ts +++ b/src/api/types/DismissTerminalRefundResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DismissTerminalRefundResponse { /** Information on errors encountered during the request. */ diff --git a/src/api/types/Dispute.ts b/src/api/types/Dispute.ts index ad6f9f8f9..1174cccaf 100644 --- a/src/api/types/Dispute.ts +++ b/src/api/types/Dispute.ts @@ -2,21 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + dispute_id?: 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; + amount_money?: Square.Money; /** * The reason why the cardholder initiated the dispute. * See [DisputeReason](#type-disputereason) for possible values @@ -28,28 +28,28 @@ export interface Dispute { */ 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; + due_at?: string | null; /** The payment challenged in this dispute. */ - disputedPayment?: Square.DisputedPayment; + disputed_payment?: Square.DisputedPayment; /** The IDs of the evidence associated with the dispute. */ - evidenceIds?: string[] | null; + evidence_ids?: string[] | null; /** * The card brand used in the disputed payment. * See [CardBrand](#type-cardbrand) for possible values */ - cardBrand?: Square.CardBrand; + card_brand?: Square.CardBrand; /** The timestamp when the dispute was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the dispute was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The ID of the dispute in the card brand system, generated by the card brand. */ - brandDisputeId?: string | null; + brand_dispute_id?: string | null; /** The timestamp when the dispute was reported, in RFC 3339 format. */ - reportedDate?: string | null; + reported_date?: string | null; /** The timestamp when the dispute was reported, in RFC 3339 format. */ - reportedAt?: string | null; + reported_at?: string | null; /** The current version of the `Dispute`. */ version?: number; /** The ID of the location where the dispute originated. */ - locationId?: string | null; + location_id?: string | null; } diff --git a/src/api/types/DisputeCreatedEvent.ts b/src/api/types/DisputeCreatedEvent.ts index b9e946c8f..aac53a3b0 100644 --- a/src/api/types/DisputeCreatedEvent.ts +++ b/src/api/types/DisputeCreatedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Dispute](entity:Dispute) is created. */ export interface DisputeCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DisputeCreatedEventData; } diff --git a/src/api/types/DisputeCreatedEventData.ts b/src/api/types/DisputeCreatedEventData.ts index e6f6bf112..ada623683 100644 --- a/src/api/types/DisputeCreatedEventData.ts +++ b/src/api/types/DisputeCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeCreatedEventData { /** Name of the affected dispute's type. */ diff --git a/src/api/types/DisputeCreatedEventObject.ts b/src/api/types/DisputeCreatedEventObject.ts index 1c12a8303..88ffb7efb 100644 --- a/src/api/types/DisputeCreatedEventObject.ts +++ b/src/api/types/DisputeCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeCreatedEventObject { /** The dispute object. */ diff --git a/src/api/types/DisputeEvidence.ts b/src/api/types/DisputeEvidence.ts index 958a24acb..b61f58000 100644 --- a/src/api/types/DisputeEvidence.ts +++ b/src/api/types/DisputeEvidence.ts @@ -2,24 +2,24 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidence { /** The Square-generated ID of the evidence. */ - evidenceId?: string | null; + evidence_id?: string | null; /** The Square-generated ID of the evidence. */ id?: string; /** The ID of the dispute the evidence is associated with. */ - disputeId?: string | null; + dispute_id?: string | null; /** Image, PDF, TXT */ - evidenceFile?: Square.DisputeEvidenceFile; + evidence_file?: Square.DisputeEvidenceFile; /** Raw text */ - evidenceText?: string | null; + evidence_text?: string | null; /** The time when the evidence was uploaded, in RFC 3339 format. */ - uploadedAt?: string | null; + uploaded_at?: string | null; /** * The type of the evidence. * See [DisputeEvidenceType](#type-disputeevidencetype) for possible values */ - evidenceType?: Square.DisputeEvidenceType; + evidence_type?: Square.DisputeEvidenceType; } diff --git a/src/api/types/DisputeEvidenceAddedEvent.ts b/src/api/types/DisputeEvidenceAddedEvent.ts index 895c5c6b4..29f8d3533 100644 --- a/src/api/types/DisputeEvidenceAddedEvent.ts +++ b/src/api/types/DisputeEvidenceAddedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when evidence is added to a [Dispute](entity:Dispute) @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface DisputeEvidenceAddedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DisputeEvidenceAddedEventData; } diff --git a/src/api/types/DisputeEvidenceAddedEventData.ts b/src/api/types/DisputeEvidenceAddedEventData.ts index 5f6b1fe5d..6dd1cfbf9 100644 --- a/src/api/types/DisputeEvidenceAddedEventData.ts +++ b/src/api/types/DisputeEvidenceAddedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceAddedEventData { /** Name of the affected dispute's type. */ diff --git a/src/api/types/DisputeEvidenceAddedEventObject.ts b/src/api/types/DisputeEvidenceAddedEventObject.ts index 08116c916..04b64ca53 100644 --- a/src/api/types/DisputeEvidenceAddedEventObject.ts +++ b/src/api/types/DisputeEvidenceAddedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceAddedEventObject { /** The dispute object. */ diff --git a/src/api/types/DisputeEvidenceCreatedEvent.ts b/src/api/types/DisputeEvidenceCreatedEvent.ts index 7f08581f3..0a90259c3 100644 --- a/src/api/types/DisputeEvidenceCreatedEvent.ts +++ b/src/api/types/DisputeEvidenceCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when evidence is added to a [Dispute](entity:Dispute) @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface DisputeEvidenceCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DisputeEvidenceCreatedEventData; } diff --git a/src/api/types/DisputeEvidenceCreatedEventData.ts b/src/api/types/DisputeEvidenceCreatedEventData.ts index bad96233d..d0662ee73 100644 --- a/src/api/types/DisputeEvidenceCreatedEventData.ts +++ b/src/api/types/DisputeEvidenceCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceCreatedEventData { /** Name of the affected dispute's type. */ diff --git a/src/api/types/DisputeEvidenceCreatedEventObject.ts b/src/api/types/DisputeEvidenceCreatedEventObject.ts index 0255378b7..ab4a7519b 100644 --- a/src/api/types/DisputeEvidenceCreatedEventObject.ts +++ b/src/api/types/DisputeEvidenceCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceCreatedEventObject { /** The dispute object. */ diff --git a/src/api/types/DisputeEvidenceDeletedEvent.ts b/src/api/types/DisputeEvidenceDeletedEvent.ts index 3c178b634..7dbd2512c 100644 --- a/src/api/types/DisputeEvidenceDeletedEvent.ts +++ b/src/api/types/DisputeEvidenceDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when evidence is removed from a [Dispute](entity:Dispute) @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface DisputeEvidenceDeletedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DisputeEvidenceDeletedEventData; } diff --git a/src/api/types/DisputeEvidenceDeletedEventData.ts b/src/api/types/DisputeEvidenceDeletedEventData.ts index d81b1aabf..574ce1331 100644 --- a/src/api/types/DisputeEvidenceDeletedEventData.ts +++ b/src/api/types/DisputeEvidenceDeletedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceDeletedEventData { /** Name of the affected dispute's type. */ diff --git a/src/api/types/DisputeEvidenceDeletedEventObject.ts b/src/api/types/DisputeEvidenceDeletedEventObject.ts index c6c07882e..d61698ea5 100644 --- a/src/api/types/DisputeEvidenceDeletedEventObject.ts +++ b/src/api/types/DisputeEvidenceDeletedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceDeletedEventObject { /** The dispute object. */ diff --git a/src/api/types/DisputeEvidenceRemovedEvent.ts b/src/api/types/DisputeEvidenceRemovedEvent.ts index d4e31851b..b98c38a68 100644 --- a/src/api/types/DisputeEvidenceRemovedEvent.ts +++ b/src/api/types/DisputeEvidenceRemovedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when evidence is removed from a [Dispute](entity:Dispute) @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface DisputeEvidenceRemovedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DisputeEvidenceRemovedEventData; } diff --git a/src/api/types/DisputeEvidenceRemovedEventData.ts b/src/api/types/DisputeEvidenceRemovedEventData.ts index fdbad3646..dcb665f5f 100644 --- a/src/api/types/DisputeEvidenceRemovedEventData.ts +++ b/src/api/types/DisputeEvidenceRemovedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceRemovedEventData { /** Name of the affected dispute's type. */ diff --git a/src/api/types/DisputeEvidenceRemovedEventObject.ts b/src/api/types/DisputeEvidenceRemovedEventObject.ts index 4ad892935..305023d20 100644 --- a/src/api/types/DisputeEvidenceRemovedEventObject.ts +++ b/src/api/types/DisputeEvidenceRemovedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeEvidenceRemovedEventObject { /** The dispute object. */ diff --git a/src/api/types/DisputeStateChangedEvent.ts b/src/api/types/DisputeStateChangedEvent.ts index ed1a0b03b..c9fac4b51 100644 --- a/src/api/types/DisputeStateChangedEvent.ts +++ b/src/api/types/DisputeStateChangedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when the state of a [Dispute](entity:Dispute) changes. @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface DisputeStateChangedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DisputeStateChangedEventData; } diff --git a/src/api/types/DisputeStateChangedEventData.ts b/src/api/types/DisputeStateChangedEventData.ts index dde8e9f45..905bfb6e8 100644 --- a/src/api/types/DisputeStateChangedEventData.ts +++ b/src/api/types/DisputeStateChangedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeStateChangedEventData { /** Name of the affected dispute's type. */ diff --git a/src/api/types/DisputeStateChangedEventObject.ts b/src/api/types/DisputeStateChangedEventObject.ts index 9166ecb26..942e2db66 100644 --- a/src/api/types/DisputeStateChangedEventObject.ts +++ b/src/api/types/DisputeStateChangedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeStateChangedEventObject { /** The dispute object. */ diff --git a/src/api/types/DisputeStateUpdatedEvent.ts b/src/api/types/DisputeStateUpdatedEvent.ts index 2182af2cf..189aff725 100644 --- a/src/api/types/DisputeStateUpdatedEvent.ts +++ b/src/api/types/DisputeStateUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when the state of a [Dispute](entity:Dispute) changes. @@ -11,15 +11,15 @@ import * as Square from "../index"; */ export interface DisputeStateUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.DisputeStateUpdatedEventData; } diff --git a/src/api/types/DisputeStateUpdatedEventData.ts b/src/api/types/DisputeStateUpdatedEventData.ts index 981082463..f608c2c83 100644 --- a/src/api/types/DisputeStateUpdatedEventData.ts +++ b/src/api/types/DisputeStateUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeStateUpdatedEventData { /** Name of the affected dispute's type. */ diff --git a/src/api/types/DisputeStateUpdatedEventObject.ts b/src/api/types/DisputeStateUpdatedEventObject.ts index 12aa43443..3c01a61dc 100644 --- a/src/api/types/DisputeStateUpdatedEventObject.ts +++ b/src/api/types/DisputeStateUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface DisputeStateUpdatedEventObject { /** The dispute object. */ diff --git a/src/api/types/DisputedPayment.ts b/src/api/types/DisputedPayment.ts index 3a0c7158e..f8ec5e566 100644 --- a/src/api/types/DisputedPayment.ts +++ b/src/api/types/DisputedPayment.ts @@ -7,5 +7,5 @@ */ export interface DisputedPayment { /** Square-generated unique ID of the payment being disputed. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/Employee.ts b/src/api/types/Employee.ts index e8ae75817..7d71c6bce 100644 --- a/src/api/types/Employee.ts +++ b/src/api/types/Employee.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An employee object that is used by the external API. @@ -13,15 +13,15 @@ export interface Employee { /** UUID for this object. */ id?: string; /** The employee's first name. */ - firstName?: string | null; + first_name?: string | null; /** The employee's last name. */ - lastName?: string | null; + last_name?: 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; + phone_number?: string | null; /** A list of location IDs where this employee has access to. */ - locationIds?: string[] | null; + location_ids?: string[] | null; /** * Specifies the status of the employees being fetched. * See [EmployeeStatus](#type-employeestatus) for possible values @@ -32,9 +32,9 @@ export interface Employee { * has one owner employee, and that employee has full authority over * the account. */ - isOwner?: boolean | null; + is_owner?: boolean | null; /** A read-only timestamp in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** A read-only timestamp in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/EmployeeWage.ts b/src/api/types/EmployeeWage.ts index ef2a5948e..307c603c1 100644 --- a/src/api/types/EmployeeWage.ts +++ b/src/api/types/EmployeeWage.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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). @@ -11,12 +11,12 @@ export interface EmployeeWage { /** The UUID for this object. */ id?: string; /** The `Employee` that this wage is assigned to. */ - employeeId?: string | null; + employee_id?: 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; + hourly_rate?: Square.Money; } diff --git a/src/api/types/EnableEventsResponse.ts b/src/api/types/EnableEventsResponse.ts index 28a57e147..47b25f55c 100644 --- a/src/api/types/EnableEventsResponse.ts +++ b/src/api/types/EnableEventsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/Error_.ts b/src/api/types/Error_.ts index 6efac0309..828157093 100644 --- a/src/api/types/Error_.ts +++ b/src/api/types/Error_.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an error encountered during a request to the Connect API. diff --git a/src/api/types/Event.ts b/src/api/types/Event.ts index b3c8135ed..3beacf1d8 100644 --- a/src/api/types/Event.ts +++ b/src/api/types/Event.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface Event { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.EventData; } diff --git a/src/api/types/EventMetadata.ts b/src/api/types/EventMetadata.ts index afda8f14d..aa25019c7 100644 --- a/src/api/types/EventMetadata.ts +++ b/src/api/types/EventMetadata.ts @@ -7,7 +7,7 @@ */ export interface EventMetadata { /** A unique ID for the event. */ - eventId?: string | null; + event_id?: 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; + api_version?: string | null; } diff --git a/src/api/types/EventTypeMetadata.ts b/src/api/types/EventTypeMetadata.ts index ab26d5ea5..22755cb66 100644 --- a/src/api/types/EventTypeMetadata.ts +++ b/src/api/types/EventTypeMetadata.ts @@ -7,9 +7,9 @@ */ export interface EventTypeMetadata { /** The event type. */ - eventType?: string; + event_type?: string; /** The API version at which the event type was introduced. */ - apiVersionIntroduced?: string; + api_version_introduced?: string; /** The release status of the event type. */ - releaseStatus?: string; + release_status?: string; } diff --git a/src/api/types/ExternalPaymentDetails.ts b/src/api/types/ExternalPaymentDetails.ts index 013cd8786..262486a87 100644 --- a/src/api/types/ExternalPaymentDetails.ts +++ b/src/api/types/ExternalPaymentDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Stores details about an external payment. Contains only non-confidential information. @@ -32,10 +32,10 @@ export interface ExternalPaymentDetails { */ source: string; /** An ID to associate the payment to its originating source. */ - sourceId?: string | null; + source_id?: string | null; /** * The fees paid to the source. The `amount_money` minus this field is * the net amount seller receives. */ - sourceFeeMoney?: Square.Money; + source_fee_money?: Square.Money; } diff --git a/src/api/types/FloatNumberRange.ts b/src/api/types/FloatNumberRange.ts index 8505a494b..00f09608b 100644 --- a/src/api/types/FloatNumberRange.ts +++ b/src/api/types/FloatNumberRange.ts @@ -7,7 +7,7 @@ */ export interface FloatNumberRange { /** A decimal value indicating where the range starts. */ - startAt?: string | null; + start_at?: string | null; /** A decimal value indicating where the range ends. */ - endAt?: string | null; + end_at?: string | null; } diff --git a/src/api/types/Fulfillment.ts b/src/api/types/Fulfillment.ts index 41dfa331b..809fce86a 100644 --- a/src/api/types/Fulfillment.ts +++ b/src/api/types/Fulfillment.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains details about how to fulfill this order. @@ -27,7 +27,7 @@ export interface Fulfillment { * It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. * See [FulfillmentFulfillmentLineItemApplication](#type-fulfillmentfulfillmentlineitemapplication) for possible values */ - lineItemApplication?: Square.FulfillmentFulfillmentLineItemApplication; + line_item_application?: 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 @@ -67,7 +67,7 @@ export interface Fulfillment { * Contains details for a pickup fulfillment. These details are required when the fulfillment * type is `PICKUP`. */ - pickupDetails?: Square.FulfillmentPickupDetails; + pickup_details?: Square.FulfillmentPickupDetails; /** * Contains details for a shipment fulfillment. These details are required when the fulfillment type * is `SHIPMENT`. @@ -80,7 +80,7 @@ export interface Fulfillment { * `CANCELED`: Shipment has been canceled. * `FAILED`: Shipment has failed. */ - shipmentDetails?: Square.FulfillmentShipmentDetails; + shipment_details?: Square.FulfillmentShipmentDetails; /** Describes delivery details of an order fulfillment. */ - deliveryDetails?: Square.FulfillmentDeliveryDetails; + delivery_details?: Square.FulfillmentDeliveryDetails; } diff --git a/src/api/types/FulfillmentDeliveryDetails.ts b/src/api/types/FulfillmentDeliveryDetails.ts index 42b3e3ae3..ee6771d79 100644 --- a/src/api/types/FulfillmentDeliveryDetails.ts +++ b/src/api/types/FulfillmentDeliveryDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes delivery details of an order fulfillment. @@ -15,7 +15,7 @@ export interface FulfillmentDeliveryDetails { * `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; + schedule_type?: Square.FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType; /** * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) * indicating when the fulfillment was placed. @@ -23,7 +23,7 @@ export interface FulfillmentDeliveryDetails { * * Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". */ - placedAt?: string; + placed_at?: string; /** * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) * that represents the start of the delivery period. @@ -36,12 +36,12 @@ export interface FulfillmentDeliveryDetails { * The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z"). */ - deliverAt?: string | null; + deliver_at?: 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; + prep_time_duration?: string | null; /** * The time period after `deliver_at` in which to deliver the order. * Applications can set this field when the fulfillment `state` is @@ -50,7 +50,7 @@ export interface FulfillmentDeliveryDetails { * * The duration must be in RFC 3339 format (for example, "P1W3D"). */ - deliveryWindowDuration?: string | null; + delivery_window_duration?: string | null; /** * Provides additional instructions about the delivery fulfillment. * It is displayed in the Square Point of Sale application and set by the API. @@ -62,21 +62,21 @@ export interface FulfillmentDeliveryDetails { * 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; + completed_at?: 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; + in_progress_at?: 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; + rejected_at?: string; /** * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) * indicating when the seller marked the fulfillment as ready for @@ -84,13 +84,13 @@ export interface FulfillmentDeliveryDetails { * to PREPARED. * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). */ - readyAt?: string; + ready_at?: 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; + delivered_at?: string; /** * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) * indicating when the fulfillment was canceled. This field is automatically @@ -98,35 +98,35 @@ export interface FulfillmentDeliveryDetails { * * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). */ - canceledAt?: string; + canceled_at?: string; /** The delivery cancellation reason. Max length: 100 characters. */ - cancelReason?: string | null; + cancel_reason?: 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; + courier_pickup_at?: 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; + courier_pickup_window_duration?: string | null; /** Whether the delivery is preferred to be no contact. */ - isNoContactDelivery?: boolean | null; + is_no_contact_delivery?: boolean | null; /** A note to provide additional instructions about how to deliver the order. */ - dropoffNotes?: string | null; + dropoff_notes?: string | null; /** The name of the courier provider. */ - courierProviderName?: string | null; + courier_provider_name?: string | null; /** The support phone number of the courier. */ - courierSupportPhoneNumber?: string | null; + courier_support_phone_number?: string | null; /** The identifier for the delivery created by Square. */ - squareDeliveryId?: string | null; + square_delivery_id?: string | null; /** The identifier for the delivery created by the third-party courier service. */ - externalDeliveryId?: string | null; + external_delivery_id?: 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; + managed_delivery?: boolean | null; } diff --git a/src/api/types/FulfillmentFulfillmentEntry.ts b/src/api/types/FulfillmentFulfillmentEntry.ts index eee1b6960..3c7e931c6 100644 --- a/src/api/types/FulfillmentFulfillmentEntry.ts +++ b/src/api/types/FulfillmentFulfillmentEntry.ts @@ -11,7 +11,7 @@ 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; + line_item_uid: string; /** * The quantity of the line item being fulfilled, formatted as a decimal number. * For example, `"3"`. diff --git a/src/api/types/FulfillmentPickupDetails.ts b/src/api/types/FulfillmentPickupDetails.ts index 2860652d2..46f01de1c 100644 --- a/src/api/types/FulfillmentPickupDetails.ts +++ b/src/api/types/FulfillmentPickupDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains details necessary to fulfill a pickup order. @@ -20,19 +20,19 @@ export interface FulfillmentPickupDetails { * 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; + expires_at?: 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; + auto_complete_duration?: string | null; /** * The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`. * See [FulfillmentPickupDetailsScheduleType](#type-fulfillmentpickupdetailsscheduletype) for possible values */ - scheduleType?: Square.FulfillmentPickupDetailsScheduleType; + schedule_type?: 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., @@ -41,18 +41,18 @@ export interface FulfillmentPickupDetails { * 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; + pickup_at?: 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; + pickup_window_duration?: 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; + prep_time_duration?: 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. @@ -63,47 +63,47 @@ export interface FulfillmentPickupDetails { * indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z"). */ - placedAt?: string; + placed_at?: 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; + accepted_at?: 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; + rejected_at?: 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; + ready_at?: 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; + expired_at?: 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; + picked_up_at?: 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; + canceled_at?: string; /** A description of why the pickup was canceled. The maximum length: 100 characters. */ - cancelReason?: string | null; + cancel_reason?: string | null; /** If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. */ - isCurbsidePickup?: boolean | null; + is_curbside_pickup?: boolean | null; /** Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`. */ - curbsidePickupDetails?: Square.FulfillmentPickupDetailsCurbsidePickupDetails; + curbside_pickup_details?: Square.FulfillmentPickupDetailsCurbsidePickupDetails; } diff --git a/src/api/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts b/src/api/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts index 68fade02b..dfeca5ed8 100644 --- a/src/api/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts +++ b/src/api/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts @@ -7,11 +7,11 @@ */ export interface FulfillmentPickupDetailsCurbsidePickupDetails { /** Specific details for curbside pickup, such as parking number and vehicle model. */ - curbsideDetails?: string | null; + curbside_details?: 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; + buyer_arrived_at?: string | null; } diff --git a/src/api/types/FulfillmentRecipient.ts b/src/api/types/FulfillmentRecipient.ts index 96e30c413..14f8e8603 100644 --- a/src/api/types/FulfillmentRecipient.ts +++ b/src/api/types/FulfillmentRecipient.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Information about the fulfillment recipient. @@ -18,28 +18,28 @@ export interface FulfillmentRecipient { * targeted customer profile does not contain the necessary information and * these fields are left unset, the request results in an error. */ - customerId?: string | null; + customer_id?: 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; + display_name?: 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; + email_address?: 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; + phone_number?: string | null; /** * The address of the fulfillment recipient. This field is required. * diff --git a/src/api/types/FulfillmentShipmentDetails.ts b/src/api/types/FulfillmentShipmentDetails.ts index 48c6176a6..9d939f51f 100644 --- a/src/api/types/FulfillmentShipmentDetails.ts +++ b/src/api/types/FulfillmentShipmentDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains the details necessary to fulfill a shipment order. @@ -13,61 +13,61 @@ export interface FulfillmentShipmentDetails { /** 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; + shipping_note?: string | null; /** * A description of the type of shipping product purchased from the carrier * (such as First Class, Priority, or Express). */ - shippingType?: string | null; + shipping_type?: string | null; /** The reference number provided by the carrier to track the shipment's progress. */ - trackingNumber?: string | null; + tracking_number?: string | null; /** A link to the tracking webpage on the carrier's website. */ - trackingUrl?: string | null; + tracking_url?: 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; + placed_at?: 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; + in_progress_at?: 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; + packaged_at?: 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; + expected_shipped_at?: 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; + shipped_at?: 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; + canceled_at?: string | null; /** A description of why the shipment was canceled. */ - cancelReason?: string | null; + cancel_reason?: 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; + failed_at?: string; /** A description of why the shipment failed to be completed. */ - failureReason?: string | null; + failure_reason?: string | null; } diff --git a/src/api/types/GetBankAccountByV1IdResponse.ts b/src/api/types/GetBankAccountByV1IdResponse.ts index eb32b38e2..787aec25c 100644 --- a/src/api/types/GetBankAccountByV1IdResponse.ts +++ b/src/api/types/GetBankAccountByV1IdResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Response object returned by GetBankAccountByV1Id. @@ -11,5 +11,5 @@ export interface GetBankAccountByV1IdResponse { /** Information on errors encountered during the request. */ errors?: Square.Error_[]; /** The requested `BankAccount` object. */ - bankAccount?: Square.BankAccount; + bank_account?: Square.BankAccount; } diff --git a/src/api/types/GetBankAccountResponse.ts b/src/api/types/GetBankAccountResponse.ts index 4da1157b5..ab50b332c 100644 --- a/src/api/types/GetBankAccountResponse.ts +++ b/src/api/types/GetBankAccountResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Response object returned by `GetBankAccount`. @@ -11,5 +11,5 @@ export interface GetBankAccountResponse { /** Information on errors encountered during the request. */ errors?: Square.Error_[]; /** The requested `BankAccount` object. */ - bankAccount?: Square.BankAccount; + bank_account?: Square.BankAccount; } diff --git a/src/api/types/GetBookingResponse.ts b/src/api/types/GetBookingResponse.ts index 802155711..708b8b402 100644 --- a/src/api/types/GetBookingResponse.ts +++ b/src/api/types/GetBookingResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetBookingResponse { /** The booking that was requested. */ diff --git a/src/api/types/GetBreakTypeResponse.ts b/src/api/types/GetBreakTypeResponse.ts index c19ef2831..b882b0eed 100644 --- a/src/api/types/GetBreakTypeResponse.ts +++ b/src/api/types/GetBreakTypeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to get a `BreakType`. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface GetBreakTypeResponse { /** The response object. */ - breakType?: Square.BreakType; + break_type?: 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 index 4d00700b7..2541231f1 100644 --- a/src/api/types/GetBusinessBookingProfileResponse.ts +++ b/src/api/types/GetBusinessBookingProfileResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetBusinessBookingProfileResponse { /** The seller's booking profile. */ - businessBookingProfile?: Square.BusinessBookingProfile; + business_booking_profile?: 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 index 977887b0f..ddbbfcc5b 100644 --- a/src/api/types/GetCardResponse.ts +++ b/src/api/types/GetCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/GetCashDrawerShiftResponse.ts b/src/api/types/GetCashDrawerShiftResponse.ts index c0dcd2bad..e8d712a68 100644 --- a/src/api/types/GetCashDrawerShiftResponse.ts +++ b/src/api/types/GetCashDrawerShiftResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetCashDrawerShiftResponse { /** The cash drawer shift queried for. */ - cashDrawerShift?: Square.CashDrawerShift; + cash_drawer_shift?: 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 index 0c9fd7b6d..1e910af31 100644 --- a/src/api/types/GetCatalogObjectResponse.ts +++ b/src/api/types/GetCatalogObjectResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetCatalogObjectResponse { /** Any errors that occurred during the request. */ @@ -10,5 +10,5 @@ export interface GetCatalogObjectResponse { /** The `CatalogObject`s returned. */ object?: Square.CatalogObject; /** A list of `CatalogObject`s referenced by the object in the `object` field. */ - relatedObjects?: Square.CatalogObject[]; + related_objects?: Square.CatalogObject[]; } diff --git a/src/api/types/GetCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/GetCustomerCustomAttributeDefinitionResponse.ts index d0e5c7991..63eabbb05 100644 --- a/src/api/types/GetCustomerCustomAttributeDefinitionResponse.ts +++ b/src/api/types/GetCustomerCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface GetCustomerCustomAttributeDefinitionResponse { /** The retrieved custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 1cddb6f62..b08ae8bbd 100644 --- a/src/api/types/GetCustomerCustomAttributeResponse.ts +++ b/src/api/types/GetCustomerCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) response. @@ -13,7 +13,7 @@ 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; + custom_attribute?: 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 index 34e43193a..9253aa20e 100644 --- a/src/api/types/GetCustomerGroupResponse.ts +++ b/src/api/types/GetCustomerGroupResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/GetCustomerResponse.ts b/src/api/types/GetCustomerResponse.ts index 6729a7527..bb2c45dfc 100644 --- a/src/api/types/GetCustomerResponse.ts +++ b/src/api/types/GetCustomerResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/GetCustomerSegmentResponse.ts b/src/api/types/GetCustomerSegmentResponse.ts index 03f3c5b30..1ee75fa71 100644 --- a/src/api/types/GetCustomerSegmentResponse.ts +++ b/src/api/types/GetCustomerSegmentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint. diff --git a/src/api/types/GetDeviceCodeResponse.ts b/src/api/types/GetDeviceCodeResponse.ts index cc4425f39..c8366496a 100644 --- a/src/api/types/GetDeviceCodeResponse.ts +++ b/src/api/types/GetDeviceCodeResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetDeviceCodeResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The queried DeviceCode. */ - deviceCode?: Square.DeviceCode; + device_code?: Square.DeviceCode; } diff --git a/src/api/types/GetDeviceResponse.ts b/src/api/types/GetDeviceResponse.ts index 307d74483..2c43dd9ee 100644 --- a/src/api/types/GetDeviceResponse.ts +++ b/src/api/types/GetDeviceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetDeviceResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/GetDisputeEvidenceResponse.ts b/src/api/types/GetDisputeEvidenceResponse.ts index 48a52ff8c..dec12804b 100644 --- a/src/api/types/GetDisputeEvidenceResponse.ts +++ b/src/api/types/GetDisputeEvidenceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields in a `RetrieveDisputeEvidence` response. diff --git a/src/api/types/GetDisputeResponse.ts b/src/api/types/GetDisputeResponse.ts index a6d615a91..4f9eccef3 100644 --- a/src/api/types/GetDisputeResponse.ts +++ b/src/api/types/GetDisputeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines fields in a `RetrieveDispute` response. diff --git a/src/api/types/GetEmployeeResponse.ts b/src/api/types/GetEmployeeResponse.ts index 266fa41e1..394d459f2 100644 --- a/src/api/types/GetEmployeeResponse.ts +++ b/src/api/types/GetEmployeeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetEmployeeResponse { employee?: Square.Employee; diff --git a/src/api/types/GetEmployeeWageResponse.ts b/src/api/types/GetEmployeeWageResponse.ts index fe7c71f55..7131a2167 100644 --- a/src/api/types/GetEmployeeWageResponse.ts +++ b/src/api/types/GetEmployeeWageResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response to a request to get an `EmployeeWage`. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface GetEmployeeWageResponse { /** The requested `EmployeeWage` object. */ - employeeWage?: Square.EmployeeWage; + employee_wage?: 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 index ecb5ff639..f9780b209 100644 --- a/src/api/types/GetGiftCardFromGanResponse.ts +++ b/src/api/types/GetGiftCardFromGanResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains a `GiftCard`. This response might contain a set of `Error` objects @@ -12,5 +12,5 @@ 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; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/GetGiftCardFromNonceResponse.ts b/src/api/types/GetGiftCardFromNonceResponse.ts index dca2bcbfe..5ee52fea8 100644 --- a/src/api/types/GetGiftCardFromNonceResponse.ts +++ b/src/api/types/GetGiftCardFromNonceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains a `GiftCard` object. If the request resulted in errors, @@ -12,5 +12,5 @@ export interface GetGiftCardFromNonceResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The retrieved gift card. */ - giftCard?: Square.GiftCard; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/GetGiftCardResponse.ts b/src/api/types/GetGiftCardResponse.ts index 2548f71c0..9188e1dbd 100644 --- a/src/api/types/GetGiftCardResponse.ts +++ b/src/api/types/GetGiftCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains a `GiftCard`. The response might contain a set of `Error` objects @@ -12,5 +12,5 @@ export interface GetGiftCardResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The gift card retrieved. */ - giftCard?: Square.GiftCard; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/GetInventoryAdjustmentResponse.ts b/src/api/types/GetInventoryAdjustmentResponse.ts index 549648d11..bfc2b630c 100644 --- a/src/api/types/GetInventoryAdjustmentResponse.ts +++ b/src/api/types/GetInventoryAdjustmentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetInventoryAdjustmentResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/GetInventoryChangesResponse.ts b/src/api/types/GetInventoryChangesResponse.ts index 91187103f..1edf8b198 100644 --- a/src/api/types/GetInventoryChangesResponse.ts +++ b/src/api/types/GetInventoryChangesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetInventoryChangesResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/GetInventoryCountResponse.ts b/src/api/types/GetInventoryCountResponse.ts index cdedcffdf..536112aff 100644 --- a/src/api/types/GetInventoryCountResponse.ts +++ b/src/api/types/GetInventoryCountResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetInventoryCountResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/GetInventoryPhysicalCountResponse.ts b/src/api/types/GetInventoryPhysicalCountResponse.ts index 32b1b4305..3756b472f 100644 --- a/src/api/types/GetInventoryPhysicalCountResponse.ts +++ b/src/api/types/GetInventoryPhysicalCountResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetInventoryPhysicalCountResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/GetInventoryTransferResponse.ts b/src/api/types/GetInventoryTransferResponse.ts index e25b1fc68..5ae2819f2 100644 --- a/src/api/types/GetInventoryTransferResponse.ts +++ b/src/api/types/GetInventoryTransferResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetInventoryTransferResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/GetInvoiceResponse.ts b/src/api/types/GetInvoiceResponse.ts index 620869be5..0854dc328 100644 --- a/src/api/types/GetInvoiceResponse.ts +++ b/src/api/types/GetInvoiceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a `GetInvoice` response. diff --git a/src/api/types/GetLocationResponse.ts b/src/api/types/GetLocationResponse.ts index fc0af595d..b95463adf 100644 --- a/src/api/types/GetLocationResponse.ts +++ b/src/api/types/GetLocationResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that the [RetrieveLocation](api-endpoint:Locations-RetrieveLocation) diff --git a/src/api/types/GetLoyaltyAccountResponse.ts b/src/api/types/GetLoyaltyAccountResponse.ts index 566275fc9..5ffce37ab 100644 --- a/src/api/types/GetLoyaltyAccountResponse.ts +++ b/src/api/types/GetLoyaltyAccountResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that includes the loyalty account. @@ -11,5 +11,5 @@ export interface GetLoyaltyAccountResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The loyalty account. */ - loyaltyAccount?: Square.LoyaltyAccount; + loyalty_account?: Square.LoyaltyAccount; } diff --git a/src/api/types/GetLoyaltyProgramResponse.ts b/src/api/types/GetLoyaltyProgramResponse.ts index e01dee587..130fb4c59 100644 --- a/src/api/types/GetLoyaltyProgramResponse.ts +++ b/src/api/types/GetLoyaltyProgramResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains the loyalty program. diff --git a/src/api/types/GetLoyaltyPromotionResponse.ts b/src/api/types/GetLoyaltyPromotionResponse.ts index 689d5a772..b1f7b9c36 100644 --- a/src/api/types/GetLoyaltyPromotionResponse.ts +++ b/src/api/types/GetLoyaltyPromotionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveLoyaltyPromotionPromotions](api-endpoint:Loyalty-RetrieveLoyaltyPromotion) response. @@ -11,5 +11,5 @@ export interface GetLoyaltyPromotionResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The retrieved loyalty promotion. */ - loyaltyPromotion?: Square.LoyaltyPromotion; + loyalty_promotion?: Square.LoyaltyPromotion; } diff --git a/src/api/types/GetLoyaltyRewardResponse.ts b/src/api/types/GetLoyaltyRewardResponse.ts index c285d582e..7e44ec763 100644 --- a/src/api/types/GetLoyaltyRewardResponse.ts +++ b/src/api/types/GetLoyaltyRewardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that includes the loyalty reward. diff --git a/src/api/types/GetMerchantResponse.ts b/src/api/types/GetMerchantResponse.ts index 603d2c794..7977ab5fe 100644 --- a/src/api/types/GetMerchantResponse.ts +++ b/src/api/types/GetMerchantResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response object returned by the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) endpoint. diff --git a/src/api/types/GetOrderResponse.ts b/src/api/types/GetOrderResponse.ts index 17b50598b..52f8573bf 100644 --- a/src/api/types/GetOrderResponse.ts +++ b/src/api/types/GetOrderResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetOrderResponse { /** The requested order. */ diff --git a/src/api/types/GetPaymentLinkResponse.ts b/src/api/types/GetPaymentLinkResponse.ts index e7fa33c13..b6fd86533 100644 --- a/src/api/types/GetPaymentLinkResponse.ts +++ b/src/api/types/GetPaymentLinkResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetPaymentLinkResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The payment link that is retrieved. */ - paymentLink?: Square.PaymentLink; + payment_link?: Square.PaymentLink; } diff --git a/src/api/types/GetPaymentRefundResponse.ts b/src/api/types/GetPaymentRefundResponse.ts index 2fcdadd81..17d453d5f 100644 --- a/src/api/types/GetPaymentRefundResponse.ts +++ b/src/api/types/GetPaymentRefundResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by [GetRefund](api-endpoint:Refunds-GetPaymentRefund). diff --git a/src/api/types/GetPaymentResponse.ts b/src/api/types/GetPaymentResponse.ts index 75908b112..906c44a94 100644 --- a/src/api/types/GetPaymentResponse.ts +++ b/src/api/types/GetPaymentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by [GetPayment](api-endpoint:Payments-GetPayment). diff --git a/src/api/types/GetPayoutResponse.ts b/src/api/types/GetPayoutResponse.ts index 7c70935d8..1caa7216a 100644 --- a/src/api/types/GetPayoutResponse.ts +++ b/src/api/types/GetPayoutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetPayoutResponse { /** The requested payout. */ diff --git a/src/api/types/GetShiftResponse.ts b/src/api/types/GetShiftResponse.ts index 926693b5c..1464da16b 100644 --- a/src/api/types/GetShiftResponse.ts +++ b/src/api/types/GetShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response to a request to get a `Shift`. The response contains diff --git a/src/api/types/GetSnippetResponse.ts b/src/api/types/GetSnippetResponse.ts index e37027c89..c6f8c3d2e 100644 --- a/src/api/types/GetSnippetResponse.ts +++ b/src/api/types/GetSnippetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`. diff --git a/src/api/types/GetSubscriptionResponse.ts b/src/api/types/GetSubscriptionResponse.ts index 77341f9a7..21d946ce5 100644 --- a/src/api/types/GetSubscriptionResponse.ts +++ b/src/api/types/GetSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the diff --git a/src/api/types/GetTeamMemberBookingProfileResponse.ts b/src/api/types/GetTeamMemberBookingProfileResponse.ts index df4c923ae..ae2f0a58d 100644 --- a/src/api/types/GetTeamMemberBookingProfileResponse.ts +++ b/src/api/types/GetTeamMemberBookingProfileResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetTeamMemberBookingProfileResponse { /** The returned team member booking profile. */ - teamMemberBookingProfile?: Square.TeamMemberBookingProfile; + team_member_booking_profile?: 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 index e269e7dfa..481adc495 100644 --- a/src/api/types/GetTeamMemberResponse.ts +++ b/src/api/types/GetTeamMemberResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + team_member?: 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 index 2b8a9770a..1daff16af 100644 --- a/src/api/types/GetTeamMemberWageResponse.ts +++ b/src/api/types/GetTeamMemberWageResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response to a request to get a `TeamMemberWage`. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface GetTeamMemberWageResponse { /** The requested `TeamMemberWage` object. */ - teamMemberWage?: Square.TeamMemberWage; + team_member_wage?: 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 index ac4225cbc..22b2f7fab 100644 --- a/src/api/types/GetTerminalActionResponse.ts +++ b/src/api/types/GetTerminalActionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetTerminalActionResponse { /** Information on errors encountered during the request. */ diff --git a/src/api/types/GetTerminalCheckoutResponse.ts b/src/api/types/GetTerminalCheckoutResponse.ts index 23f4d7e68..91348d1ef 100644 --- a/src/api/types/GetTerminalCheckoutResponse.ts +++ b/src/api/types/GetTerminalCheckoutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetTerminalCheckoutResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/GetTerminalRefundResponse.ts b/src/api/types/GetTerminalRefundResponse.ts index 973ca5864..0d54fc6a6 100644 --- a/src/api/types/GetTerminalRefundResponse.ts +++ b/src/api/types/GetTerminalRefundResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface GetTerminalRefundResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/GetTransactionResponse.ts b/src/api/types/GetTransactionResponse.ts index aff31de00..a99416959 100644 --- a/src/api/types/GetTransactionResponse.ts +++ b/src/api/types/GetTransactionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/GetVendorResponse.ts b/src/api/types/GetVendorResponse.ts index 34662553d..0eb1b4172 100644 --- a/src/api/types/GetVendorResponse.ts +++ b/src/api/types/GetVendorResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an output from a call to [RetrieveVendor](api-endpoint:Vendors-RetrieveVendor). diff --git a/src/api/types/GetWageSettingResponse.ts b/src/api/types/GetWageSettingResponse.ts index d34904d40..eab233daa 100644 --- a/src/api/types/GetWageSettingResponse.ts +++ b/src/api/types/GetWageSettingResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + wage_setting?: 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 index 55d50ead7..00ce6f720 100644 --- a/src/api/types/GetWebhookSubscriptionResponse.ts +++ b/src/api/types/GetWebhookSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/GiftCard.ts b/src/api/types/GiftCard.ts index ed24ffacb..8e23a836f 100644 --- a/src/api/types/GiftCard.ts +++ b/src/api/types/GiftCard.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a Square gift card. @@ -19,14 +19,14 @@ export interface GiftCard { * 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; + gan_source?: 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; + balance_money?: Square.Money; /** * The gift card account number (GAN). Buyers can use the GAN to make purchases or check * the gift card balance. @@ -39,7 +39,7 @@ export interface GiftCard { * 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; + created_at?: string; /** The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked. */ - customerIds?: string[]; + customer_ids?: string[]; } diff --git a/src/api/types/GiftCardActivity.ts b/src/api/types/GiftCardActivity.ts index a19037829..f2321eaa6 100644 --- a/src/api/types/GiftCardActivity.ts +++ b/src/api/types/GiftCardActivity.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an action performed on a [gift card](entity:GiftCard) that affects its state or balance. @@ -18,28 +18,28 @@ export interface GiftCardActivity { */ type: Square.GiftCardActivityType; /** The ID of the [business location](entity:Location) where the activity occurred. */ - locationId: string; + location_id: string; /** The timestamp when the gift card activity was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: 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; + gift_card_id?: 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; + gift_card_gan?: string | null; /** The final balance on the gift card after the action is completed. */ - giftCardBalanceMoney?: Square.Money; + gift_card_balance_money?: Square.Money; /** Additional details about a `LOAD` activity, which is used to reload money onto a gift card. */ - loadActivityDetails?: Square.GiftCardActivityLoad; + load_activity_details?: Square.GiftCardActivityLoad; /** * Additional details about an `ACTIVATE` activity, which is used to activate a gift card with * an initial balance. */ - activateActivityDetails?: Square.GiftCardActivityActivate; + activate_activity_details?: Square.GiftCardActivityActivate; /** * Additional details about a `REDEEM` activity, which is used to redeem a gift card for a purchase. * @@ -48,21 +48,21 @@ export interface GiftCardActivity { * 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; + redeem_activity_details?: 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; + clear_balance_activity_details?: Square.GiftCardActivityClearBalance; /** Additional details about a `DEACTIVATE` activity, which is used to deactivate a gift card. */ - deactivateActivityDetails?: Square.GiftCardActivityDeactivate; + deactivate_activity_details?: 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; + adjust_increment_activity_details?: 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; + adjust_decrement_activity_details?: Square.GiftCardActivityAdjustDecrement; /** * Additional details about a `REFUND` activity, which is used to add money to a gift card when * refunding a payment. @@ -72,35 +72,35 @@ export interface GiftCardActivity { * 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; + refund_activity_details?: 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; + unlinked_activity_refund_activity_details?: Square.GiftCardActivityUnlinkedActivityRefund; /** * Additional details about an `IMPORT` activity, which Square uses to import a third-party * gift card with a balance. */ - importActivityDetails?: Square.GiftCardActivityImport; + import_activity_details?: Square.GiftCardActivityImport; /** Additional details about a `BLOCK` activity, which Square uses to temporarily block a gift card. */ - blockActivityDetails?: Square.GiftCardActivityBlock; + block_activity_details?: Square.GiftCardActivityBlock; /** Additional details about an `UNBLOCK` activity, which Square uses to unblock a gift card. */ - unblockActivityDetails?: Square.GiftCardActivityUnblock; + unblock_activity_details?: 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; + import_reversal_activity_details?: 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; + transfer_balance_to_activity_details?: 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; + transfer_balance_from_activity_details?: Square.GiftCardActivityTransferBalanceFrom; } diff --git a/src/api/types/GiftCardActivityActivate.ts b/src/api/types/GiftCardActivityActivate.ts index c8f56828f..acbf5aa15 100644 --- a/src/api/types/GiftCardActivityActivate.ts +++ b/src/api/types/GiftCardActivityActivate.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about an `ACTIVATE` [gift card activity type](entity:GiftCardActivityType). @@ -14,28 +14,28 @@ export interface GiftCardActivityActivate { * Applications that use a custom order processing system must specify this amount in the * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. */ - amountMoney?: Square.Money; + amount_money?: 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; + order_id?: 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; + line_item_uid?: 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; + reference_id?: string | null; /** * The payment instrument IDs used to process the gift card purchase, such as a credit card ID * or bank account ID. @@ -49,5 +49,5 @@ export interface GiftCardActivityActivate { * * Each buyer payment instrument ID can contain a maximum of 255 characters. */ - buyerPaymentInstrumentIds?: string[] | null; + buyer_payment_instrument_ids?: string[] | null; } diff --git a/src/api/types/GiftCardActivityAdjustDecrement.ts b/src/api/types/GiftCardActivityAdjustDecrement.ts index 80d24f854..a4c916596 100644 --- a/src/api/types/GiftCardActivityAdjustDecrement.ts +++ b/src/api/types/GiftCardActivityAdjustDecrement.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + amount_money: Square.Money; /** * The reason the gift card balance was adjusted. * See [Reason](#type-reason) for possible values diff --git a/src/api/types/GiftCardActivityAdjustIncrement.ts b/src/api/types/GiftCardActivityAdjustIncrement.ts index 7e333c906..b7c718c81 100644 --- a/src/api/types/GiftCardActivityAdjustIncrement.ts +++ b/src/api/types/GiftCardActivityAdjustIncrement.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + amount_money: Square.Money; /** * The reason the gift card balance was adjusted. * See [Reason](#type-reason) for possible values diff --git a/src/api/types/GiftCardActivityBlock.ts b/src/api/types/GiftCardActivityBlock.ts index 7369f2101..3256463be 100644 --- a/src/api/types/GiftCardActivityBlock.ts +++ b/src/api/types/GiftCardActivityBlock.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about a `BLOCK` [gift card activity type](entity:GiftCardActivityType). diff --git a/src/api/types/GiftCardActivityClearBalance.ts b/src/api/types/GiftCardActivityClearBalance.ts index 3ead099c7..fd5938f91 100644 --- a/src/api/types/GiftCardActivityClearBalance.ts +++ b/src/api/types/GiftCardActivityClearBalance.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about a `CLEAR_BALANCE` [gift card activity type](entity:GiftCardActivityType). diff --git a/src/api/types/GiftCardActivityCreatedEvent.ts b/src/api/types/GiftCardActivityCreatedEvent.ts index 0bb4409dc..ccad3c884 100644 --- a/src/api/types/GiftCardActivityCreatedEvent.ts +++ b/src/api/types/GiftCardActivityCreatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [gift card activity](entity:GiftCardActivity) is created. */ export interface GiftCardActivityCreatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `gift_card.activity.created`. */ type?: string | null; /** * The unique ID of the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.GiftCardActivityCreatedEventData; } diff --git a/src/api/types/GiftCardActivityCreatedEventData.ts b/src/api/types/GiftCardActivityCreatedEventData.ts index 7b92234e8..f974e2190 100644 --- a/src/api/types/GiftCardActivityCreatedEventData.ts +++ b/src/api/types/GiftCardActivityCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the data associated with a `gift_card.activity.created` event. diff --git a/src/api/types/GiftCardActivityCreatedEventObject.ts b/src/api/types/GiftCardActivityCreatedEventObject.ts index fe1ca38ff..5a2b40aeb 100644 --- a/src/api/types/GiftCardActivityCreatedEventObject.ts +++ b/src/api/types/GiftCardActivityCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the gift card activity associated with a @@ -10,5 +10,5 @@ import * as Square from "../index"; */ export interface GiftCardActivityCreatedEventObject { /** The new gift card activity. */ - giftCardActivity?: Square.GiftCardActivity; + gift_card_activity?: Square.GiftCardActivity; } diff --git a/src/api/types/GiftCardActivityDeactivate.ts b/src/api/types/GiftCardActivityDeactivate.ts index 3129c1c2f..a16108fe2 100644 --- a/src/api/types/GiftCardActivityDeactivate.ts +++ b/src/api/types/GiftCardActivityDeactivate.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about a `DEACTIVATE` [gift card activity type](entity:GiftCardActivityType). diff --git a/src/api/types/GiftCardActivityImport.ts b/src/api/types/GiftCardActivityImport.ts index c0d4189de..626eb10f0 100644 --- a/src/api/types/GiftCardActivityImport.ts +++ b/src/api/types/GiftCardActivityImport.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about an `IMPORT` [gift card activity type](entity:GiftCardActivityType). @@ -11,5 +11,5 @@ import * as Square from "../index"; */ export interface GiftCardActivityImport { /** The balance amount on the imported gift card. */ - amountMoney: Square.Money; + amount_money: Square.Money; } diff --git a/src/api/types/GiftCardActivityImportReversal.ts b/src/api/types/GiftCardActivityImportReversal.ts index 33e18276e..784cbf107 100644 --- a/src/api/types/GiftCardActivityImportReversal.ts +++ b/src/api/types/GiftCardActivityImportReversal.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about an `IMPORT_REVERSAL` [gift card activity type](entity:GiftCardActivityType). @@ -12,5 +12,5 @@ export interface GiftCardActivityImportReversal { * The amount of money cleared from the third-party gift card when * the import was reversed. */ - amountMoney: Square.Money; + amount_money: Square.Money; } diff --git a/src/api/types/GiftCardActivityLoad.ts b/src/api/types/GiftCardActivityLoad.ts index f5ec18e1a..49799c83f 100644 --- a/src/api/types/GiftCardActivityLoad.ts +++ b/src/api/types/GiftCardActivityLoad.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about a `LOAD` [gift card activity type](entity:GiftCardActivityType). @@ -14,28 +14,28 @@ export interface GiftCardActivityLoad { * Applications that use a custom order processing system must specify this amount in the * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. */ - amountMoney?: Square.Money; + amount_money?: 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; + order_id?: 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; + line_item_uid?: 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; + reference_id?: 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. @@ -49,5 +49,5 @@ export interface GiftCardActivityLoad { * * Each buyer payment instrument ID can contain a maximum of 255 characters. */ - buyerPaymentInstrumentIds?: string[] | null; + buyer_payment_instrument_ids?: string[] | null; } diff --git a/src/api/types/GiftCardActivityRedeem.ts b/src/api/types/GiftCardActivityRedeem.ts index 536cafdd3..255a6b195 100644 --- a/src/api/types/GiftCardActivityRedeem.ts +++ b/src/api/types/GiftCardActivityRedeem.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about a `REDEEM` [gift card activity type](entity:GiftCardActivityType). @@ -14,19 +14,19 @@ export interface GiftCardActivityRedeem { * Applications that use a custom payment processing system must specify this amount in the * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. */ - amountMoney: Square.Money; + amount_money: 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; + payment_id?: 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; + reference_id?: 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` diff --git a/src/api/types/GiftCardActivityRefund.ts b/src/api/types/GiftCardActivityRefund.ts index 854c4eae2..2e44f93cb 100644 --- a/src/api/types/GiftCardActivityRefund.ts +++ b/src/api/types/GiftCardActivityRefund.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about a `REFUND` [gift card activity type](entity:GiftCardActivityType). @@ -16,19 +16,19 @@ export interface GiftCardActivityRefund { * 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; + redeem_activity_id?: 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; + amount_money?: Square.Money; /** A client-specified ID that associates the gift card activity with an entity in another system. */ - referenceId?: string | null; + reference_id?: 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; + payment_id?: string; } diff --git a/src/api/types/GiftCardActivityTransferBalanceFrom.ts b/src/api/types/GiftCardActivityTransferBalanceFrom.ts index 41f6839de..1e16c80d2 100644 --- a/src/api/types/GiftCardActivityTransferBalanceFrom.ts +++ b/src/api/types/GiftCardActivityTransferBalanceFrom.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + transfer_to_gift_card_id: string; /** The amount deducted from the gift card for the transfer. This value is a positive integer. */ - amountMoney: Square.Money; + amount_money: Square.Money; } diff --git a/src/api/types/GiftCardActivityTransferBalanceTo.ts b/src/api/types/GiftCardActivityTransferBalanceTo.ts index d68325bf3..b061efa44 100644 --- a/src/api/types/GiftCardActivityTransferBalanceTo.ts +++ b/src/api/types/GiftCardActivityTransferBalanceTo.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + transfer_from_gift_card_id: string; /** The amount added to the gift card balance for the transfer. This value is a positive integer. */ - amountMoney: Square.Money; + amount_money: Square.Money; } diff --git a/src/api/types/GiftCardActivityUnblock.ts b/src/api/types/GiftCardActivityUnblock.ts index b6cb30f11..59d2bb0ad 100644 --- a/src/api/types/GiftCardActivityUnblock.ts +++ b/src/api/types/GiftCardActivityUnblock.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents details about an `UNBLOCK` [gift card activity type](entity:GiftCardActivityType). diff --git a/src/api/types/GiftCardActivityUnlinkedActivityRefund.ts b/src/api/types/GiftCardActivityUnlinkedActivityRefund.ts index 01f3229b4..59f102daa 100644 --- a/src/api/types/GiftCardActivityUnlinkedActivityRefund.ts +++ b/src/api/types/GiftCardActivityUnlinkedActivityRefund.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + amount_money: Square.Money; /** A client-specified ID that associates the gift card activity with an entity in another system. */ - referenceId?: string | null; + reference_id?: string | null; /** The ID of the refunded payment. This field is not used starting in Square version 2022-06-16. */ - paymentId?: string; + payment_id?: string; } diff --git a/src/api/types/GiftCardActivityUpdatedEvent.ts b/src/api/types/GiftCardActivityUpdatedEvent.ts index f693bdab8..57f79a0ef 100644 --- a/src/api/types/GiftCardActivityUpdatedEvent.ts +++ b/src/api/types/GiftCardActivityUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [gift card activity](entity:GiftCardActivity) is updated. @@ -13,16 +13,16 @@ import * as Square from "../index"; */ export interface GiftCardActivityUpdatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `gift_card.activity.updated`. */ type?: string | null; /** * The unique ID of the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.GiftCardActivityUpdatedEventData; } diff --git a/src/api/types/GiftCardActivityUpdatedEventData.ts b/src/api/types/GiftCardActivityUpdatedEventData.ts index 473d79192..4e27056bb 100644 --- a/src/api/types/GiftCardActivityUpdatedEventData.ts +++ b/src/api/types/GiftCardActivityUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `gift_card.activity.updated` event. diff --git a/src/api/types/GiftCardActivityUpdatedEventObject.ts b/src/api/types/GiftCardActivityUpdatedEventObject.ts index b0f319574..0f827f4a4 100644 --- a/src/api/types/GiftCardActivityUpdatedEventObject.ts +++ b/src/api/types/GiftCardActivityUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the gift card activity associated with a @@ -10,5 +10,5 @@ import * as Square from "../index"; */ export interface GiftCardActivityUpdatedEventObject { /** The updated gift card activity. */ - giftCardActivity?: Square.GiftCardActivity; + gift_card_activity?: Square.GiftCardActivity; } diff --git a/src/api/types/GiftCardCreatedEvent.ts b/src/api/types/GiftCardCreatedEvent.ts index 806cf9e84..f72ecd56d 100644 --- a/src/api/types/GiftCardCreatedEvent.ts +++ b/src/api/types/GiftCardCreatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [gift card](entity:GiftCard) is created. */ export interface GiftCardCreatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `gift_card.created`. */ type?: string | null; /** * The unique ID of the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.GiftCardCreatedEventData; } diff --git a/src/api/types/GiftCardCreatedEventData.ts b/src/api/types/GiftCardCreatedEventData.ts index 5377785bb..e933ee1d4 100644 --- a/src/api/types/GiftCardCreatedEventData.ts +++ b/src/api/types/GiftCardCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `gift_card.created` event. diff --git a/src/api/types/GiftCardCreatedEventObject.ts b/src/api/types/GiftCardCreatedEventObject.ts index 3b3f72a26..da557a317 100644 --- a/src/api/types/GiftCardCreatedEventObject.ts +++ b/src/api/types/GiftCardCreatedEventObject.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the gift card associated with a `gift_card.created` event. */ export interface GiftCardCreatedEventObject { /** The new gift card. */ - giftCard?: Square.GiftCard; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/GiftCardCustomerLinkedEvent.ts b/src/api/types/GiftCardCustomerLinkedEvent.ts index 81d22c4f2..e76a1cfa1 100644 --- a/src/api/types/GiftCardCustomerLinkedEvent.ts +++ b/src/api/types/GiftCardCustomerLinkedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [customer](entity:Customer) is linked to a [gift card](entity:GiftCard). */ export interface GiftCardCustomerLinkedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `gift_card.customer_linked`. */ type?: string | null; /** * The unique ID of the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.GiftCardCustomerLinkedEventData; } diff --git a/src/api/types/GiftCardCustomerLinkedEventData.ts b/src/api/types/GiftCardCustomerLinkedEventData.ts index 386681909..d37a302ea 100644 --- a/src/api/types/GiftCardCustomerLinkedEventData.ts +++ b/src/api/types/GiftCardCustomerLinkedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `gift_card.customer_linked` event. diff --git a/src/api/types/GiftCardCustomerLinkedEventObject.ts b/src/api/types/GiftCardCustomerLinkedEventObject.ts index 2f0d47889..78d3bc94d 100644 --- a/src/api/types/GiftCardCustomerLinkedEventObject.ts +++ b/src/api/types/GiftCardCustomerLinkedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the gift card and customer ID associated with a @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface GiftCardCustomerLinkedEventObject { /** The gift card with the updated `customer_ids` field. */ - giftCard?: Square.GiftCard; + gift_card?: Square.GiftCard; /** The ID of the linked [customer](entity:Customer). */ - linkedCustomerId?: string | null; + linked_customer_id?: string | null; } diff --git a/src/api/types/GiftCardCustomerUnlinkedEvent.ts b/src/api/types/GiftCardCustomerUnlinkedEvent.ts index f2e4e6806..a82764bfd 100644 --- a/src/api/types/GiftCardCustomerUnlinkedEvent.ts +++ b/src/api/types/GiftCardCustomerUnlinkedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [customer](entity:Customer) is unlinked from a [gift card](entity:GiftCard). */ export interface GiftCardCustomerUnlinkedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `gift_card.customer_unlinked`. */ type?: string | null; /** * The unique ID of the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.GiftCardCustomerUnlinkedEventData; } diff --git a/src/api/types/GiftCardCustomerUnlinkedEventData.ts b/src/api/types/GiftCardCustomerUnlinkedEventData.ts index 46aba1266..a397e2e73 100644 --- a/src/api/types/GiftCardCustomerUnlinkedEventData.ts +++ b/src/api/types/GiftCardCustomerUnlinkedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `gift_card.customer_unlinked` event. diff --git a/src/api/types/GiftCardCustomerUnlinkedEventObject.ts b/src/api/types/GiftCardCustomerUnlinkedEventObject.ts index ede810855..22481645c 100644 --- a/src/api/types/GiftCardCustomerUnlinkedEventObject.ts +++ b/src/api/types/GiftCardCustomerUnlinkedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the gift card and the customer ID associated with a @@ -13,7 +13,7 @@ export interface GiftCardCustomerUnlinkedEventObject { * The gift card with the updated `customer_ids` field. * The field is removed if the gift card is not linked to any customers. */ - giftCard?: Square.GiftCard; + gift_card?: Square.GiftCard; /** The ID of the unlinked [customer](entity:Customer). */ - unlinkedCustomerId?: string | null; + unlinked_customer_id?: string | null; } diff --git a/src/api/types/GiftCardUpdatedEvent.ts b/src/api/types/GiftCardUpdatedEvent.ts index 466c2fb45..f83b4bb66 100644 --- a/src/api/types/GiftCardUpdatedEvent.ts +++ b/src/api/types/GiftCardUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [gift card](entity:GiftCard) is updated. This includes @@ -10,16 +10,16 @@ import * as Square from "../index"; */ export interface GiftCardUpdatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. For this event, the value is `gift_card.updated`. */ type?: string | null; /** * The unique ID of the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.GiftCardUpdatedEventData; } diff --git a/src/api/types/GiftCardUpdatedEventData.ts b/src/api/types/GiftCardUpdatedEventData.ts index 96c5db2f1..184e46cf7 100644 --- a/src/api/types/GiftCardUpdatedEventData.ts +++ b/src/api/types/GiftCardUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `gift_card.updated` event. diff --git a/src/api/types/GiftCardUpdatedEventObject.ts b/src/api/types/GiftCardUpdatedEventObject.ts index 2b9aa6532..255846db8 100644 --- a/src/api/types/GiftCardUpdatedEventObject.ts +++ b/src/api/types/GiftCardUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the gift card associated with a `gift_card.updated` event. @@ -12,5 +12,5 @@ export interface GiftCardUpdatedEventObject { * The gift card with the updated `balance_money`, `state`, or `customer_ids` field. * Some events can affect both `balance_money` and `state`. */ - giftCard?: Square.GiftCard; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/InventoryAdjustment.ts b/src/api/types/InventoryAdjustment.ts index b4914ae0b..a1789abd0 100644 --- a/src/api/types/InventoryAdjustment.ts +++ b/src/api/types/InventoryAdjustment.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a change in state or quantity of product inventory at a @@ -19,36 +19,36 @@ export interface InventoryAdjustment { * `InventoryAdjustment` to an external * system. */ - referenceId?: string | null; + reference_id?: 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; + from_state?: 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; + to_state?: Square.InventoryState; /** * The Square-generated ID of the [Location](entity:Location) where the related * quantity of items is being tracked. */ - locationId?: string | null; + location_id?: string | null; /** * The Square-generated ID of the * [CatalogObject](entity:CatalogObject) being tracked. */ - catalogObjectId?: string | null; + catalog_object_id?: 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; + catalog_object_type?: string | null; /** * The number of items affected by the adjustment as a decimal string. * Can support up to 5 digits after the decimal point. @@ -59,16 +59,16 @@ export interface InventoryAdjustment { * adjustment. Present if and only if `to_state` is `SOLD`. Always * non-negative. */ - totalPriceMoney?: Square.Money; + total_price_money?: 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; + occurred_at?: string | null; /** An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received. */ - createdAt?: string; + created_at?: string; /** * Information about the application that caused the * inventory adjustment. @@ -78,36 +78,36 @@ export interface InventoryAdjustment { * The Square-generated ID of the [Employee](entity:Employee) responsible for the * inventory adjustment. */ - employeeId?: string | null; + employee_id?: string | null; /** * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the * inventory adjustment. */ - teamMemberId?: string | null; + team_member_id?: string | null; /** * The Square-generated ID of the [Transaction](entity:Transaction) that * caused the adjustment. Only relevant for payment-related state * transitions. */ - transactionId?: string; + transaction_id?: string; /** * The Square-generated ID of the [Refund](entity:Refund) that * caused the adjustment. Only relevant for refund-related state * transitions. */ - refundId?: string; + refund_id?: 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; + purchase_order_id?: 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; + goods_receipt_id?: string; /** An adjustment group bundling the related adjustments of item variations through stock conversions in a single inventory event. */ - adjustmentGroup?: Square.InventoryAdjustmentGroup; + adjustment_group?: Square.InventoryAdjustmentGroup; } diff --git a/src/api/types/InventoryAdjustmentGroup.ts b/src/api/types/InventoryAdjustmentGroup.ts index 5d5325815..53909e37d 100644 --- a/src/api/types/InventoryAdjustmentGroup.ts +++ b/src/api/types/InventoryAdjustmentGroup.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InventoryAdjustmentGroup { /** @@ -11,19 +11,19 @@ export interface InventoryAdjustmentGroup { */ id?: string; /** The inventory adjustment of the composed variation. */ - rootAdjustmentId?: string; + root_adjustment_id?: 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; + from_state?: 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; + to_state?: Square.InventoryState; } diff --git a/src/api/types/InventoryChange.ts b/src/api/types/InventoryChange.ts index 155b8d6ad..348352ff6 100644 --- a/src/api/types/InventoryChange.ts +++ b/src/api/types/InventoryChange.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a single physical count, inventory, adjustment, or transfer @@ -20,7 +20,7 @@ export interface InventoryChange { * Contains details about the physical count when `type` is * `PHYSICAL_COUNT`, and is unset for all other change types. */ - physicalCount?: Square.InventoryPhysicalCount; + physical_count?: Square.InventoryPhysicalCount; /** * Contains details about the inventory adjustment when `type` is * `ADJUSTMENT`, and is unset for all other change types. @@ -35,7 +35,7 @@ export interface InventoryChange { */ transfer?: Square.InventoryTransfer; /** The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. */ - measurementUnit?: Square.CatalogMeasurementUnit; + measurement_unit?: Square.CatalogMeasurementUnit; /** The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. */ - measurementUnitId?: string; + measurement_unit_id?: string; } diff --git a/src/api/types/InventoryCount.ts b/src/api/types/InventoryCount.ts index d5bcbd693..940b9a7df 100644 --- a/src/api/types/InventoryCount.ts +++ b/src/api/types/InventoryCount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents Square-estimated quantity of items in a particular state at a @@ -14,14 +14,14 @@ export interface InventoryCount { * The Square-generated ID of the * [CatalogObject](entity:CatalogObject) being tracked. */ - catalogObjectId?: string | null; + catalog_object_id?: 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; + catalog_object_type?: string | null; /** * The current [inventory state](entity:InventoryState) for the related * quantity of items. @@ -32,7 +32,7 @@ export interface InventoryCount { * The Square-generated ID of the [Location](entity:Location) where the related * quantity of items is being tracked. */ - locationId?: string | null; + location_id?: 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. @@ -42,7 +42,7 @@ export interface InventoryCount { * An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting * the estimated count is received. */ - calculatedAt?: string; + calculated_at?: 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), @@ -50,5 +50,5 @@ export interface InventoryCount { * [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts), and * [RetrieveInventoryChanges](api-endpoint:Inventory-RetrieveInventoryChanges). */ - isEstimated?: boolean; + is_estimated?: boolean; } diff --git a/src/api/types/InventoryCountUpdatedEvent.ts b/src/api/types/InventoryCountUpdatedEvent.ts index 6ac19435a..d967426c6 100644 --- a/src/api/types/InventoryCountUpdatedEvent.ts +++ b/src/api/types/InventoryCountUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when the quantity is updated for a @@ -10,13 +10,13 @@ import * as Square from "../index"; */ export interface InventoryCountUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InventoryCountUpdatedEventData; } diff --git a/src/api/types/InventoryCountUpdatedEventData.ts b/src/api/types/InventoryCountUpdatedEventData.ts index b88761e37..87d247e18 100644 --- a/src/api/types/InventoryCountUpdatedEventData.ts +++ b/src/api/types/InventoryCountUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InventoryCountUpdatedEventData { /** Name of the affected object’s type. For this event, the value is `inventory_counts`. */ diff --git a/src/api/types/InventoryCountUpdatedEventObject.ts b/src/api/types/InventoryCountUpdatedEventObject.ts index fb145136a..e535e1df3 100644 --- a/src/api/types/InventoryCountUpdatedEventObject.ts +++ b/src/api/types/InventoryCountUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InventoryCountUpdatedEventObject { /** The inventory counts. */ - inventoryCounts?: Square.InventoryCount[] | null; + inventory_counts?: Square.InventoryCount[] | null; } diff --git a/src/api/types/InventoryPhysicalCount.ts b/src/api/types/InventoryPhysicalCount.ts index c20ca06af..f33f92409 100644 --- a/src/api/types/InventoryPhysicalCount.ts +++ b/src/api/types/InventoryPhysicalCount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the quantity of an item variation that is physically present @@ -21,19 +21,19 @@ export interface InventoryPhysicalCount { * [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external * system. */ - referenceId?: string | null; + reference_id?: string | null; /** * The Square-generated ID of the * [CatalogObject](entity:CatalogObject) being tracked. */ - catalogObjectId?: string | null; + catalog_object_id?: 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; + catalog_object_type?: string | null; /** * The current [inventory state](entity:InventoryState) for the related * quantity of items. @@ -44,7 +44,7 @@ export interface InventoryPhysicalCount { * The Square-generated ID of the [Location](entity:Location) where the related * quantity of items is being tracked. */ - locationId?: string | null; + location_id?: 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. @@ -59,19 +59,19 @@ export interface InventoryPhysicalCount { * The Square-generated ID of the [Employee](entity:Employee) responsible for the * physical count. */ - employeeId?: string | null; + employee_id?: string | null; /** * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the * physical count. */ - teamMemberId?: string | null; + team_member_id?: 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; + occurred_at?: string | null; /** An RFC 3339-formatted timestamp that indicates when the physical count is received. */ - createdAt?: string; + created_at?: string; } diff --git a/src/api/types/InventoryTransfer.ts b/src/api/types/InventoryTransfer.ts index 180a85c25..c5c89ef3c 100644 --- a/src/api/types/InventoryTransfer.ts +++ b/src/api/types/InventoryTransfer.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the transfer of a quantity of product inventory at a @@ -18,7 +18,7 @@ export interface InventoryTransfer { * An optional ID provided by the application to tie the * `InventoryTransfer` to an external system. */ - referenceId?: string | null; + reference_id?: string | null; /** * The [inventory state](entity:InventoryState) for the quantity of * items being transferred. @@ -29,24 +29,24 @@ export interface InventoryTransfer { * The Square-generated ID of the [Location](entity:Location) where the related * quantity of items was tracked before the transfer. */ - fromLocationId?: string | null; + from_location_id?: 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; + to_location_id?: string | null; /** * The Square-generated ID of the * [CatalogObject](entity:CatalogObject) being tracked. */ - catalogObjectId?: string | null; + catalog_object_id?: 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; + catalog_object_type?: string | null; /** * The number of items affected by the transfer as a decimal string. * Can support up to 5 digits after the decimal point. @@ -58,12 +58,12 @@ export interface InventoryTransfer { * cannot be older than 24 hours or in the future relative to the time of the * request. */ - occurredAt?: string | null; + occurred_at?: string | null; /** * An RFC 3339-formatted timestamp that indicates when Square * received the transfer request. */ - createdAt?: string; + created_at?: string; /** * Information about the application that initiated the * inventory transfer. @@ -73,10 +73,10 @@ export interface InventoryTransfer { * The Square-generated ID of the [Employee](entity:Employee) responsible for the * inventory transfer. */ - employeeId?: string | null; + employee_id?: string | null; /** * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the * inventory transfer. */ - teamMemberId?: string | null; + team_member_id?: string | null; } diff --git a/src/api/types/Invoice.ts b/src/api/types/Invoice.ts index c0395c393..5f22d26dd 100644 --- a/src/api/types/Invoice.ts +++ b/src/api/types/Invoice.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Stores information about an invoice. You use the Invoices API to create and manage @@ -18,7 +18,7 @@ export interface Invoice { * * If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order. */ - locationId?: string | null; + location_id?: 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. @@ -26,13 +26,13 @@ export interface Invoice { * 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; + order_id?: 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; + primary_recipient?: 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: @@ -48,7 +48,7 @@ export interface Invoice { * 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; + payment_requests?: 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 @@ -63,14 +63,14 @@ export interface Invoice { * objects returned in responses do not include `request_method`. * See [InvoiceDeliveryMethod](#type-invoicedeliverymethod) for possible values */ - deliveryMethod?: Square.InvoiceDeliveryMethod; + delivery_method?: 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; + invoice_number?: 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. */ @@ -82,7 +82,7 @@ export interface Invoice { * * If the field is not set, Square processes the invoice immediately after it is published. */ - scheduledAt?: string | null; + scheduled_at?: string | null; /** * A temporary link to the Square-hosted payment page where the customer can pay the * invoice. If the link expires, customers can provide the email address or phone number @@ -91,12 +91,12 @@ export interface Invoice { * This field is added after the invoice is published and reaches the scheduled date * (if one is defined). */ - publicUrl?: string; + public_url?: 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; + next_payment_amount_money?: Square.Money; /** * The status of the invoice. * See [InvoiceStatus](#type-invoicestatus) for possible values @@ -113,16 +113,16 @@ export interface Invoice { */ timezone?: string; /** The timestamp when the invoice was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the invoice was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: 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; + accepted_payment_methods?: 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). @@ -132,17 +132,17 @@ export interface Invoice { * * Max: 2 custom fields */ - customFields?: Square.InvoiceCustomField[] | null; + custom_fields?: 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; + subscription_id?: 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; + sale_or_service_date?: 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). @@ -150,13 +150,13 @@ export interface Invoice { * 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; + payment_conditions?: 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; + store_payment_method_enabled?: 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. @@ -166,5 +166,5 @@ export interface Invoice { * The ID of the [team member](entity:TeamMember) who created the invoice. * This field is present only on invoices created in the Square Dashboard or Square Invoices app by a logged-in team member. */ - creatorTeamMemberId?: string; + creator_team_member_id?: string; } diff --git a/src/api/types/InvoiceAcceptedPaymentMethods.ts b/src/api/types/InvoiceAcceptedPaymentMethods.ts index 3423517b3..493eb2fd5 100644 --- a/src/api/types/InvoiceAcceptedPaymentMethods.ts +++ b/src/api/types/InvoiceAcceptedPaymentMethods.ts @@ -9,9 +9,9 @@ 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; + square_gift_card?: boolean | null; /** Indicates whether ACH bank transfer payments are accepted. The default value is `false`. */ - bankAccount?: boolean | null; + bank_account?: boolean | null; /** * Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`. * @@ -21,11 +21,11 @@ export interface InvoiceAcceptedPaymentMethods { * `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; + buy_now_pay_later?: 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; + cash_app_pay?: boolean | null; } diff --git a/src/api/types/InvoiceAttachment.ts b/src/api/types/InvoiceAttachment.ts index 025574248..2e0449ed8 100644 --- a/src/api/types/InvoiceAttachment.ts +++ b/src/api/types/InvoiceAttachment.ts @@ -24,7 +24,7 @@ export interface InvoiceAttachment { * The following mime types are supported: * image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. */ - mimeType?: string; + mime_type?: string; /** The timestamp when the attachment was uploaded, in RFC 3339 format. */ - uploadedAt?: string; + uploaded_at?: string; } diff --git a/src/api/types/InvoiceCanceledEvent.ts b/src/api/types/InvoiceCanceledEvent.ts index 06f8098a4..56ff0f1a3 100644 --- a/src/api/types/InvoiceCanceledEvent.ts +++ b/src/api/types/InvoiceCanceledEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an [Invoice](entity:Invoice) is canceled. */ export interface InvoiceCanceledEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.canceled"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoiceCanceledEventData; } diff --git a/src/api/types/InvoiceCanceledEventData.ts b/src/api/types/InvoiceCanceledEventData.ts index 7fc4fffed..6634f52aa 100644 --- a/src/api/types/InvoiceCanceledEventData.ts +++ b/src/api/types/InvoiceCanceledEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceCanceledEventData { /** Name of the affected object’s type, `"invoice"`. */ diff --git a/src/api/types/InvoiceCanceledEventObject.ts b/src/api/types/InvoiceCanceledEventObject.ts index 887f3ac67..555c9e06d 100644 --- a/src/api/types/InvoiceCanceledEventObject.ts +++ b/src/api/types/InvoiceCanceledEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceCanceledEventObject { /** The related invoice. */ diff --git a/src/api/types/InvoiceCreatedEvent.ts b/src/api/types/InvoiceCreatedEvent.ts index f2e6515aa..d1841e77c 100644 --- a/src/api/types/InvoiceCreatedEvent.ts +++ b/src/api/types/InvoiceCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an [Invoice](entity:Invoice) is created. */ export interface InvoiceCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoiceCreatedEventData; } diff --git a/src/api/types/InvoiceCreatedEventData.ts b/src/api/types/InvoiceCreatedEventData.ts index 21a388170..629c87d2f 100644 --- a/src/api/types/InvoiceCreatedEventData.ts +++ b/src/api/types/InvoiceCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceCreatedEventData { /** Name of the affected object’s type, `"invoice"`. */ diff --git a/src/api/types/InvoiceCreatedEventObject.ts b/src/api/types/InvoiceCreatedEventObject.ts index 48de67333..67b4fcb1f 100644 --- a/src/api/types/InvoiceCreatedEventObject.ts +++ b/src/api/types/InvoiceCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceCreatedEventObject { /** The related invoice. */ diff --git a/src/api/types/InvoiceCustomField.ts b/src/api/types/InvoiceCustomField.ts index 4dee741b2..84807d5e2 100644 --- a/src/api/types/InvoiceCustomField.ts +++ b/src/api/types/InvoiceCustomField.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An additional seller-defined and customer-facing field to include on the invoice. For more information, diff --git a/src/api/types/InvoiceDeletedEvent.ts b/src/api/types/InvoiceDeletedEvent.ts index 388a6abb5..e6011a56e 100644 --- a/src/api/types/InvoiceDeletedEvent.ts +++ b/src/api/types/InvoiceDeletedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a draft [Invoice](entity:Invoice) is deleted. */ export interface InvoiceDeletedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.deleted"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoiceDeletedEventData; } diff --git a/src/api/types/InvoiceFilter.ts b/src/api/types/InvoiceFilter.ts index 32d264df3..7483f1069 100644 --- a/src/api/types/InvoiceFilter.ts +++ b/src/api/types/InvoiceFilter.ts @@ -10,11 +10,11 @@ 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[]; + location_ids: 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; + customer_ids?: string[] | null; } diff --git a/src/api/types/InvoicePaymentMadeEvent.ts b/src/api/types/InvoicePaymentMadeEvent.ts index 9f782fddd..2fd717f32 100644 --- a/src/api/types/InvoicePaymentMadeEvent.ts +++ b/src/api/types/InvoicePaymentMadeEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a payment that is associated with an [invoice](entity:Invoice) is completed. @@ -10,13 +10,13 @@ import * as Square from "../index"; */ export interface InvoicePaymentMadeEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.payment_made"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoicePaymentMadeEventData; } diff --git a/src/api/types/InvoicePaymentMadeEventData.ts b/src/api/types/InvoicePaymentMadeEventData.ts index ec74fbf5d..e6832399b 100644 --- a/src/api/types/InvoicePaymentMadeEventData.ts +++ b/src/api/types/InvoicePaymentMadeEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoicePaymentMadeEventData { /** Name of the affected object’s type, `"invoice"`. */ diff --git a/src/api/types/InvoicePaymentMadeEventObject.ts b/src/api/types/InvoicePaymentMadeEventObject.ts index 71dff4017..37ad141ef 100644 --- a/src/api/types/InvoicePaymentMadeEventObject.ts +++ b/src/api/types/InvoicePaymentMadeEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoicePaymentMadeEventObject { /** The related invoice. */ diff --git a/src/api/types/InvoicePaymentReminder.ts b/src/api/types/InvoicePaymentReminder.ts index 4d52f0894..5f1813762 100644 --- a/src/api/types/InvoicePaymentReminder.ts +++ b/src/api/types/InvoicePaymentReminder.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a payment request reminder (automatic notification) that Square sends @@ -20,7 +20,7 @@ export interface InvoicePaymentReminder { * 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; + relative_scheduled_days?: number | null; /** The reminder message. */ message?: string | null; /** @@ -29,5 +29,5 @@ export interface InvoicePaymentReminder { */ status?: Square.InvoicePaymentReminderStatus; /** If sent, the timestamp when the reminder was sent, in RFC 3339 format. */ - sentAt?: string; + sent_at?: string; } diff --git a/src/api/types/InvoicePaymentRequest.ts b/src/api/types/InvoicePaymentRequest.ts index b238a38b4..7f4b94743 100644 --- a/src/api/types/InvoicePaymentRequest.ts +++ b/src/api/types/InvoicePaymentRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum @@ -25,13 +25,13 @@ export interface InvoicePaymentRequest { * - 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; + request_method?: 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; + request_type?: 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 @@ -41,14 +41,14 @@ export interface InvoicePaymentRequest { * 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; + due_date?: 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; + fixed_amount_requested_money?: Square.Money; /** * Specifies the amount for the payment request in percentage: * @@ -60,7 +60,7 @@ export interface InvoicePaymentRequest { * 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; + percentage_requested?: 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. @@ -68,32 +68,32 @@ export interface InvoicePaymentRequest { * This field is allowed only on the final payment request * and the payment `request_type` must be `BALANCE` or `INSTALLMENT`. */ - tippingEnabled?: boolean | null; + tipping_enabled?: boolean | null; /** * The payment method for an automatic payment. * * The default value is `NONE`. * See [InvoiceAutomaticPaymentSource](#type-invoiceautomaticpaymentsource) for possible values */ - automaticPaymentSource?: Square.InvoiceAutomaticPaymentSource; + automatic_payment_source?: 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; + card_id?: 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; + computed_amount_money?: 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; + total_completed_amount_money?: 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 @@ -101,5 +101,5 @@ export interface InvoicePaymentRequest { * field specifies the rounding adjustment applied. This amount * might be negative. */ - roundingAdjustmentIncludedMoney?: Square.Money; + rounding_adjustment_included_money?: Square.Money; } diff --git a/src/api/types/InvoicePublishedEvent.ts b/src/api/types/InvoicePublishedEvent.ts index 53b1c9ab2..9ef1f703f 100644 --- a/src/api/types/InvoicePublishedEvent.ts +++ b/src/api/types/InvoicePublishedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an [Invoice](entity:Invoice) transitions from a draft to a non-draft status. */ export interface InvoicePublishedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.published"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoicePublishedEventData; } diff --git a/src/api/types/InvoicePublishedEventData.ts b/src/api/types/InvoicePublishedEventData.ts index 0087be06c..99b5515ff 100644 --- a/src/api/types/InvoicePublishedEventData.ts +++ b/src/api/types/InvoicePublishedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoicePublishedEventData { /** Name of the affected object’s type, `"invoice"`. */ diff --git a/src/api/types/InvoicePublishedEventObject.ts b/src/api/types/InvoicePublishedEventObject.ts index 3b6d290cb..766816484 100644 --- a/src/api/types/InvoicePublishedEventObject.ts +++ b/src/api/types/InvoicePublishedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoicePublishedEventObject { /** The related invoice. */ diff --git a/src/api/types/InvoiceQuery.ts b/src/api/types/InvoiceQuery.ts index 4ed3833b7..409f74880 100644 --- a/src/api/types/InvoiceQuery.ts +++ b/src/api/types/InvoiceQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes query criteria for searching invoices. diff --git a/src/api/types/InvoiceRecipient.ts b/src/api/types/InvoiceRecipient.ts index 37cf7b4d2..0de4038ac 100644 --- a/src/api/types/InvoiceRecipient.ts +++ b/src/api/types/InvoiceRecipient.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice @@ -17,22 +17,22 @@ 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; + customer_id?: string | null; /** The recipient's given (that is, first) name. */ - givenName?: string; + given_name?: string; /** The recipient's family (that is, last) name. */ - familyName?: string; + family_name?: string; /** The recipient's email address. */ - emailAddress?: string; + email_address?: string; /** The recipient's physical address. */ address?: Square.Address; /** The recipient's phone number. */ - phoneNumber?: string; + phone_number?: string; /** The name of the recipient's company. */ - companyName?: string; + company_name?: 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; + tax_ids?: Square.InvoiceRecipientTaxIds; } diff --git a/src/api/types/InvoiceRecipientTaxIds.ts b/src/api/types/InvoiceRecipientTaxIds.ts index bb695aae0..a9a998085 100644 --- a/src/api/types/InvoiceRecipientTaxIds.ts +++ b/src/api/types/InvoiceRecipientTaxIds.ts @@ -9,5 +9,5 @@ */ export interface InvoiceRecipientTaxIds { /** The EU VAT identification number for the invoice recipient. For example, `IE3426675K`. */ - euVat?: string; + eu_vat?: string; } diff --git a/src/api/types/InvoiceRefundedEvent.ts b/src/api/types/InvoiceRefundedEvent.ts index 323f4d1e6..5dbba335e 100644 --- a/src/api/types/InvoiceRefundedEvent.ts +++ b/src/api/types/InvoiceRefundedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a refund is applied toward a payment of an [invoice](entity:Invoice). @@ -10,13 +10,13 @@ import * as Square from "../index"; */ export interface InvoiceRefundedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.refunded"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoiceRefundedEventData; } diff --git a/src/api/types/InvoiceRefundedEventData.ts b/src/api/types/InvoiceRefundedEventData.ts index a8dcf2de6..9973c1477 100644 --- a/src/api/types/InvoiceRefundedEventData.ts +++ b/src/api/types/InvoiceRefundedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceRefundedEventData { /** Name of the affected object’s type, `"invoice"`. */ diff --git a/src/api/types/InvoiceRefundedEventObject.ts b/src/api/types/InvoiceRefundedEventObject.ts index 9975bfd57..ef296a3d6 100644 --- a/src/api/types/InvoiceRefundedEventObject.ts +++ b/src/api/types/InvoiceRefundedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceRefundedEventObject { /** The related invoice. */ diff --git a/src/api/types/InvoiceScheduledChargeFailedEvent.ts b/src/api/types/InvoiceScheduledChargeFailedEvent.ts index a8ea74ed4..096fb15d2 100644 --- a/src/api/types/InvoiceScheduledChargeFailedEvent.ts +++ b/src/api/types/InvoiceScheduledChargeFailedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an automatic scheduled payment for an [Invoice](entity:Invoice) has failed. */ export interface InvoiceScheduledChargeFailedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.scheduled_charge_failed"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoiceScheduledChargeFailedEventData; } diff --git a/src/api/types/InvoiceScheduledChargeFailedEventData.ts b/src/api/types/InvoiceScheduledChargeFailedEventData.ts index ba7b88e9d..607b8faba 100644 --- a/src/api/types/InvoiceScheduledChargeFailedEventData.ts +++ b/src/api/types/InvoiceScheduledChargeFailedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceScheduledChargeFailedEventData { /** Name of the affected object’s type, `"invoice"`. */ diff --git a/src/api/types/InvoiceScheduledChargeFailedEventObject.ts b/src/api/types/InvoiceScheduledChargeFailedEventObject.ts index 53871b634..1d56b7645 100644 --- a/src/api/types/InvoiceScheduledChargeFailedEventObject.ts +++ b/src/api/types/InvoiceScheduledChargeFailedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceScheduledChargeFailedEventObject { /** The related invoice. */ diff --git a/src/api/types/InvoiceSort.ts b/src/api/types/InvoiceSort.ts index 4ddefc79d..920a43846 100644 --- a/src/api/types/InvoiceSort.ts +++ b/src/api/types/InvoiceSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Identifies the sort field and sort order. diff --git a/src/api/types/InvoiceUpdatedEvent.ts b/src/api/types/InvoiceUpdatedEvent.ts index 26e446131..d24191d37 100644 --- a/src/api/types/InvoiceUpdatedEvent.ts +++ b/src/api/types/InvoiceUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an [Invoice](entity:Invoice) is updated. */ export interface InvoiceUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"invoice.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.InvoiceUpdatedEventData; } diff --git a/src/api/types/InvoiceUpdatedEventData.ts b/src/api/types/InvoiceUpdatedEventData.ts index 666c6f156..c748f9490 100644 --- a/src/api/types/InvoiceUpdatedEventData.ts +++ b/src/api/types/InvoiceUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceUpdatedEventData { /** Name of the affected object’s type, `"invoice"`. */ diff --git a/src/api/types/InvoiceUpdatedEventObject.ts b/src/api/types/InvoiceUpdatedEventObject.ts index 743f7b063..2a27aeadb 100644 --- a/src/api/types/InvoiceUpdatedEventObject.ts +++ b/src/api/types/InvoiceUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface InvoiceUpdatedEventObject { /** The related invoice. */ diff --git a/src/api/types/ItemVariationLocationOverrides.ts b/src/api/types/ItemVariationLocationOverrides.ts index fb9055148..cf9cd2871 100644 --- a/src/api/types/ItemVariationLocationOverrides.ts +++ b/src/api/types/ItemVariationLocationOverrides.ts @@ -2,36 +2,36 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + location_id?: string | null; /** The price of the `CatalogItemVariation` at the given `Location`, or blank for variable pricing. */ - priceMoney?: Square.Money; + price_money?: 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; + pricing_type?: Square.CatalogPricingType; /** If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`. */ - trackInventory?: boolean | null; + track_inventory?: 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; + inventory_alert_type?: 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; + inventory_alert_threshold?: (number | bigint) | null; /** * Indicates whether the overridden item variation is sold out at the specified location. * @@ -41,11 +41,11 @@ export interface ItemVariationLocationOverrides { * 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; + sold_out?: 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; + sold_out_valid_until?: string; } diff --git a/src/api/types/Job.ts b/src/api/types/Job.ts index feae74ed7..140d8107b 100644 --- a/src/api/types/Job.ts +++ b/src/api/types/Job.ts @@ -17,11 +17,11 @@ export interface Job { /** The title of the job. */ title?: string | null; /** Indicates whether team members can earn tips for the job. */ - isTipEligible?: boolean | null; + is_tip_eligible?: boolean | null; /** The timestamp when the job was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the job was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: 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) diff --git a/src/api/types/JobAssignment.ts b/src/api/types/JobAssignment.ts index 676dacd7b..bf78b3b0f 100644 --- a/src/api/types/JobAssignment.ts +++ b/src/api/types/JobAssignment.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a job assigned to a [team member](entity:TeamMember), including the compensation the team @@ -10,22 +10,22 @@ import * as Square from "../index"; */ export interface JobAssignment { /** The title of the job. */ - jobTitle?: string | null; + job_title?: 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; + pay_type: 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; + hourly_rate?: Square.Money; /** The total pay amount for a 12-month period on the job. Set if the job `PayType` is `SALARY`. */ - annualRate?: Square.Money; + annual_rate?: Square.Money; /** The planned hours per week for the job. Set if the job `PayType` is `SALARY`. */ - weeklyHours?: number | null; + weekly_hours?: number | null; /** The ID of the [job](entity:Job). */ - jobId?: string | null; + job_id?: string | null; } diff --git a/src/api/types/JobCreatedEvent.ts b/src/api/types/JobCreatedEvent.ts index 886336561..720a0b103 100644 --- a/src/api/types/JobCreatedEvent.ts +++ b/src/api/types/JobCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Job is created. */ export interface JobCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"job.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.JobCreatedEventData; } diff --git a/src/api/types/JobCreatedEventData.ts b/src/api/types/JobCreatedEventData.ts index 75849b538..4070b934d 100644 --- a/src/api/types/JobCreatedEventData.ts +++ b/src/api/types/JobCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface JobCreatedEventData { /** Name of the affected object’s type, `"job"`. */ diff --git a/src/api/types/JobCreatedEventObject.ts b/src/api/types/JobCreatedEventObject.ts index b1ff685a5..94d1f51a7 100644 --- a/src/api/types/JobCreatedEventObject.ts +++ b/src/api/types/JobCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface JobCreatedEventObject { /** The created job. */ diff --git a/src/api/types/JobUpdatedEvent.ts b/src/api/types/JobUpdatedEvent.ts index 4fb5b31f5..9f64ec6ca 100644 --- a/src/api/types/JobUpdatedEvent.ts +++ b/src/api/types/JobUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Job is updated. */ export interface JobUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"job.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.JobUpdatedEventData; } diff --git a/src/api/types/JobUpdatedEventData.ts b/src/api/types/JobUpdatedEventData.ts index ad8f20cc1..068981386 100644 --- a/src/api/types/JobUpdatedEventData.ts +++ b/src/api/types/JobUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface JobUpdatedEventData { /** Name of the affected object’s type, `"job"`. */ diff --git a/src/api/types/JobUpdatedEventObject.ts b/src/api/types/JobUpdatedEventObject.ts index 69142b916..7b472c655 100644 --- a/src/api/types/JobUpdatedEventObject.ts +++ b/src/api/types/JobUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface JobUpdatedEventObject { /** The updated job. */ diff --git a/src/api/types/LaborScheduledShiftCreatedEvent.ts b/src/api/types/LaborScheduledShiftCreatedEvent.ts index f77eedcbb..d1fa787fd 100644 --- a/src/api/types/LaborScheduledShiftCreatedEvent.ts +++ b/src/api/types/LaborScheduledShiftCreatedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [ScheduledShift](entity:ScheduledShift) is created. */ export interface LaborScheduledShiftCreatedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event. For this event, the value is `labor.scheduled_shift.created`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborScheduledShiftCreatedEventData; } diff --git a/src/api/types/LaborScheduledShiftCreatedEventData.ts b/src/api/types/LaborScheduledShiftCreatedEventData.ts index f710a9ce6..7a1601a41 100644 --- a/src/api/types/LaborScheduledShiftCreatedEventData.ts +++ b/src/api/types/LaborScheduledShiftCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborScheduledShiftCreatedEventData { /** The type of object affected by the event. For this event, the value is `scheduled_shift`. */ diff --git a/src/api/types/LaborScheduledShiftCreatedEventObject.ts b/src/api/types/LaborScheduledShiftCreatedEventObject.ts index b78cc2241..9e13640c0 100644 --- a/src/api/types/LaborScheduledShiftCreatedEventObject.ts +++ b/src/api/types/LaborScheduledShiftCreatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborScheduledShiftCreatedEventObject { /** The new `ScheduledShift`. */ - scheduledShift?: Square.ScheduledShift; + ScheduledShift?: Square.ScheduledShift; } diff --git a/src/api/types/LaborScheduledShiftDeletedEvent.ts b/src/api/types/LaborScheduledShiftDeletedEvent.ts index 20af8987c..c9eb8ab7e 100644 --- a/src/api/types/LaborScheduledShiftDeletedEvent.ts +++ b/src/api/types/LaborScheduledShiftDeletedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [ScheduledShift](entity:ScheduledShift) is deleted. */ export interface LaborScheduledShiftDeletedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event. For this event, the value is `labor.scheduled_shift.deleted`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborScheduledShiftDeletedEventData; } diff --git a/src/api/types/LaborScheduledShiftPublishedEvent.ts b/src/api/types/LaborScheduledShiftPublishedEvent.ts index 2b03c27ea..7778f33c9 100644 --- a/src/api/types/LaborScheduledShiftPublishedEvent.ts +++ b/src/api/types/LaborScheduledShiftPublishedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [ScheduledShift](entity:ScheduledShift) is published. */ export interface LaborScheduledShiftPublishedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event. For this event, the value is `labor.scheduled_shift.published`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborScheduledShiftPublishedEventData; } diff --git a/src/api/types/LaborScheduledShiftPublishedEventData.ts b/src/api/types/LaborScheduledShiftPublishedEventData.ts index a837ce599..86e822893 100644 --- a/src/api/types/LaborScheduledShiftPublishedEventData.ts +++ b/src/api/types/LaborScheduledShiftPublishedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborScheduledShiftPublishedEventData { /** The type of object affected by the event. For this event, the value is `scheduled_shift`. */ diff --git a/src/api/types/LaborScheduledShiftPublishedEventObject.ts b/src/api/types/LaborScheduledShiftPublishedEventObject.ts index 56f68ace8..b5cc93288 100644 --- a/src/api/types/LaborScheduledShiftPublishedEventObject.ts +++ b/src/api/types/LaborScheduledShiftPublishedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborScheduledShiftPublishedEventObject { /** The published `ScheduledShift`. */ - scheduledShift?: Square.ScheduledShift; + ScheduledShift?: Square.ScheduledShift; } diff --git a/src/api/types/LaborScheduledShiftUpdatedEvent.ts b/src/api/types/LaborScheduledShiftUpdatedEvent.ts index ff1177120..3f5f79311 100644 --- a/src/api/types/LaborScheduledShiftUpdatedEvent.ts +++ b/src/api/types/LaborScheduledShiftUpdatedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [ScheduledShift](entity:ScheduledShift) is updated. */ export interface LaborScheduledShiftUpdatedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event. For this event, the value is `labor.scheduled_shift.updated`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborScheduledShiftUpdatedEventData; } diff --git a/src/api/types/LaborScheduledShiftUpdatedEventData.ts b/src/api/types/LaborScheduledShiftUpdatedEventData.ts index 10a6bfebd..1c696c180 100644 --- a/src/api/types/LaborScheduledShiftUpdatedEventData.ts +++ b/src/api/types/LaborScheduledShiftUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborScheduledShiftUpdatedEventData { /** The type of object affected by the event. For this event, the value is `scheduled_shift`. */ diff --git a/src/api/types/LaborScheduledShiftUpdatedEventObject.ts b/src/api/types/LaborScheduledShiftUpdatedEventObject.ts index 726c1cb02..3222c8256 100644 --- a/src/api/types/LaborScheduledShiftUpdatedEventObject.ts +++ b/src/api/types/LaborScheduledShiftUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborScheduledShiftUpdatedEventObject { /** The updated `ScheduledShift`. */ - scheduledShift?: Square.ScheduledShift; + ScheduledShift?: Square.ScheduledShift; } diff --git a/src/api/types/LaborShiftCreatedEvent.ts b/src/api/types/LaborShiftCreatedEvent.ts index 50f481c25..40d017f62 100644 --- a/src/api/types/LaborShiftCreatedEvent.ts +++ b/src/api/types/LaborShiftCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a worker starts a [Shift](entity:Shift). @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface LaborShiftCreatedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `labor.shift.created`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborShiftCreatedEventData; } diff --git a/src/api/types/LaborShiftCreatedEventData.ts b/src/api/types/LaborShiftCreatedEventData.ts index 59b9bfbcf..d8b237bb3 100644 --- a/src/api/types/LaborShiftCreatedEventData.ts +++ b/src/api/types/LaborShiftCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborShiftCreatedEventData { /** The type of object affected by the event. For this event, the value is `shift`. */ diff --git a/src/api/types/LaborShiftCreatedEventObject.ts b/src/api/types/LaborShiftCreatedEventObject.ts index b5d179491..e9f860b73 100644 --- a/src/api/types/LaborShiftCreatedEventObject.ts +++ b/src/api/types/LaborShiftCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborShiftCreatedEventObject { /** The new `Shift`. */ diff --git a/src/api/types/LaborShiftDeletedEvent.ts b/src/api/types/LaborShiftDeletedEvent.ts index 3f89ce20f..3b08e8f23 100644 --- a/src/api/types/LaborShiftDeletedEvent.ts +++ b/src/api/types/LaborShiftDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Shift](entity:Shift) is deleted. @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface LaborShiftDeletedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `labor.shift.deleted`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborShiftDeletedEventData; } diff --git a/src/api/types/LaborShiftUpdatedEvent.ts b/src/api/types/LaborShiftUpdatedEvent.ts index b5d16a143..70d396200 100644 --- a/src/api/types/LaborShiftUpdatedEvent.ts +++ b/src/api/types/LaborShiftUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Shift](entity:Shift) is updated. @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface LaborShiftUpdatedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `labor.shift.updated`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborShiftUpdatedEventData; } diff --git a/src/api/types/LaborShiftUpdatedEventData.ts b/src/api/types/LaborShiftUpdatedEventData.ts index fe716c7d6..907f58529 100644 --- a/src/api/types/LaborShiftUpdatedEventData.ts +++ b/src/api/types/LaborShiftUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborShiftUpdatedEventData { /** The type of object affected by the event. For this event, the value is `shift`. */ diff --git a/src/api/types/LaborShiftUpdatedEventObject.ts b/src/api/types/LaborShiftUpdatedEventObject.ts index aca0d470e..1fa24718b 100644 --- a/src/api/types/LaborShiftUpdatedEventObject.ts +++ b/src/api/types/LaborShiftUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborShiftUpdatedEventObject { /** The updated `Shift`. */ diff --git a/src/api/types/LaborTimecardCreatedEvent.ts b/src/api/types/LaborTimecardCreatedEvent.ts index 5b4512fe8..83a8902d2 100644 --- a/src/api/types/LaborTimecardCreatedEvent.ts +++ b/src/api/types/LaborTimecardCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a worker starts a [Timecard](entity:Timecard). */ export interface LaborTimecardCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `labor.timecard.created`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborTimecardCreatedEventData; } diff --git a/src/api/types/LaborTimecardCreatedEventData.ts b/src/api/types/LaborTimecardCreatedEventData.ts index 71fd122e8..38c6ee0c6 100644 --- a/src/api/types/LaborTimecardCreatedEventData.ts +++ b/src/api/types/LaborTimecardCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborTimecardCreatedEventData { /** The type of object affected by the event. For this event, the value is `timecard`. */ diff --git a/src/api/types/LaborTimecardCreatedEventObject.ts b/src/api/types/LaborTimecardCreatedEventObject.ts index 703303338..3a18cb718 100644 --- a/src/api/types/LaborTimecardCreatedEventObject.ts +++ b/src/api/types/LaborTimecardCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborTimecardCreatedEventObject { /** The new `Timecard`. */ diff --git a/src/api/types/LaborTimecardDeletedEvent.ts b/src/api/types/LaborTimecardDeletedEvent.ts index 7f914a3c2..81125c1c3 100644 --- a/src/api/types/LaborTimecardDeletedEvent.ts +++ b/src/api/types/LaborTimecardDeletedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Timecard](entity:Timecard) is deleted. */ export interface LaborTimecardDeletedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `labor.timecard.deleted`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborTimecardDeletedEventData; } diff --git a/src/api/types/LaborTimecardUpdatedEvent.ts b/src/api/types/LaborTimecardUpdatedEvent.ts index cae70aa2e..d2d5f6bd2 100644 --- a/src/api/types/LaborTimecardUpdatedEvent.ts +++ b/src/api/types/LaborTimecardUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Timecard](entity:Timecard) is updated. */ export interface LaborTimecardUpdatedEvent { /** The ID of the merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `labor.timecard.updated`. */ type?: string | null; /** The unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LaborTimecardUpdatedEventData; } diff --git a/src/api/types/LaborTimecardUpdatedEventData.ts b/src/api/types/LaborTimecardUpdatedEventData.ts index a4a26e515..ea42361a1 100644 --- a/src/api/types/LaborTimecardUpdatedEventData.ts +++ b/src/api/types/LaborTimecardUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborTimecardUpdatedEventData { /** The type of object affected by the event. For this event, the value is `timecard`. */ diff --git a/src/api/types/LaborTimecardUpdatedEventObject.ts b/src/api/types/LaborTimecardUpdatedEventObject.ts index 72c23a258..b14d33721 100644 --- a/src/api/types/LaborTimecardUpdatedEventObject.ts +++ b/src/api/types/LaborTimecardUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LaborTimecardUpdatedEventObject { /** The updated `Timecard`. */ diff --git a/src/api/types/LinkCustomerToGiftCardResponse.ts b/src/api/types/LinkCustomerToGiftCardResponse.ts index e0bafe979..5ed6e0762 100644 --- a/src/api/types/LinkCustomerToGiftCardResponse.ts +++ b/src/api/types/LinkCustomerToGiftCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains the linked `GiftCard` object. If the request resulted in errors, @@ -12,5 +12,5 @@ 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; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/ListBankAccountsResponse.ts b/src/api/types/ListBankAccountsResponse.ts index 2ab464731..56b7c5833 100644 --- a/src/api/types/ListBankAccountsResponse.ts +++ b/src/api/types/ListBankAccountsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Response object returned by ListBankAccounts. @@ -11,7 +11,7 @@ export interface ListBankAccountsResponse { /** Information on errors encountered during the request. */ errors?: Square.Error_[]; /** List of BankAccounts associated with this account. */ - bankAccounts?: Square.BankAccount[]; + bank_accounts?: 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. diff --git a/src/api/types/ListBookingCustomAttributeDefinitionsResponse.ts b/src/api/types/ListBookingCustomAttributeDefinitionsResponse.ts index a2513f5fb..4f1133262 100644 --- a/src/api/types/ListBookingCustomAttributeDefinitionsResponse.ts +++ b/src/api/types/ListBookingCustomAttributeDefinitionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListBookingCustomAttributeDefinitions](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributeDefinitions) response. @@ -14,7 +14,7 @@ export interface ListBookingCustomAttributeDefinitionsResponse { * The retrieved custom attribute definitions. If no custom attribute definitions are found, * Square returns an empty object (`{}`). */ - customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + custom_attribute_definitions?: 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 diff --git a/src/api/types/ListBookingCustomAttributesResponse.ts b/src/api/types/ListBookingCustomAttributesResponse.ts index ce84c0459..d625acc93 100644 --- a/src/api/types/ListBookingCustomAttributesResponse.ts +++ b/src/api/types/ListBookingCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListBookingCustomAttributes](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributes) response. @@ -16,7 +16,7 @@ export interface ListBookingCustomAttributesResponse { * * If no custom attributes are found, Square returns an empty object (`{}`). */ - customAttributes?: Square.CustomAttribute[]; + custom_attributes?: 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 diff --git a/src/api/types/ListBookingsResponse.ts b/src/api/types/ListBookingsResponse.ts index e6ec3d16d..b274284d9 100644 --- a/src/api/types/ListBookingsResponse.ts +++ b/src/api/types/ListBookingsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListBookingsResponse { /** The list of targeted bookings. */ diff --git a/src/api/types/ListBreakTypesResponse.ts b/src/api/types/ListBreakTypesResponse.ts index 130fe20ea..e1572f5a6 100644 --- a/src/api/types/ListBreakTypesResponse.ts +++ b/src/api/types/ListBreakTypesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request for a set of `BreakType` objects. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface ListBreakTypesResponse { /** A page of `BreakType` results. */ - breakTypes?: Square.BreakType[]; + break_types?: Square.BreakType[]; /** * The value supplied in the subsequent request to fetch the next page * of `BreakType` results. diff --git a/src/api/types/ListCardsResponse.ts b/src/api/types/ListCardsResponse.ts index 1d62d8cec..e87762e74 100644 --- a/src/api/types/ListCardsResponse.ts +++ b/src/api/types/ListCardsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/ListCashDrawerShiftEventsResponse.ts b/src/api/types/ListCashDrawerShiftEventsResponse.ts index 3383ab7a6..9e48971fe 100644 --- a/src/api/types/ListCashDrawerShiftEventsResponse.ts +++ b/src/api/types/ListCashDrawerShiftEventsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListCashDrawerShiftEventsResponse { /** @@ -16,5 +16,5 @@ export interface ListCashDrawerShiftEventsResponse { * All of the events (payments, refunds, etc.) for a cash drawer during * the shift. */ - cashDrawerShiftEvents?: Square.CashDrawerShiftEvent[]; + cash_drawer_shift_events?: Square.CashDrawerShiftEvent[]; } diff --git a/src/api/types/ListCashDrawerShiftsResponse.ts b/src/api/types/ListCashDrawerShiftsResponse.ts index 3e0d2e263..095fe67ae 100644 --- a/src/api/types/ListCashDrawerShiftsResponse.ts +++ b/src/api/types/ListCashDrawerShiftsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListCashDrawerShiftsResponse { /** @@ -16,5 +16,5 @@ export interface ListCashDrawerShiftsResponse { * A collection of CashDrawerShiftSummary objects for shifts that match * the query. */ - cashDrawerShifts?: Square.CashDrawerShiftSummary[]; + cash_drawer_shifts?: Square.CashDrawerShiftSummary[]; } diff --git a/src/api/types/ListCatalogResponse.ts b/src/api/types/ListCatalogResponse.ts index b1b84b52d..5113a9be0 100644 --- a/src/api/types/ListCatalogResponse.ts +++ b/src/api/types/ListCatalogResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListCatalogResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/ListCustomerCustomAttributeDefinitionsResponse.ts b/src/api/types/ListCustomerCustomAttributeDefinitionsResponse.ts index 4f19c1fb0..0aae1a1b1 100644 --- a/src/api/types/ListCustomerCustomAttributeDefinitionsResponse.ts +++ b/src/api/types/ListCustomerCustomAttributeDefinitionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListCustomerCustomAttributeDefinitions](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributeDefinitions) response. @@ -14,7 +14,7 @@ export interface ListCustomerCustomAttributeDefinitionsResponse { * The retrieved custom attribute definitions. If no custom attribute definitions are found, * Square returns an empty object (`{}`). */ - customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + custom_attribute_definitions?: 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 diff --git a/src/api/types/ListCustomerCustomAttributesResponse.ts b/src/api/types/ListCustomerCustomAttributesResponse.ts index 5a657217d..d13b5722e 100644 --- a/src/api/types/ListCustomerCustomAttributesResponse.ts +++ b/src/api/types/ListCustomerCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributes) response. @@ -16,7 +16,7 @@ export interface ListCustomerCustomAttributesResponse { * * If no custom attributes are found, Square returns an empty object (`{}`). */ - customAttributes?: Square.CustomAttribute[]; + custom_attributes?: 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 diff --git a/src/api/types/ListCustomerGroupsResponse.ts b/src/api/types/ListCustomerGroupsResponse.ts index ac41c182a..5989abcb2 100644 --- a/src/api/types/ListCustomerGroupsResponse.ts +++ b/src/api/types/ListCustomerGroupsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/ListCustomerSegmentsResponse.ts b/src/api/types/ListCustomerSegmentsResponse.ts index 883cea16d..26b4f7bc4 100644 --- a/src/api/types/ListCustomerSegmentsResponse.ts +++ b/src/api/types/ListCustomerSegmentsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint. diff --git a/src/api/types/ListCustomersResponse.ts b/src/api/types/ListCustomersResponse.ts index bfb19bc90..8f4624d13 100644 --- a/src/api/types/ListCustomersResponse.ts +++ b/src/api/types/ListCustomersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -32,5 +32,5 @@ export interface ListCustomersResponse { * (`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; + count?: number | bigint; } diff --git a/src/api/types/ListDeviceCodesResponse.ts b/src/api/types/ListDeviceCodesResponse.ts index 5929459ee..f27ff5841 100644 --- a/src/api/types/ListDeviceCodesResponse.ts +++ b/src/api/types/ListDeviceCodesResponse.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListDeviceCodesResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The queried DeviceCode. */ - deviceCodes?: Square.DeviceCode[]; + device_codes?: 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 diff --git a/src/api/types/ListDevicesResponse.ts b/src/api/types/ListDevicesResponse.ts index d4bb92d53..f578d1fdc 100644 --- a/src/api/types/ListDevicesResponse.ts +++ b/src/api/types/ListDevicesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListDevicesResponse { /** Information about errors that occurred during the request. */ diff --git a/src/api/types/ListDisputeEvidenceResponse.ts b/src/api/types/ListDisputeEvidenceResponse.ts index 5f54466da..386747694 100644 --- a/src/api/types/ListDisputeEvidenceResponse.ts +++ b/src/api/types/ListDisputeEvidenceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields in a `ListDisputeEvidence` response. diff --git a/src/api/types/ListDisputesResponse.ts b/src/api/types/ListDisputesResponse.ts index e5375c429..4f77d1fe1 100644 --- a/src/api/types/ListDisputesResponse.ts +++ b/src/api/types/ListDisputesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines fields in a `ListDisputes` response. diff --git a/src/api/types/ListEmployeeWagesResponse.ts b/src/api/types/ListEmployeeWagesResponse.ts index 942884239..472a628f2 100644 --- a/src/api/types/ListEmployeeWagesResponse.ts +++ b/src/api/types/ListEmployeeWagesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request for a set of `EmployeeWage` objects. The response contains @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface ListEmployeeWagesResponse { /** A page of `EmployeeWage` results. */ - employeeWages?: Square.EmployeeWage[]; + employee_wages?: Square.EmployeeWage[]; /** * The value supplied in the subsequent request to fetch the next page * of `EmployeeWage` results. diff --git a/src/api/types/ListEmployeesResponse.ts b/src/api/types/ListEmployeesResponse.ts index cc7e8a11e..d9a90e6bb 100644 --- a/src/api/types/ListEmployeesResponse.ts +++ b/src/api/types/ListEmployeesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListEmployeesResponse { employees?: Square.Employee[]; diff --git a/src/api/types/ListEventTypesResponse.ts b/src/api/types/ListEventTypesResponse.ts index 109d6e21e..7625dfb62 100644 --- a/src/api/types/ListEventTypesResponse.ts +++ b/src/api/types/ListEventTypesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -15,7 +15,7 @@ export interface ListEventTypesResponse { /** Information on errors encountered during the request. */ errors?: Square.Error_[]; /** The list of event types. */ - eventTypes?: string[]; + event_types?: 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 index 34fc283b3..312a1c329 100644 --- a/src/api/types/ListGiftCardActivitiesResponse.ts +++ b/src/api/types/ListGiftCardActivitiesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors, @@ -12,7 +12,7 @@ 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[]; + gift_card_activities?: 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 diff --git a/src/api/types/ListGiftCardsResponse.ts b/src/api/types/ListGiftCardsResponse.ts index 1b13da7bc..98d02db52 100644 --- a/src/api/types/ListGiftCardsResponse.ts +++ b/src/api/types/ListGiftCardsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains a list of `GiftCard` objects. If the request resulted in errors, @@ -12,7 +12,7 @@ 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[]; + gift_cards?: 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 diff --git a/src/api/types/ListInvoicesResponse.ts b/src/api/types/ListInvoicesResponse.ts index 6e45726bf..7acf9fe23 100644 --- a/src/api/types/ListInvoicesResponse.ts +++ b/src/api/types/ListInvoicesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a `ListInvoice` response. diff --git a/src/api/types/ListJobsResponse.ts b/src/api/types/ListJobsResponse.ts index 5322bc98a..12fc716b3 100644 --- a/src/api/types/ListJobsResponse.ts +++ b/src/api/types/ListJobsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListJobs](api-endpoint:Team-ListJobs) response. Either `jobs` or `errors` diff --git a/src/api/types/ListLocationBookingProfilesResponse.ts b/src/api/types/ListLocationBookingProfilesResponse.ts index b5f346193..d7b49040e 100644 --- a/src/api/types/ListLocationBookingProfilesResponse.ts +++ b/src/api/types/ListLocationBookingProfilesResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListLocationBookingProfilesResponse { /** The list of a seller's location booking profiles. */ - locationBookingProfiles?: Square.LocationBookingProfile[]; + location_booking_profiles?: 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. */ diff --git a/src/api/types/ListLocationCustomAttributeDefinitionsResponse.ts b/src/api/types/ListLocationCustomAttributeDefinitionsResponse.ts index 26b6776aa..3a064ae1d 100644 --- a/src/api/types/ListLocationCustomAttributeDefinitionsResponse.ts +++ b/src/api/types/ListLocationCustomAttributeDefinitionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListLocationCustomAttributeDefinitions](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributeDefinitions) response. @@ -14,7 +14,7 @@ export interface ListLocationCustomAttributeDefinitionsResponse { * The retrieved custom attribute definitions. If no custom attribute definitions are found, * Square returns an empty object (`{}`). */ - customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + custom_attribute_definitions?: 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 diff --git a/src/api/types/ListLocationCustomAttributesResponse.ts b/src/api/types/ListLocationCustomAttributesResponse.ts index c5ddf2867..fde42133d 100644 --- a/src/api/types/ListLocationCustomAttributesResponse.ts +++ b/src/api/types/ListLocationCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListLocationCustomAttributes](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributes) response. @@ -15,7 +15,7 @@ export interface ListLocationCustomAttributesResponse { * 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[]; + custom_attributes?: 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 diff --git a/src/api/types/ListLocationsResponse.ts b/src/api/types/ListLocationsResponse.ts index b03599ce5..83cd385b5 100644 --- a/src/api/types/ListLocationsResponse.ts +++ b/src/api/types/ListLocationsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of a request diff --git a/src/api/types/ListLoyaltyProgramsResponse.ts b/src/api/types/ListLoyaltyProgramsResponse.ts index 8ff095768..7d7f6b1c7 100644 --- a/src/api/types/ListLoyaltyProgramsResponse.ts +++ b/src/api/types/ListLoyaltyProgramsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains all loyalty programs. diff --git a/src/api/types/ListLoyaltyPromotionsResponse.ts b/src/api/types/ListLoyaltyPromotionsResponse.ts index 500c81c9a..64f3a4ec7 100644 --- a/src/api/types/ListLoyaltyPromotionsResponse.ts +++ b/src/api/types/ListLoyaltyPromotionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) response. @@ -13,7 +13,7 @@ export interface ListLoyaltyPromotionsResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The retrieved loyalty promotions. */ - loyaltyPromotions?: Square.LoyaltyPromotion[]; + loyalty_promotions?: 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 diff --git a/src/api/types/ListMerchantCustomAttributeDefinitionsResponse.ts b/src/api/types/ListMerchantCustomAttributeDefinitionsResponse.ts index bc8d167d1..578af9fc6 100644 --- a/src/api/types/ListMerchantCustomAttributeDefinitionsResponse.ts +++ b/src/api/types/ListMerchantCustomAttributeDefinitionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListMerchantCustomAttributeDefinitions](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributeDefinitions) response. @@ -14,7 +14,7 @@ export interface ListMerchantCustomAttributeDefinitionsResponse { * The retrieved custom attribute definitions. If no custom attribute definitions are found, * Square returns an empty object (`{}`). */ - customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + custom_attribute_definitions?: 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 diff --git a/src/api/types/ListMerchantCustomAttributesResponse.ts b/src/api/types/ListMerchantCustomAttributesResponse.ts index 06bd4e2f1..2501054b2 100644 --- a/src/api/types/ListMerchantCustomAttributesResponse.ts +++ b/src/api/types/ListMerchantCustomAttributesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [ListMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributes) response. @@ -15,7 +15,7 @@ export interface ListMerchantCustomAttributesResponse { * 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[]; + custom_attributes?: 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 diff --git a/src/api/types/ListMerchantsResponse.ts b/src/api/types/ListMerchantsResponse.ts index c90dae379..bb6f2dcb5 100644 --- a/src/api/types/ListMerchantsResponse.ts +++ b/src/api/types/ListMerchantsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response object returned by the [ListMerchant](api-endpoint:Merchants-ListMerchants) endpoint. diff --git a/src/api/types/ListOrderCustomAttributeDefinitionsResponse.ts b/src/api/types/ListOrderCustomAttributeDefinitionsResponse.ts index 8acfd8fcb..ea0aafb76 100644 --- a/src/api/types/ListOrderCustomAttributeDefinitionsResponse.ts +++ b/src/api/types/ListOrderCustomAttributeDefinitionsResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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[]; + custom_attribute_definitions: 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. diff --git a/src/api/types/ListOrderCustomAttributesResponse.ts b/src/api/types/ListOrderCustomAttributesResponse.ts index 73595ad53..7b908def6 100644 --- a/src/api/types/ListOrderCustomAttributesResponse.ts +++ b/src/api/types/ListOrderCustomAttributesResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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[]; + custom_attributes?: 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. diff --git a/src/api/types/ListPaymentLinksResponse.ts b/src/api/types/ListPaymentLinksResponse.ts index b380ee63e..12e13a637 100644 --- a/src/api/types/ListPaymentLinksResponse.ts +++ b/src/api/types/ListPaymentLinksResponse.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListPaymentLinksResponse { /** Errors that occurred during the request. */ errors?: Square.Error_[]; /** The list of payment links. */ - paymentLinks?: Square.PaymentLink[]; + payment_links?: 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. diff --git a/src/api/types/ListPaymentRefundsResponse.ts b/src/api/types/ListPaymentRefundsResponse.ts index a2f5aa8e1..fd70a6f33 100644 --- a/src/api/types/ListPaymentRefundsResponse.ts +++ b/src/api/types/ListPaymentRefundsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds). diff --git a/src/api/types/ListPaymentsResponse.ts b/src/api/types/ListPaymentsResponse.ts index 65cb703a0..955421972 100644 --- a/src/api/types/ListPaymentsResponse.ts +++ b/src/api/types/ListPaymentsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by [ListPayments](api-endpoint:Payments-ListPayments). diff --git a/src/api/types/ListPayoutEntriesResponse.ts b/src/api/types/ListPayoutEntriesResponse.ts index fad7d4893..9d138499f 100644 --- a/src/api/types/ListPayoutEntriesResponse.ts +++ b/src/api/types/ListPayoutEntriesResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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[]; + payout_entries?: 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). diff --git a/src/api/types/ListPayoutsResponse.ts b/src/api/types/ListPayoutsResponse.ts index 6a76b4579..1fe6c1db0 100644 --- a/src/api/types/ListPayoutsResponse.ts +++ b/src/api/types/ListPayoutsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to retrieve payout records entries. diff --git a/src/api/types/ListSitesResponse.ts b/src/api/types/ListSitesResponse.ts index 5a329a381..96cb837ca 100644 --- a/src/api/types/ListSitesResponse.ts +++ b/src/api/types/ListSitesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a `ListSites` response. The response can include either `sites` or `errors`. diff --git a/src/api/types/ListSubscriptionEventsResponse.ts b/src/api/types/ListSubscriptionEventsResponse.ts index 2b2f1e37d..b91558404 100644 --- a/src/api/types/ListSubscriptionEventsResponse.ts +++ b/src/api/types/ListSubscriptionEventsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the @@ -12,7 +12,7 @@ export interface ListSubscriptionEventsResponse { /** Errors encountered during the request. */ errors?: Square.Error_[]; /** The retrieved subscription events. */ - subscriptionEvents?: Square.SubscriptionEvent[]; + subscription_events?: 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. diff --git a/src/api/types/ListTeamMemberBookingProfilesResponse.ts b/src/api/types/ListTeamMemberBookingProfilesResponse.ts index 01db09ff2..f031d8534 100644 --- a/src/api/types/ListTeamMemberBookingProfilesResponse.ts +++ b/src/api/types/ListTeamMemberBookingProfilesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ListTeamMemberBookingProfilesResponse { /** @@ -10,7 +10,7 @@ export interface ListTeamMemberBookingProfilesResponse { * 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[]; + team_member_booking_profiles?: 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. */ diff --git a/src/api/types/ListTeamMemberWagesResponse.ts b/src/api/types/ListTeamMemberWagesResponse.ts index 363e6aea4..0bbdc3f8c 100644 --- a/src/api/types/ListTeamMemberWagesResponse.ts +++ b/src/api/types/ListTeamMemberWagesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request for a set of `TeamMemberWage` objects. The response contains @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface ListTeamMemberWagesResponse { /** A page of `TeamMemberWage` results. */ - teamMemberWages?: Square.TeamMemberWage[]; + team_member_wages?: Square.TeamMemberWage[]; /** * The value supplied in the subsequent request to fetch the next page * of `TeamMemberWage` results. diff --git a/src/api/types/ListTransactionsResponse.ts b/src/api/types/ListTransactionsResponse.ts index 515c68cd5..069d95877 100644 --- a/src/api/types/ListTransactionsResponse.ts +++ b/src/api/types/ListTransactionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/ListWebhookEventTypesResponse.ts b/src/api/types/ListWebhookEventTypesResponse.ts index 8f365f9df..a792cbdda 100644 --- a/src/api/types/ListWebhookEventTypesResponse.ts +++ b/src/api/types/ListWebhookEventTypesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -15,7 +15,7 @@ export interface ListWebhookEventTypesResponse { /** Information on errors encountered during the request. */ errors?: Square.Error_[]; /** The list of event types. */ - eventTypes?: string[]; + event_types?: 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 index 968cd9a68..d47dabbb6 100644 --- a/src/api/types/ListWebhookSubscriptionsResponse.ts +++ b/src/api/types/ListWebhookSubscriptionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/ListWorkweekConfigsResponse.ts b/src/api/types/ListWorkweekConfigsResponse.ts index e24e7e639..744153231 100644 --- a/src/api/types/ListWorkweekConfigsResponse.ts +++ b/src/api/types/ListWorkweekConfigsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request for a set of `WorkweekConfig` objects. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface ListWorkweekConfigsResponse { /** A page of `WorkweekConfig` results. */ - workweekConfigs?: Square.WorkweekConfig[]; + workweek_configs?: Square.WorkweekConfig[]; /** * The value supplied in the subsequent request to fetch the next page of * `WorkweekConfig` results. diff --git a/src/api/types/Location.ts b/src/api/types/Location.ts index 070551111..c57e20e88 100644 --- a/src/api/types/Location.ts +++ b/src/api/types/Location.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). @@ -38,9 +38,9 @@ export interface Location { * 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; + created_at?: string; /** The ID of the merchant that owns the location. */ - merchantId?: string; + merchant_id?: string; /** * The country of the location, in the two-letter format of ISO 3166. For example, `US` or `JP`. * @@ -53,7 +53,7 @@ export interface Location { * [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; + language_code?: 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`. @@ -62,28 +62,28 @@ export interface Location { */ currency?: Square.Currency; /** The phone number of the location. For example, `+1 855-700-6000`. */ - phoneNumber?: string | null; + phone_number?: 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; + business_name?: 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; + website_url?: string | null; /** The hours of operation for the location. */ - businessHours?: Square.BusinessHours; + business_hours?: 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; + business_email?: 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; + twitter_username?: string | null; /** The Instagram username of the location without the '@' symbol. For example, `square`. */ - instagramUsername?: string | null; + instagram_username?: 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; + facebook_url?: string | null; /** The physical coordinates (latitude and longitude) of the location. */ coordinates?: Square.Coordinates; /** @@ -91,9 +91,9 @@ export interface Location { * 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; + logo_url?: string; /** The URL of the Point of Sale background image for the location. */ - posBackgroundUrl?: string; + pos_background_url?: 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. @@ -105,7 +105,7 @@ export interface Location { * 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; + full_format_logo_url?: string; /** The tax IDs for this location. */ - taxIds?: Square.TaxIds; + tax_ids?: Square.TaxIds; } diff --git a/src/api/types/LocationBookingProfile.ts b/src/api/types/LocationBookingProfile.ts index c75b777aa..cd35c0dbf 100644 --- a/src/api/types/LocationBookingProfile.ts +++ b/src/api/types/LocationBookingProfile.ts @@ -7,9 +7,9 @@ */ export interface LocationBookingProfile { /** The ID of the [location](entity:Location). */ - locationId?: string | null; + location_id?: string | null; /** Url for the online booking site for this location. */ - bookingSiteUrl?: string | null; + booking_site_url?: string | null; /** Indicates whether the location is enabled for online booking. */ - onlineBookingEnabled?: boolean | null; + online_booking_enabled?: boolean | null; } diff --git a/src/api/types/LocationCreatedEvent.ts b/src/api/types/LocationCreatedEvent.ts index 00654f2b6..c6282869d 100644 --- a/src/api/types/LocationCreatedEvent.ts +++ b/src/api/types/LocationCreatedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Location](entity:Location) is created. */ export interface LocationCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the [Location](entity:Location) associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"location.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.LocationCreatedEventData; } diff --git a/src/api/types/LocationCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/api/types/LocationCustomAttributeDefinitionOwnedCreatedEvent.ts index 5139600a2..74c960c28 100644 --- a/src/api/types/LocationCustomAttributeDefinitionOwnedCreatedEvent.ts +++ b/src/api/types/LocationCustomAttributeDefinitionOwnedCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute definition](entity:CustomAttributeDefinition) @@ -10,13 +10,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeDefinitionOwnedCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute_definition.owned.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/LocationCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/api/types/LocationCustomAttributeDefinitionOwnedDeletedEvent.ts index e0e5da3aa..7b550c822 100644 --- a/src/api/types/LocationCustomAttributeDefinitionOwnedDeletedEvent.ts +++ b/src/api/types/LocationCustomAttributeDefinitionOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeDefinitionOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute_definition.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/LocationCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/api/types/LocationCustomAttributeDefinitionOwnedUpdatedEvent.ts index d187dd3f1..2b1dd546d 100644 --- a/src/api/types/LocationCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ b/src/api/types/LocationCustomAttributeDefinitionOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeDefinitionOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute_definition.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/LocationCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/api/types/LocationCustomAttributeDefinitionVisibleCreatedEvent.ts index e1093a350..479c0137f 100644 --- a/src/api/types/LocationCustomAttributeDefinitionVisibleCreatedEvent.ts +++ b/src/api/types/LocationCustomAttributeDefinitionVisibleCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeDefinitionVisibleCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute_definition.visible.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/LocationCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/api/types/LocationCustomAttributeDefinitionVisibleDeletedEvent.ts index bf624af8b..ab805685b 100644 --- a/src/api/types/LocationCustomAttributeDefinitionVisibleDeletedEvent.ts +++ b/src/api/types/LocationCustomAttributeDefinitionVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute definition](entity:CustomAttributeDefinition) @@ -13,13 +13,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeDefinitionVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute_definition.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/LocationCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/api/types/LocationCustomAttributeDefinitionVisibleUpdatedEvent.ts index dca159f86..5869eadb5 100644 --- a/src/api/types/LocationCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ b/src/api/types/LocationCustomAttributeDefinitionVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute definition](entity:CustomAttributeDefinition) @@ -13,13 +13,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeDefinitionVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute_definition.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/LocationCustomAttributeOwnedDeletedEvent.ts b/src/api/types/LocationCustomAttributeOwnedDeletedEvent.ts index 3fc2337b4..914e87cab 100644 --- a/src/api/types/LocationCustomAttributeOwnedDeletedEvent.ts +++ b/src/api/types/LocationCustomAttributeOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute](entity:CustomAttribute) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/LocationCustomAttributeOwnedUpdatedEvent.ts b/src/api/types/LocationCustomAttributeOwnedUpdatedEvent.ts index 7323a84e1..7b221f386 100644 --- a/src/api/types/LocationCustomAttributeOwnedUpdatedEvent.ts +++ b/src/api/types/LocationCustomAttributeOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute](entity:CustomAttribute) owned by the @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/LocationCustomAttributeVisibleDeletedEvent.ts b/src/api/types/LocationCustomAttributeVisibleDeletedEvent.ts index e9ef28cb5..97c28ac70 100644 --- a/src/api/types/LocationCustomAttributeVisibleDeletedEvent.ts +++ b/src/api/types/LocationCustomAttributeVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute](entity:CustomAttribute) that is visible to the @@ -17,13 +17,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/LocationCustomAttributeVisibleUpdatedEvent.ts b/src/api/types/LocationCustomAttributeVisibleUpdatedEvent.ts index 68db4d117..44efed1e7 100644 --- a/src/api/types/LocationCustomAttributeVisibleUpdatedEvent.ts +++ b/src/api/types/LocationCustomAttributeVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a location [custom attribute](entity:CustomAttribute) that is visible @@ -17,13 +17,13 @@ import * as Square from "../index"; */ export interface LocationCustomAttributeVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"location.custom_attribute.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/LocationSettingsUpdatedEvent.ts b/src/api/types/LocationSettingsUpdatedEvent.ts index d5156843c..a2bea25ae 100644 --- a/src/api/types/LocationSettingsUpdatedEvent.ts +++ b/src/api/types/LocationSettingsUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when online checkout location settings are updated */ export interface LocationSettingsUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"online_checkout.location_settings.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.LocationSettingsUpdatedEventData; } diff --git a/src/api/types/LocationSettingsUpdatedEventData.ts b/src/api/types/LocationSettingsUpdatedEventData.ts index cc5d90a38..1dec4d269 100644 --- a/src/api/types/LocationSettingsUpdatedEventData.ts +++ b/src/api/types/LocationSettingsUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LocationSettingsUpdatedEventData { /** Name of the updated object’s type, `"online_checkout.location_settings"`. */ diff --git a/src/api/types/LocationSettingsUpdatedEventObject.ts b/src/api/types/LocationSettingsUpdatedEventObject.ts index ca7ef9d8e..667243561 100644 --- a/src/api/types/LocationSettingsUpdatedEventObject.ts +++ b/src/api/types/LocationSettingsUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LocationSettingsUpdatedEventObject { /** The updated location settings. */ - locationSettings?: Square.CheckoutLocationSettings; + location_settings?: Square.CheckoutLocationSettings; } diff --git a/src/api/types/LocationUpdatedEvent.ts b/src/api/types/LocationUpdatedEvent.ts index ad9581061..ce44db866 100644 --- a/src/api/types/LocationUpdatedEvent.ts +++ b/src/api/types/LocationUpdatedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Location](entity:Location) is updated. */ export interface LocationUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the [Location](entity:Location) associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"location.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.LocationUpdatedEventData; } diff --git a/src/api/types/LoyaltyAccount.ts b/src/api/types/LoyaltyAccount.ts index 0f8dd4738..1e35e1153 100644 --- a/src/api/types/LoyaltyAccount.ts +++ b/src/api/types/LoyaltyAccount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a loyalty account in a [loyalty program](entity:LoyaltyProgram). For more information, see @@ -12,7 +12,7 @@ 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; + program_id: string; /** * The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field. * @@ -20,9 +20,9 @@ export interface LoyaltyAccount { */ balance?: number; /** The total points accrued during the lifetime of the account. */ - lifetimePoints?: number; + lifetime_points?: number; /** The Square-assigned ID of the [customer](entity:Customer) that is associated with the account. */ - customerId?: string | null; + customer_id?: 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. * @@ -32,11 +32,11 @@ export interface LoyaltyAccount { * 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; + enrolled_at?: string | null; /** The timestamp when the loyalty account was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the loyalty account was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: 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. @@ -50,5 +50,5 @@ export interface LoyaltyAccount { * * The total number of points in this field equals the number of points in the `balance` field. */ - expiringPointDeadlines?: Square.LoyaltyAccountExpiringPointDeadline[] | null; + expiring_point_deadlines?: Square.LoyaltyAccountExpiringPointDeadline[] | null; } diff --git a/src/api/types/LoyaltyAccountCreatedEvent.ts b/src/api/types/LoyaltyAccountCreatedEvent.ts index f903e6b8e..be77d74cb 100644 --- a/src/api/types/LoyaltyAccountCreatedEvent.ts +++ b/src/api/types/LoyaltyAccountCreatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty account](entity:LoyaltyAccount) is created. */ export interface LoyaltyAccountCreatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.account.created`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyAccountCreatedEventData; } diff --git a/src/api/types/LoyaltyAccountCreatedEventData.ts b/src/api/types/LoyaltyAccountCreatedEventData.ts index e2121f78b..e6df7ddc7 100644 --- a/src/api/types/LoyaltyAccountCreatedEventData.ts +++ b/src/api/types/LoyaltyAccountCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.account.created` event. diff --git a/src/api/types/LoyaltyAccountCreatedEventObject.ts b/src/api/types/LoyaltyAccountCreatedEventObject.ts index 42652de88..669c6a9be 100644 --- a/src/api/types/LoyaltyAccountCreatedEventObject.ts +++ b/src/api/types/LoyaltyAccountCreatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LoyaltyAccountCreatedEventObject { /** The loyalty account that was created. */ - loyaltyAccount?: Square.LoyaltyAccount; + loyalty_account?: Square.LoyaltyAccount; } diff --git a/src/api/types/LoyaltyAccountDeletedEvent.ts b/src/api/types/LoyaltyAccountDeletedEvent.ts index 111ab9f04..4bccd6a10 100644 --- a/src/api/types/LoyaltyAccountDeletedEvent.ts +++ b/src/api/types/LoyaltyAccountDeletedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty account](entity:LoyaltyAccount) is deleted. */ export interface LoyaltyAccountDeletedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.account.deleted`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyAccountDeletedEventData; } diff --git a/src/api/types/LoyaltyAccountDeletedEventData.ts b/src/api/types/LoyaltyAccountDeletedEventData.ts index bb91e983f..1ec8cf9b6 100644 --- a/src/api/types/LoyaltyAccountDeletedEventData.ts +++ b/src/api/types/LoyaltyAccountDeletedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.account.deleted` event. diff --git a/src/api/types/LoyaltyAccountDeletedEventObject.ts b/src/api/types/LoyaltyAccountDeletedEventObject.ts index f873af4e0..fe272cec0 100644 --- a/src/api/types/LoyaltyAccountDeletedEventObject.ts +++ b/src/api/types/LoyaltyAccountDeletedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LoyaltyAccountDeletedEventObject { /** The loyalty account that was deleted. */ - loyaltyAccount?: Square.LoyaltyAccount; + loyalty_account?: Square.LoyaltyAccount; } diff --git a/src/api/types/LoyaltyAccountExpiringPointDeadline.ts b/src/api/types/LoyaltyAccountExpiringPointDeadline.ts index 778b340b3..5a9d949f7 100644 --- a/src/api/types/LoyaltyAccountExpiringPointDeadline.ts +++ b/src/api/types/LoyaltyAccountExpiringPointDeadline.ts @@ -9,5 +9,5 @@ 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; + expires_at: string; } diff --git a/src/api/types/LoyaltyAccountMapping.ts b/src/api/types/LoyaltyAccountMapping.ts index 59d14a0b3..0dfb7c863 100644 --- a/src/api/types/LoyaltyAccountMapping.ts +++ b/src/api/types/LoyaltyAccountMapping.ts @@ -12,7 +12,7 @@ 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; + created_at?: string; /** The phone number of the buyer, in E.164 format. For example, "+14155551111". */ - phoneNumber?: string | null; + phone_number?: string | null; } diff --git a/src/api/types/LoyaltyAccountUpdatedEvent.ts b/src/api/types/LoyaltyAccountUpdatedEvent.ts index e42a752b9..05e0d3db5 100644 --- a/src/api/types/LoyaltyAccountUpdatedEvent.ts +++ b/src/api/types/LoyaltyAccountUpdatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty account](entity:LoyaltyAccount) is updated. */ export interface LoyaltyAccountUpdatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.account.updated`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyAccountUpdatedEventData; } diff --git a/src/api/types/LoyaltyAccountUpdatedEventData.ts b/src/api/types/LoyaltyAccountUpdatedEventData.ts index 32ef96617..5baea0699 100644 --- a/src/api/types/LoyaltyAccountUpdatedEventData.ts +++ b/src/api/types/LoyaltyAccountUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.account.updated` event. diff --git a/src/api/types/LoyaltyAccountUpdatedEventObject.ts b/src/api/types/LoyaltyAccountUpdatedEventObject.ts index e9d837fc5..5d0517a57 100644 --- a/src/api/types/LoyaltyAccountUpdatedEventObject.ts +++ b/src/api/types/LoyaltyAccountUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LoyaltyAccountUpdatedEventObject { /** The loyalty account that was updated. */ - loyaltyAccount?: Square.LoyaltyAccount; + loyalty_account?: Square.LoyaltyAccount; } diff --git a/src/api/types/LoyaltyEvent.ts b/src/api/types/LoyaltyEvent.ts index 1f95583c3..a10dd6128 100644 --- a/src/api/types/LoyaltyEvent.ts +++ b/src/api/types/LoyaltyEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Provides information about a loyalty event. @@ -17,30 +17,30 @@ export interface LoyaltyEvent { */ type: Square.LoyaltyEventType; /** The timestamp when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Provides metadata when the event `type` is `ACCUMULATE_POINTS`. */ - accumulatePoints?: Square.LoyaltyEventAccumulatePoints; + accumulate_points?: Square.LoyaltyEventAccumulatePoints; /** Provides metadata when the event `type` is `CREATE_REWARD`. */ - createReward?: Square.LoyaltyEventCreateReward; + create_reward?: Square.LoyaltyEventCreateReward; /** Provides metadata when the event `type` is `REDEEM_REWARD`. */ - redeemReward?: Square.LoyaltyEventRedeemReward; + redeem_reward?: Square.LoyaltyEventRedeemReward; /** Provides metadata when the event `type` is `DELETE_REWARD`. */ - deleteReward?: Square.LoyaltyEventDeleteReward; + delete_reward?: Square.LoyaltyEventDeleteReward; /** Provides metadata when the event `type` is `ADJUST_POINTS`. */ - adjustPoints?: Square.LoyaltyEventAdjustPoints; + adjust_points?: Square.LoyaltyEventAdjustPoints; /** The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event. */ - loyaltyAccountId?: string; + loyalty_account_id?: string; /** The ID of the [location](entity:Location) where the event occurred. */ - locationId?: string; + location_id?: 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; + expire_points?: Square.LoyaltyEventExpirePoints; /** Provides metadata when the event `type` is `OTHER`. */ - otherEvent?: Square.LoyaltyEventOther; + other_event?: Square.LoyaltyEventOther; /** Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. */ - accumulatePromotionPoints?: Square.LoyaltyEventAccumulatePromotionPoints; + accumulate_promotion_points?: Square.LoyaltyEventAccumulatePromotionPoints; } diff --git a/src/api/types/LoyaltyEventAccumulatePoints.ts b/src/api/types/LoyaltyEventAccumulatePoints.ts index 11a26a152..e3e8ebca0 100644 --- a/src/api/types/LoyaltyEventAccumulatePoints.ts +++ b/src/api/types/LoyaltyEventAccumulatePoints.ts @@ -7,12 +7,12 @@ */ export interface LoyaltyEventAccumulatePoints { /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: 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; + order_id?: string | null; } diff --git a/src/api/types/LoyaltyEventAccumulatePromotionPoints.ts b/src/api/types/LoyaltyEventAccumulatePromotionPoints.ts index 9aff14b5d..7c6fa5bb5 100644 --- a/src/api/types/LoyaltyEventAccumulatePromotionPoints.ts +++ b/src/api/types/LoyaltyEventAccumulatePromotionPoints.ts @@ -7,14 +7,14 @@ */ export interface LoyaltyEventAccumulatePromotionPoints { /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: string; /** The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion). */ - loyaltyPromotionId?: string; + loyalty_promotion_id?: 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; + order_id?: string; } diff --git a/src/api/types/LoyaltyEventAdjustPoints.ts b/src/api/types/LoyaltyEventAdjustPoints.ts index 92ea5fca2..4a25fed20 100644 --- a/src/api/types/LoyaltyEventAdjustPoints.ts +++ b/src/api/types/LoyaltyEventAdjustPoints.ts @@ -7,7 +7,7 @@ */ export interface LoyaltyEventAdjustPoints { /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: string; /** The number of points added or removed. */ points: number; /** The reason for the adjustment of points. */ diff --git a/src/api/types/LoyaltyEventCreateReward.ts b/src/api/types/LoyaltyEventCreateReward.ts index 9ca80fbb6..3353de59c 100644 --- a/src/api/types/LoyaltyEventCreateReward.ts +++ b/src/api/types/LoyaltyEventCreateReward.ts @@ -7,12 +7,12 @@ */ export interface LoyaltyEventCreateReward { /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: 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; + reward_id?: string; /** The loyalty points used to create the reward. */ points?: number; } diff --git a/src/api/types/LoyaltyEventCreatedEvent.ts b/src/api/types/LoyaltyEventCreatedEvent.ts index 686c00240..ebe200e57 100644 --- a/src/api/types/LoyaltyEventCreatedEvent.ts +++ b/src/api/types/LoyaltyEventCreatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty event](entity:LoyaltyEvent) is created. */ export interface LoyaltyEventCreatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.event.created`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyEventCreatedEventData; } diff --git a/src/api/types/LoyaltyEventCreatedEventData.ts b/src/api/types/LoyaltyEventCreatedEventData.ts index 874b67bcd..b78537ea0 100644 --- a/src/api/types/LoyaltyEventCreatedEventData.ts +++ b/src/api/types/LoyaltyEventCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.event.created` event. diff --git a/src/api/types/LoyaltyEventCreatedEventObject.ts b/src/api/types/LoyaltyEventCreatedEventObject.ts index 0dd22c3f2..14027b732 100644 --- a/src/api/types/LoyaltyEventCreatedEventObject.ts +++ b/src/api/types/LoyaltyEventCreatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface LoyaltyEventCreatedEventObject { /** The loyalty event that was created. */ - loyaltyEvent?: Square.LoyaltyEvent; + loyalty_event?: Square.LoyaltyEvent; } diff --git a/src/api/types/LoyaltyEventDateTimeFilter.ts b/src/api/types/LoyaltyEventDateTimeFilter.ts index 55bf54033..bbf59cc40 100644 --- a/src/api/types/LoyaltyEventDateTimeFilter.ts +++ b/src/api/types/LoyaltyEventDateTimeFilter.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Filter events by date time range. */ export interface LoyaltyEventDateTimeFilter { /** The `created_at` date time range used to filter the result. */ - createdAt: Square.TimeRange; + created_at: Square.TimeRange; } diff --git a/src/api/types/LoyaltyEventDeleteReward.ts b/src/api/types/LoyaltyEventDeleteReward.ts index 8c4bf1d44..6dfe79307 100644 --- a/src/api/types/LoyaltyEventDeleteReward.ts +++ b/src/api/types/LoyaltyEventDeleteReward.ts @@ -7,12 +7,12 @@ */ export interface LoyaltyEventDeleteReward { /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: string; /** * The ID of the deleted [loyalty reward](entity:LoyaltyReward). * This field is returned only if the event source is `LOYALTY_API`. */ - rewardId?: string; + reward_id?: 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 index 063d100c5..4dd9acbd6 100644 --- a/src/api/types/LoyaltyEventExpirePoints.ts +++ b/src/api/types/LoyaltyEventExpirePoints.ts @@ -7,7 +7,7 @@ */ export interface LoyaltyEventExpirePoints { /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: string; /** The number of points expired. */ points: number; } diff --git a/src/api/types/LoyaltyEventFilter.ts b/src/api/types/LoyaltyEventFilter.ts index 2b0b4788f..71b74bb03 100644 --- a/src/api/types/LoyaltyEventFilter.ts +++ b/src/api/types/LoyaltyEventFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The filtering criteria. If the request specifies multiple filters, @@ -10,17 +10,17 @@ import * as Square from "../index"; */ export interface LoyaltyEventFilter { /** Filter events by loyalty account. */ - loyaltyAccountFilter?: Square.LoyaltyEventLoyaltyAccountFilter; + loyalty_account_filter?: Square.LoyaltyEventLoyaltyAccountFilter; /** Filter events by event type. */ - typeFilter?: Square.LoyaltyEventTypeFilter; + type_filter?: 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; + date_time_filter?: Square.LoyaltyEventDateTimeFilter; /** Filter events by location. */ - locationFilter?: Square.LoyaltyEventLocationFilter; + location_filter?: Square.LoyaltyEventLocationFilter; /** Filter events by the order associated with the event. */ - orderFilter?: Square.LoyaltyEventOrderFilter; + order_filter?: Square.LoyaltyEventOrderFilter; } diff --git a/src/api/types/LoyaltyEventLocationFilter.ts b/src/api/types/LoyaltyEventLocationFilter.ts index 0b3d8fe91..1bb33edfd 100644 --- a/src/api/types/LoyaltyEventLocationFilter.ts +++ b/src/api/types/LoyaltyEventLocationFilter.ts @@ -11,5 +11,5 @@ export interface LoyaltyEventLocationFilter { * If multiple values are specified, the endpoint uses * a logical OR to combine them. */ - locationIds: string[]; + location_ids: string[]; } diff --git a/src/api/types/LoyaltyEventLoyaltyAccountFilter.ts b/src/api/types/LoyaltyEventLoyaltyAccountFilter.ts index a0e04bf97..a06351bfa 100644 --- a/src/api/types/LoyaltyEventLoyaltyAccountFilter.ts +++ b/src/api/types/LoyaltyEventLoyaltyAccountFilter.ts @@ -7,5 +7,5 @@ */ export interface LoyaltyEventLoyaltyAccountFilter { /** The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events. */ - loyaltyAccountId: string; + loyalty_account_id: string; } diff --git a/src/api/types/LoyaltyEventOrderFilter.ts b/src/api/types/LoyaltyEventOrderFilter.ts index b051f9fdd..334006b2c 100644 --- a/src/api/types/LoyaltyEventOrderFilter.ts +++ b/src/api/types/LoyaltyEventOrderFilter.ts @@ -7,5 +7,5 @@ */ export interface LoyaltyEventOrderFilter { /** The ID of the [order](entity:Order) associated with the event. */ - orderId: string; + order_id: string; } diff --git a/src/api/types/LoyaltyEventOther.ts b/src/api/types/LoyaltyEventOther.ts index 3451ccf3a..48df79f52 100644 --- a/src/api/types/LoyaltyEventOther.ts +++ b/src/api/types/LoyaltyEventOther.ts @@ -7,7 +7,7 @@ */ export interface LoyaltyEventOther { /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: string; /** The number of points added or removed. */ points: number; } diff --git a/src/api/types/LoyaltyEventQuery.ts b/src/api/types/LoyaltyEventQuery.ts index 12a06292f..0d33c3507 100644 --- a/src/api/types/LoyaltyEventQuery.ts +++ b/src/api/types/LoyaltyEventQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a query used to search for loyalty events. diff --git a/src/api/types/LoyaltyEventRedeemReward.ts b/src/api/types/LoyaltyEventRedeemReward.ts index 555d84f0d..6a3e1a442 100644 --- a/src/api/types/LoyaltyEventRedeemReward.ts +++ b/src/api/types/LoyaltyEventRedeemReward.ts @@ -7,15 +7,15 @@ */ export interface LoyaltyEventRedeemReward { /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; + loyalty_program_id?: string; /** * The ID of the redeemed [loyalty reward](entity:LoyaltyReward). * This field is returned only if the event source is `LOYALTY_API`. */ - rewardId?: string; + reward_id?: 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; + order_id?: string; } diff --git a/src/api/types/LoyaltyEventTypeFilter.ts b/src/api/types/LoyaltyEventTypeFilter.ts index f8308dd64..33ef38af7 100644 --- a/src/api/types/LoyaltyEventTypeFilter.ts +++ b/src/api/types/LoyaltyEventTypeFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Filter events by event type. diff --git a/src/api/types/LoyaltyProgram.ts b/src/api/types/LoyaltyProgram.ts index 944dfefb2..670f87cae 100644 --- a/src/api/types/LoyaltyProgram.ts +++ b/src/api/types/LoyaltyProgram.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. @@ -21,21 +21,21 @@ export interface LoyaltyProgram { */ status?: Square.LoyaltyProgramStatus; /** The list of rewards for buyers, sorted by ascending points. */ - rewardTiers?: Square.LoyaltyProgramRewardTier[] | null; + reward_tiers?: Square.LoyaltyProgramRewardTier[] | null; /** If present, details for how points expire. */ - expirationPolicy?: Square.LoyaltyProgramExpirationPolicy; + expiration_policy?: 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; + location_ids?: string[] | null; /** The timestamp when the program was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the reward was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: 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; + accrual_rules?: Square.LoyaltyProgramAccrualRule[] | null; } diff --git a/src/api/types/LoyaltyProgramAccrualRule.ts b/src/api/types/LoyaltyProgramAccrualRule.ts index 233cc9068..bbd5bc8b7 100644 --- a/src/api/types/LoyaltyProgramAccrualRule.ts +++ b/src/api/types/LoyaltyProgramAccrualRule.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program](entity:LoyaltyProgram). @@ -12,18 +12,18 @@ 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; + accrual_type: 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; + visit_data?: Square.LoyaltyProgramAccrualRuleVisitData; /** Additional data for rules with the `SPEND` accrual type. */ - spendData?: Square.LoyaltyProgramAccrualRuleSpendData; + spend_data?: Square.LoyaltyProgramAccrualRuleSpendData; /** Additional data for rules with the `ITEM_VARIATION` accrual type. */ - itemVariationData?: Square.LoyaltyProgramAccrualRuleItemVariationData; + item_variation_data?: Square.LoyaltyProgramAccrualRuleItemVariationData; /** Additional data for rules with the `CATEGORY` accrual type. */ - categoryData?: Square.LoyaltyProgramAccrualRuleCategoryData; + category_data?: Square.LoyaltyProgramAccrualRuleCategoryData; } diff --git a/src/api/types/LoyaltyProgramAccrualRuleCategoryData.ts b/src/api/types/LoyaltyProgramAccrualRuleCategoryData.ts index 4fb4d01da..21983f762 100644 --- a/src/api/types/LoyaltyProgramAccrualRuleCategoryData.ts +++ b/src/api/types/LoyaltyProgramAccrualRuleCategoryData.ts @@ -10,5 +10,5 @@ export interface LoyaltyProgramAccrualRuleCategoryData { * The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn * points. */ - categoryId: string; + category_id: string; } diff --git a/src/api/types/LoyaltyProgramAccrualRuleItemVariationData.ts b/src/api/types/LoyaltyProgramAccrualRuleItemVariationData.ts index e3bbea3e7..d378eaede 100644 --- a/src/api/types/LoyaltyProgramAccrualRuleItemVariationData.ts +++ b/src/api/types/LoyaltyProgramAccrualRuleItemVariationData.ts @@ -10,5 +10,5 @@ export interface LoyaltyProgramAccrualRuleItemVariationData { * The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn * points. */ - itemVariationId: string; + item_variation_id: string; } diff --git a/src/api/types/LoyaltyProgramAccrualRuleSpendData.ts b/src/api/types/LoyaltyProgramAccrualRuleSpendData.ts index d89798aaa..e821ba29e 100644 --- a/src/api/types/LoyaltyProgramAccrualRuleSpendData.ts +++ b/src/api/types/LoyaltyProgramAccrualRuleSpendData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents additional data for rules with the `SPEND` accrual type. @@ -12,24 +12,24 @@ 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; + amount_money: 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; + excluded_category_ids?: 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; + excluded_item_variation_ids?: 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; + tax_mode: Square.LoyaltyProgramAccrualRuleTaxMode; } diff --git a/src/api/types/LoyaltyProgramAccrualRuleVisitData.ts b/src/api/types/LoyaltyProgramAccrualRuleVisitData.ts index ca0a7548a..dce37a7de 100644 --- a/src/api/types/LoyaltyProgramAccrualRuleVisitData.ts +++ b/src/api/types/LoyaltyProgramAccrualRuleVisitData.ts @@ -2,18 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + minimum_amount_money?: 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; + tax_mode: Square.LoyaltyProgramAccrualRuleTaxMode; } diff --git a/src/api/types/LoyaltyProgramCreatedEvent.ts b/src/api/types/LoyaltyProgramCreatedEvent.ts index c1acfa5ed..486c72939 100644 --- a/src/api/types/LoyaltyProgramCreatedEvent.ts +++ b/src/api/types/LoyaltyProgramCreatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty program](entity:LoyaltyProgram) is created. */ export interface LoyaltyProgramCreatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.program.created`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyProgramCreatedEventData; } diff --git a/src/api/types/LoyaltyProgramCreatedEventData.ts b/src/api/types/LoyaltyProgramCreatedEventData.ts index 3c93f2b74..4a1fa3c16 100644 --- a/src/api/types/LoyaltyProgramCreatedEventData.ts +++ b/src/api/types/LoyaltyProgramCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.program.created` event. diff --git a/src/api/types/LoyaltyProgramCreatedEventObject.ts b/src/api/types/LoyaltyProgramCreatedEventObject.ts index 5a047e101..359158d8e 100644 --- a/src/api/types/LoyaltyProgramCreatedEventObject.ts +++ b/src/api/types/LoyaltyProgramCreatedEventObject.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the loyalty program associated with a `loyalty.program.created` event. */ export interface LoyaltyProgramCreatedEventObject { /** The loyalty program that was created. */ - loyaltyProgram?: Square.LoyaltyProgram; + loyalty_program?: Square.LoyaltyProgram; } diff --git a/src/api/types/LoyaltyProgramExpirationPolicy.ts b/src/api/types/LoyaltyProgramExpirationPolicy.ts index 8cae0f861..85f1e705a 100644 --- a/src/api/types/LoyaltyProgramExpirationPolicy.ts +++ b/src/api/types/LoyaltyProgramExpirationPolicy.ts @@ -10,5 +10,5 @@ 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; + expiration_duration: string; } diff --git a/src/api/types/LoyaltyProgramRewardTier.ts b/src/api/types/LoyaltyProgramRewardTier.ts index 76b4bebf2..11d623928 100644 --- a/src/api/types/LoyaltyProgramRewardTier.ts +++ b/src/api/types/LoyaltyProgramRewardTier.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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. @@ -15,7 +15,7 @@ export interface LoyaltyProgramRewardTier { /** The name of the reward tier. */ name?: string; /** The timestamp when the reward tier was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** * A reference to the specific version of a `PRICING_RULE` catalog object that contains information about the reward tier discount. * @@ -23,5 +23,5 @@ export interface LoyaltyProgramRewardTier { * 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; + pricing_rule_reference: Square.CatalogObjectReference; } diff --git a/src/api/types/LoyaltyProgramUpdatedEvent.ts b/src/api/types/LoyaltyProgramUpdatedEvent.ts index eba64dade..f391c56a2 100644 --- a/src/api/types/LoyaltyProgramUpdatedEvent.ts +++ b/src/api/types/LoyaltyProgramUpdatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty program](entity:LoyaltyProgram) is updated. */ export interface LoyaltyProgramUpdatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.program.updated`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyProgramUpdatedEventData; } diff --git a/src/api/types/LoyaltyProgramUpdatedEventData.ts b/src/api/types/LoyaltyProgramUpdatedEventData.ts index 4e91d3814..243ebf931 100644 --- a/src/api/types/LoyaltyProgramUpdatedEventData.ts +++ b/src/api/types/LoyaltyProgramUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.program.updated` event. diff --git a/src/api/types/LoyaltyProgramUpdatedEventObject.ts b/src/api/types/LoyaltyProgramUpdatedEventObject.ts index 474f5dea7..8018f1da2 100644 --- a/src/api/types/LoyaltyProgramUpdatedEventObject.ts +++ b/src/api/types/LoyaltyProgramUpdatedEventObject.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the loyalty program associated with a `loyalty.program.updated` event. */ export interface LoyaltyProgramUpdatedEventObject { /** The loyalty program that was updated. */ - loyaltyProgram?: Square.LoyaltyProgram; + loyalty_program?: Square.LoyaltyProgram; } diff --git a/src/api/types/LoyaltyPromotion.ts b/src/api/types/LoyaltyPromotion.ts index df8c25093..aeb97778e 100644 --- a/src/api/types/LoyaltyPromotion.ts +++ b/src/api/types/LoyaltyPromotion.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a promotion for a [loyalty program](entity:LoyaltyProgram). Loyalty promotions enable buyers @@ -21,27 +21,27 @@ export interface LoyaltyPromotion { */ incentive: Square.LoyaltyPromotionIncentive; /** The scheduling information that defines when purchases can qualify to earn points from an `ACTIVE` promotion. */ - availableTime: Square.LoyaltyPromotionAvailableTimeData; + available_time: 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; + trigger_limit?: 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; + created_at?: string; /** The timestamp of when the promotion was canceled, in RFC 3339 format. */ - canceledAt?: string; + canceled_at?: string; /** The timestamp when the promotion was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion. */ - loyaltyProgramId?: string; + loyalty_program_id?: string; /** The minimum purchase amount required to earn promotion points. If specified, this amount is positive. */ - minimumSpendAmountMoney?: Square.Money; + minimum_spend_amount_money?: 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. @@ -51,7 +51,7 @@ export interface LoyaltyPromotion { * * You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both. */ - qualifyingItemVariationIds?: string[] | null; + qualifying_item_variation_ids?: 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. @@ -61,5 +61,5 @@ export interface LoyaltyPromotion { * * You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both. */ - qualifyingCategoryIds?: string[] | null; + qualifying_category_ids?: string[] | null; } diff --git a/src/api/types/LoyaltyPromotionAvailableTimeData.ts b/src/api/types/LoyaltyPromotionAvailableTimeData.ts index ef555493f..05a52709d 100644 --- a/src/api/types/LoyaltyPromotionAvailableTimeData.ts +++ b/src/api/types/LoyaltyPromotionAvailableTimeData.ts @@ -11,13 +11,13 @@ 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; + start_date?: 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; + end_date?: 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. @@ -31,5 +31,5 @@ export interface LoyaltyPromotionAvailableTimeData { * Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request * but are always included in the response. */ - timePeriods: string[]; + time_periods: string[]; } diff --git a/src/api/types/LoyaltyPromotionCreatedEvent.ts b/src/api/types/LoyaltyPromotionCreatedEvent.ts index 5351bf9a9..76285302b 100644 --- a/src/api/types/LoyaltyPromotionCreatedEvent.ts +++ b/src/api/types/LoyaltyPromotionCreatedEvent.ts @@ -2,23 +2,23 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty promotion](entity:LoyaltyPromotion) is created. */ export interface LoyaltyPromotionCreatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.promotion.created`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyPromotionCreatedEventData; } diff --git a/src/api/types/LoyaltyPromotionCreatedEventData.ts b/src/api/types/LoyaltyPromotionCreatedEventData.ts index 6609ce34e..4bff77d19 100644 --- a/src/api/types/LoyaltyPromotionCreatedEventData.ts +++ b/src/api/types/LoyaltyPromotionCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.promotion.created` event. diff --git a/src/api/types/LoyaltyPromotionCreatedEventObject.ts b/src/api/types/LoyaltyPromotionCreatedEventObject.ts index 6385e2e20..08da91f52 100644 --- a/src/api/types/LoyaltyPromotionCreatedEventObject.ts +++ b/src/api/types/LoyaltyPromotionCreatedEventObject.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the loyalty promotion associated with a `loyalty.promotion.created` event. */ export interface LoyaltyPromotionCreatedEventObject { /** The loyalty promotion that was created. */ - loyaltyPromotion?: Square.LoyaltyPromotion; + loyalty_promotion?: Square.LoyaltyPromotion; } diff --git a/src/api/types/LoyaltyPromotionIncentive.ts b/src/api/types/LoyaltyPromotionIncentive.ts index 96aafdd44..2447ea90c 100644 --- a/src/api/types/LoyaltyPromotionIncentive.ts +++ b/src/api/types/LoyaltyPromotionIncentive.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents how points for a [loyalty promotion](entity:LoyaltyPromotion) are calculated, @@ -16,7 +16,7 @@ export interface LoyaltyPromotionIncentive { */ type: Square.LoyaltyPromotionIncentiveType; /** Additional data for a `POINTS_MULTIPLIER` incentive type. */ - pointsMultiplierData?: Square.LoyaltyPromotionIncentivePointsMultiplierData; + points_multiplier_data?: Square.LoyaltyPromotionIncentivePointsMultiplierData; /** Additional data for a `POINTS_ADDITION` incentive type. */ - pointsAdditionData?: Square.LoyaltyPromotionIncentivePointsAdditionData; + points_addition_data?: Square.LoyaltyPromotionIncentivePointsAdditionData; } diff --git a/src/api/types/LoyaltyPromotionIncentivePointsAdditionData.ts b/src/api/types/LoyaltyPromotionIncentivePointsAdditionData.ts index 900a4166a..eb0e71b64 100644 --- a/src/api/types/LoyaltyPromotionIncentivePointsAdditionData.ts +++ b/src/api/types/LoyaltyPromotionIncentivePointsAdditionData.ts @@ -12,5 +12,5 @@ export interface LoyaltyPromotionIncentivePointsAdditionData { * 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; + points_addition: number; } diff --git a/src/api/types/LoyaltyPromotionIncentivePointsMultiplierData.ts b/src/api/types/LoyaltyPromotionIncentivePointsMultiplierData.ts index 1b89d2986..1d5e24080 100644 --- a/src/api/types/LoyaltyPromotionIncentivePointsMultiplierData.ts +++ b/src/api/types/LoyaltyPromotionIncentivePointsMultiplierData.ts @@ -19,7 +19,7 @@ export interface LoyaltyPromotionIncentivePointsMultiplierData { * - This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` * with the equivalent value. */ - pointsMultiplier?: number | null; + points_multiplier?: 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 diff --git a/src/api/types/LoyaltyPromotionTriggerLimit.ts b/src/api/types/LoyaltyPromotionTriggerLimit.ts index 940ec80f3..c217b0462 100644 --- a/src/api/types/LoyaltyPromotionTriggerLimit.ts +++ b/src/api/types/LoyaltyPromotionTriggerLimit.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the number of times a buyer can earn points during a [loyalty promotion](entity:LoyaltyPromotion). diff --git a/src/api/types/LoyaltyPromotionUpdatedEvent.ts b/src/api/types/LoyaltyPromotionUpdatedEvent.ts index 344a7bd25..47ce5cf95 100644 --- a/src/api/types/LoyaltyPromotionUpdatedEvent.ts +++ b/src/api/types/LoyaltyPromotionUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [loyalty promotion](entity:LoyaltyPromotion) is updated. This event is @@ -10,16 +10,16 @@ import * as Square from "../index"; */ export interface LoyaltyPromotionUpdatedEvent { /** The ID of the Square seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event. For this event, the value is `loyalty.promotion.updated`. */ type?: string | null; /** * The unique ID for the event, which is used for * [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices). */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.LoyaltyPromotionUpdatedEventData; } diff --git a/src/api/types/LoyaltyPromotionUpdatedEventData.ts b/src/api/types/LoyaltyPromotionUpdatedEventData.ts index 130e22019..04f7b7e7d 100644 --- a/src/api/types/LoyaltyPromotionUpdatedEventData.ts +++ b/src/api/types/LoyaltyPromotionUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The data associated with a `loyalty.promotion.updated` event. diff --git a/src/api/types/LoyaltyPromotionUpdatedEventObject.ts b/src/api/types/LoyaltyPromotionUpdatedEventObject.ts index 1bae561db..e1190605d 100644 --- a/src/api/types/LoyaltyPromotionUpdatedEventObject.ts +++ b/src/api/types/LoyaltyPromotionUpdatedEventObject.ts @@ -2,12 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that contains the loyalty promotion associated with a `loyalty.promotion.updated` event. */ export interface LoyaltyPromotionUpdatedEventObject { /** The loyalty promotion that was updated. */ - loyaltyPromotion?: Square.LoyaltyPromotion; + loyalty_promotion?: Square.LoyaltyPromotion; } diff --git a/src/api/types/LoyaltyReward.ts b/src/api/types/LoyaltyReward.ts index 9168d20b2..f3bab51e6 100644 --- a/src/api/types/LoyaltyReward.ts +++ b/src/api/types/LoyaltyReward.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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. @@ -17,17 +17,17 @@ export interface LoyaltyReward { */ status?: Square.LoyaltyRewardStatus; /** The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs. */ - loyaltyAccountId: string; + loyalty_account_id: string; /** The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward. */ - rewardTierId: string; + reward_tier_id: 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; + order_id?: string | null; /** The timestamp when the reward was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the reward was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The timestamp when the reward was redeemed, in RFC 3339 format. */ - redeemedAt?: string; + redeemed_at?: string; } diff --git a/src/api/types/MeasurementUnit.ts b/src/api/types/MeasurementUnit.ts index 24a146726..c85660757 100644 --- a/src/api/types/MeasurementUnit.ts +++ b/src/api/types/MeasurementUnit.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a unit of measurement to use with a quantity, such as ounces @@ -14,37 +14,37 @@ 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; + custom_unit?: Square.MeasurementUnitCustom; /** * Represents a standard area unit. * See [MeasurementUnitArea](#type-measurementunitarea) for possible values */ - areaUnit?: Square.MeasurementUnitArea; + area_unit?: Square.MeasurementUnitArea; /** * Represents a standard length unit. * See [MeasurementUnitLength](#type-measurementunitlength) for possible values */ - lengthUnit?: Square.MeasurementUnitLength; + length_unit?: Square.MeasurementUnitLength; /** * Represents a standard volume unit. * See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values */ - volumeUnit?: Square.MeasurementUnitVolume; + volume_unit?: Square.MeasurementUnitVolume; /** * Represents a standard unit of weight or mass. * See [MeasurementUnitWeight](#type-measurementunitweight) for possible values */ - weightUnit?: Square.MeasurementUnitWeight; + weight_unit?: 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; + generic_unit?: Square.MeasurementUnitGeneric; /** * Represents a standard unit of time. * See [MeasurementUnitTime](#type-measurementunittime) for possible values */ - timeUnit?: Square.MeasurementUnitTime; + time_unit?: Square.MeasurementUnitTime; /** * Represents the type of the measurement unit. * See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values diff --git a/src/api/types/Merchant.ts b/src/api/types/Merchant.ts index d57d5dff7..ba31cec3c 100644 --- a/src/api/types/Merchant.ts +++ b/src/api/types/Merchant.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a business that sells with Square. @@ -11,14 +11,14 @@ export interface Merchant { /** The Square-issued ID of the merchant. */ id?: string; /** The name of the merchant's overall business. */ - businessName?: string | null; + business_name?: 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; + language_code?: 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 @@ -30,10 +30,10 @@ export interface Merchant { */ 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; + main_location_id?: 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; + created_at?: string; } diff --git a/src/api/types/MerchantCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/api/types/MerchantCustomAttributeDefinitionOwnedCreatedEvent.ts index b0451b41a..17085d36d 100644 --- a/src/api/types/MerchantCustomAttributeDefinitionOwnedCreatedEvent.ts +++ b/src/api/types/MerchantCustomAttributeDefinitionOwnedCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeDefinitionOwnedCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute_definition.owned.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/MerchantCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/api/types/MerchantCustomAttributeDefinitionOwnedDeletedEvent.ts index 533e9c170..621a8b797 100644 --- a/src/api/types/MerchantCustomAttributeDefinitionOwnedDeletedEvent.ts +++ b/src/api/types/MerchantCustomAttributeDefinitionOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeDefinitionOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute_definition.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/MerchantCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/api/types/MerchantCustomAttributeDefinitionOwnedUpdatedEvent.ts index 0b18b5657..47c653cb9 100644 --- a/src/api/types/MerchantCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ b/src/api/types/MerchantCustomAttributeDefinitionOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeDefinitionOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute_definition.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/MerchantCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/api/types/MerchantCustomAttributeDefinitionVisibleCreatedEvent.ts index 37e808296..87ff7c6c7 100644 --- a/src/api/types/MerchantCustomAttributeDefinitionVisibleCreatedEvent.ts +++ b/src/api/types/MerchantCustomAttributeDefinitionVisibleCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeDefinitionVisibleCreatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute_definition.visible.created"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/MerchantCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/api/types/MerchantCustomAttributeDefinitionVisibleDeletedEvent.ts index 43aba2dd7..a3dd77122 100644 --- a/src/api/types/MerchantCustomAttributeDefinitionVisibleDeletedEvent.ts +++ b/src/api/types/MerchantCustomAttributeDefinitionVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeDefinitionVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute_definition.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/MerchantCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/api/types/MerchantCustomAttributeDefinitionVisibleUpdatedEvent.ts index 078ff840f..67fcf7705 100644 --- a/src/api/types/MerchantCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ b/src/api/types/MerchantCustomAttributeDefinitionVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeDefinitionVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute_definition.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/MerchantCustomAttributeOwnedDeletedEvent.ts b/src/api/types/MerchantCustomAttributeOwnedDeletedEvent.ts index 3c08c957b..35b56dc73 100644 --- a/src/api/types/MerchantCustomAttributeOwnedDeletedEvent.ts +++ b/src/api/types/MerchantCustomAttributeOwnedDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute](entity:CustomAttribute) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeOwnedDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute.owned.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/MerchantCustomAttributeOwnedUpdatedEvent.ts b/src/api/types/MerchantCustomAttributeOwnedUpdatedEvent.ts index af81e52f6..e573491b4 100644 --- a/src/api/types/MerchantCustomAttributeOwnedUpdatedEvent.ts +++ b/src/api/types/MerchantCustomAttributeOwnedUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute](entity:CustomAttribute) @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeOwnedUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute.owned.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/MerchantCustomAttributeVisibleDeletedEvent.ts b/src/api/types/MerchantCustomAttributeVisibleDeletedEvent.ts index b83c5ad28..af519e3fe 100644 --- a/src/api/types/MerchantCustomAttributeVisibleDeletedEvent.ts +++ b/src/api/types/MerchantCustomAttributeVisibleDeletedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute](entity:CustomAttribute) with @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeVisibleDeletedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute.visible.deleted"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/MerchantCustomAttributeVisibleUpdatedEvent.ts b/src/api/types/MerchantCustomAttributeVisibleUpdatedEvent.ts index 96b485192..4b09262fd 100644 --- a/src/api/types/MerchantCustomAttributeVisibleUpdatedEvent.ts +++ b/src/api/types/MerchantCustomAttributeVisibleUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant [custom attribute](entity:CustomAttribute) with @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface MerchantCustomAttributeVisibleUpdatedEvent { /** The ID of the seller associated with the event that triggered the event notification. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"merchant.custom_attribute.visible.updated"`. */ type?: string | null; /** A unique ID for the event notification. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp that indicates when the event notification was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event that triggered the event notification. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/MerchantSettingsUpdatedEvent.ts b/src/api/types/MerchantSettingsUpdatedEvent.ts index 03e615b56..d8b3e1b04 100644 --- a/src/api/types/MerchantSettingsUpdatedEvent.ts +++ b/src/api/types/MerchantSettingsUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when online checkout merchant settings are updated */ export interface MerchantSettingsUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"online_checkout.merchant_settings.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.MerchantSettingsUpdatedEventData; } diff --git a/src/api/types/MerchantSettingsUpdatedEventData.ts b/src/api/types/MerchantSettingsUpdatedEventData.ts index e4d739c63..1dcaa5ff3 100644 --- a/src/api/types/MerchantSettingsUpdatedEventData.ts +++ b/src/api/types/MerchantSettingsUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface MerchantSettingsUpdatedEventData { /** Name of the updated object’s type, `"online_checkout.merchant_settings"`. */ diff --git a/src/api/types/MerchantSettingsUpdatedEventObject.ts b/src/api/types/MerchantSettingsUpdatedEventObject.ts index 32b98e67b..013d80719 100644 --- a/src/api/types/MerchantSettingsUpdatedEventObject.ts +++ b/src/api/types/MerchantSettingsUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface MerchantSettingsUpdatedEventObject { /** The updated merchant settings. */ - merchantSettings?: Square.CheckoutMerchantSettings; + merchant_settings?: Square.CheckoutMerchantSettings; } diff --git a/src/api/types/ModifierLocationOverrides.ts b/src/api/types/ModifierLocationOverrides.ts index fc4f18ebd..2f6f3f85e 100644 --- a/src/api/types/ModifierLocationOverrides.ts +++ b/src/api/types/ModifierLocationOverrides.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + location_id?: 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; + price_money?: 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; + sold_out?: boolean; } diff --git a/src/api/types/Money.ts b/src/api/types/Money.ts index a49a8633f..017ae70f4 100644 --- a/src/api/types/Money.ts +++ b/src/api/types/Money.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an amount of money. `Money` fields can be signed or unsigned. @@ -19,7 +19,7 @@ export interface Money { * 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; + amount?: (number | bigint) | null; /** * The type of currency, in __ISO 4217 format__. For example, the currency * code for US dollars is `USD`. diff --git a/src/api/types/OauthAuthorizationRevokedEvent.ts b/src/api/types/OauthAuthorizationRevokedEvent.ts index f10413cce..d5db705fc 100644 --- a/src/api/types/OauthAuthorizationRevokedEvent.ts +++ b/src/api/types/OauthAuthorizationRevokedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a merchant/application revokes all access tokens and refresh tokens granted to an application. */ export interface OauthAuthorizationRevokedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"oauth.authorization.revoked"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.OauthAuthorizationRevokedEventData; } diff --git a/src/api/types/OauthAuthorizationRevokedEventData.ts b/src/api/types/OauthAuthorizationRevokedEventData.ts index 3cd2ae5da..0083d4ced 100644 --- a/src/api/types/OauthAuthorizationRevokedEventData.ts +++ b/src/api/types/OauthAuthorizationRevokedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OauthAuthorizationRevokedEventData { /** Name of the affected object’s type, `"revocation"`. */ diff --git a/src/api/types/OauthAuthorizationRevokedEventObject.ts b/src/api/types/OauthAuthorizationRevokedEventObject.ts index a95fcc143..e3227141f 100644 --- a/src/api/types/OauthAuthorizationRevokedEventObject.ts +++ b/src/api/types/OauthAuthorizationRevokedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OauthAuthorizationRevokedEventObject { /** The revocation event. */ diff --git a/src/api/types/OauthAuthorizationRevokedEventRevocationObject.ts b/src/api/types/OauthAuthorizationRevokedEventRevocationObject.ts index e22a2cfe7..70bd20533 100644 --- a/src/api/types/OauthAuthorizationRevokedEventRevocationObject.ts +++ b/src/api/types/OauthAuthorizationRevokedEventRevocationObject.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OauthAuthorizationRevokedEventRevocationObject { /** Timestamp of when the revocation event occurred, in RFC 3339 format. */ - revokedAt?: string | null; + revoked_at?: string | null; /** * Type of client that performed the revocation, either APPLICATION, MERCHANT, or SQUARE. * See [OauthAuthorizationRevokedEventRevokerType](#type-oauthauthorizationrevokedeventrevokertype) for possible values */ - revokerType?: Square.OauthAuthorizationRevokedEventRevokerType; + revoker_type?: Square.OauthAuthorizationRevokedEventRevokerType; } diff --git a/src/api/types/ObtainTokenResponse.ts b/src/api/types/ObtainTokenResponse.ts index 743942131..57ee09d9b 100644 --- a/src/api/types/ObtainTokenResponse.ts +++ b/src/api/types/ObtainTokenResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [ObtainToken](api-endpoint:OAuth-ObtainToken) response. @@ -16,24 +16,24 @@ export interface ObtainTokenResponse { * `ObtainToken` and provide the returned `refresh_token` to get a new access token well before * the current one expires. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough). */ - accessToken?: string; + access_token?: string; /** The type of access token. This value is always `bearer`. */ - tokenType?: string; + token_type?: string; /** The timestamp of when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. */ - expiresAt?: string; + expires_at?: string; /** The ID of the authorizing [merchant](entity:Merchant) (seller), which represents a business. */ - merchantId?: string; + merchant_id?: string; /** * __LEGACY__ The ID of merchant's subscription. * The ID is only present if the merchant signed up for a subscription plan during authorization. */ - subscriptionId?: string; + subscription_id?: string; /** * __LEGACY__ 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; + plan_id?: string; /** * The OpenID token that belongs to this person. This token is only present if the * `OPENID` scope is included in the authorization request. @@ -41,7 +41,7 @@ export interface ObtainTokenResponse { * Deprecated at version 2021-09-15. Square doesn't support OpenID or other single sign-on (SSO) * protocols on top of OAuth. */ - idToken?: string; + id_token?: string; /** * A refresh token that can be used in an `ObtainToken` request to generate a new access token. * @@ -55,12 +55,12 @@ export interface ObtainTokenResponse { * * 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; + refresh_token?: string; /** * Indicates whether the access_token is short lived. If `true`, the access token expires * in 24 hours. If `false`, the access token expires in 30 days. */ - shortLived?: boolean; + short_lived?: boolean; /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** @@ -69,5 +69,5 @@ export interface ObtainTokenResponse { * * This field is only returned for the PKCE flow. */ - refreshTokenExpiresAt?: string; + refresh_token_expires_at?: string; } diff --git a/src/api/types/OfflinePaymentDetails.ts b/src/api/types/OfflinePaymentDetails.ts index d82128b4a..18e5638a4 100644 --- a/src/api/types/OfflinePaymentDetails.ts +++ b/src/api/types/OfflinePaymentDetails.ts @@ -7,5 +7,5 @@ */ export interface OfflinePaymentDetails { /** The client-side timestamp of when the offline payment was created, in RFC 3339 format. */ - clientCreatedAt?: string; + client_created_at?: string; } diff --git a/src/api/types/Order.ts b/src/api/types/Order.ts index 4445dcd7d..934b0e528 100644 --- a/src/api/types/Order.ts +++ b/src/api/types/Order.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains all information related to a single order to process with Square, @@ -16,12 +16,12 @@ export interface Order { /** The order's unique ID. */ id?: string; /** The ID of the seller location that this order is associated with. */ - locationId: string; + location_id: string; /** * A client-specified ID to associate an entity in another system * with this order. */ - referenceId?: string | null; + reference_id?: string | null; /** The origination details of the order. */ source?: Square.OrderSource; /** @@ -31,9 +31,9 @@ export interface Order { * 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; + customer_id?: string | null; /** The line items included in the order. */ - lineItems?: Square.OrderLineItem[] | null; + line_items?: Square.OrderLineItem[] | null; /** * The list of all taxes associated with the order. * @@ -62,7 +62,7 @@ export interface Order { */ discounts?: Square.OrderLineItemDiscount[] | null; /** A list of service charges applied to the order. */ - serviceCharges?: Square.OrderServiceCharge[] | null; + service_charges?: Square.OrderServiceCharge[] | null; /** * Details about order fulfillment. * @@ -77,15 +77,15 @@ export interface Order { */ returns?: Square.OrderReturn[]; /** The rollup of the returned money amounts. */ - returnAmounts?: Square.OrderMoneyAmounts; + return_amounts?: Square.OrderMoneyAmounts; /** The net money amounts (sale money - return money). */ - netAmounts?: Square.OrderMoneyAmounts; + net_amounts?: 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; + rounding_adjustment?: Square.OrderRoundingAdjustment; /** The tenders that were used to pay for the order. */ tenders?: Square.Tender[]; /** The refunds that are part of this order. */ @@ -112,11 +112,11 @@ export interface Order { */ 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; + created_at?: 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; + updated_at?: 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; + closed_at?: string; /** * The current state of the order. * See [OrderState](#type-orderstate) for possible values @@ -131,13 +131,13 @@ export interface Order { */ version?: number; /** The total amount of money to collect for the order. */ - totalMoney?: Square.Money; + total_money?: Square.Money; /** The total amount of tax money to collect for the order. */ - totalTaxMoney?: Square.Money; + total_tax_money?: Square.Money; /** The total amount of discount money to collect for the order. */ - totalDiscountMoney?: Square.Money; + total_discount_money?: Square.Money; /** The total amount of tip money to collect for the order. */ - totalTipMoney?: Square.Money; + total_tip_money?: Square.Money; /** * The total amount of money collected in service charges for the order. * @@ -145,20 +145,20 @@ export interface Order { * service charge. Therefore, `total_service_charge_money` only includes inclusive tax amounts, * not additive tax amounts. */ - totalServiceChargeMoney?: Square.Money; + total_service_charge_money?: 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; + ticket_name?: 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; + pricing_options?: 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; + net_amount_due_money?: Square.Money; } diff --git a/src/api/types/OrderCreated.ts b/src/api/types/OrderCreated.ts index fc76f4128..3a8586163 100644 --- a/src/api/types/OrderCreated.ts +++ b/src/api/types/OrderCreated.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderCreated { /** The order's unique ID. */ - orderId?: string | null; + order_id?: 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 @@ -16,12 +16,12 @@ export interface OrderCreated { */ version?: number; /** The ID of the seller location that this order is associated with. */ - locationId?: string | null; + location_id?: string | null; /** * The state of the order. * See [OrderState](#type-orderstate) for possible values */ state?: Square.OrderState; /** The timestamp for when the order was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; } diff --git a/src/api/types/OrderCreatedEvent.ts b/src/api/types/OrderCreatedEvent.ts index 27cbad469..078b6f82c 100644 --- a/src/api/types/OrderCreatedEvent.ts +++ b/src/api/types/OrderCreatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an [Order](entity:Order) is created. This event is @@ -12,13 +12,13 @@ import * as Square from "../index"; */ export interface OrderCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"order.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.OrderCreatedEventData; } diff --git a/src/api/types/OrderCreatedEventData.ts b/src/api/types/OrderCreatedEventData.ts index 5cc34d44f..4518222b3 100644 --- a/src/api/types/OrderCreatedEventData.ts +++ b/src/api/types/OrderCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderCreatedEventData { /** Name of the affected object’s type, `"order_created"`. */ diff --git a/src/api/types/OrderCreatedObject.ts b/src/api/types/OrderCreatedObject.ts index 228dfb0dc..c7fc7a022 100644 --- a/src/api/types/OrderCreatedObject.ts +++ b/src/api/types/OrderCreatedObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderCreatedObject { /** Information about the created order. */ - orderCreated?: Square.OrderCreated; + order_created?: Square.OrderCreated; } diff --git a/src/api/types/OrderCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/api/types/OrderCustomAttributeDefinitionOwnedCreatedEvent.ts index 5f129058a..b363222fa 100644 --- a/src/api/types/OrderCustomAttributeDefinitionOwnedCreatedEvent.ts +++ b/src/api/types/OrderCustomAttributeDefinitionOwnedCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is created. */ export interface OrderCustomAttributeDefinitionOwnedCreatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute_definition.owned.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/OrderCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/api/types/OrderCustomAttributeDefinitionOwnedDeletedEvent.ts index 87c99a7aa..ed584082b 100644 --- a/src/api/types/OrderCustomAttributeDefinitionOwnedDeletedEvent.ts +++ b/src/api/types/OrderCustomAttributeDefinitionOwnedDeletedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted. */ export interface OrderCustomAttributeDefinitionOwnedDeletedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute_definition.owned.deleted"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/OrderCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/api/types/OrderCustomAttributeDefinitionOwnedUpdatedEvent.ts index beeb443d6..8edd11da6 100644 --- a/src/api/types/OrderCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ b/src/api/types/OrderCustomAttributeDefinitionOwnedUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated. */ export interface OrderCustomAttributeDefinitionOwnedUpdatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute_definition.owned.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/OrderCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/api/types/OrderCustomAttributeDefinitionVisibleCreatedEvent.ts index 4dddaa8ef..9ab9446ad 100644 --- a/src/api/types/OrderCustomAttributeDefinitionVisibleCreatedEvent.ts +++ b/src/api/types/OrderCustomAttributeDefinitionVisibleCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is created. */ export interface OrderCustomAttributeDefinitionVisibleCreatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute_definition.visible.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/OrderCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/api/types/OrderCustomAttributeDefinitionVisibleDeletedEvent.ts index 6b6dc2e5b..4d5d33422 100644 --- a/src/api/types/OrderCustomAttributeDefinitionVisibleDeletedEvent.ts +++ b/src/api/types/OrderCustomAttributeDefinitionVisibleDeletedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is deleted. */ export interface OrderCustomAttributeDefinitionVisibleDeletedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute_definition.visible.deleted"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/OrderCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/api/types/OrderCustomAttributeDefinitionVisibleUpdatedEvent.ts index 34d7b3031..4d42bf4ef 100644 --- a/src/api/types/OrderCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ b/src/api/types/OrderCustomAttributeDefinitionVisibleUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is updated. */ export interface OrderCustomAttributeDefinitionVisibleUpdatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute_definition.visible.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeDefinitionEventData; } diff --git a/src/api/types/OrderCustomAttributeOwnedDeletedEvent.ts b/src/api/types/OrderCustomAttributeOwnedDeletedEvent.ts index 3d31e8a36..191abd98b 100644 --- a/src/api/types/OrderCustomAttributeOwnedDeletedEvent.ts +++ b/src/api/types/OrderCustomAttributeOwnedDeletedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted. */ export interface OrderCustomAttributeOwnedDeletedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute.owned.deleted"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/OrderCustomAttributeOwnedUpdatedEvent.ts b/src/api/types/OrderCustomAttributeOwnedUpdatedEvent.ts index 0ec5b4d1a..1640b11b8 100644 --- a/src/api/types/OrderCustomAttributeOwnedUpdatedEvent.ts +++ b/src/api/types/OrderCustomAttributeOwnedUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated. */ export interface OrderCustomAttributeOwnedUpdatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute.owned.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/OrderCustomAttributeVisibleDeletedEvent.ts b/src/api/types/OrderCustomAttributeVisibleDeletedEvent.ts index 00b526c6f..af3b2f6c9 100644 --- a/src/api/types/OrderCustomAttributeVisibleDeletedEvent.ts +++ b/src/api/types/OrderCustomAttributeVisibleDeletedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is deleted. */ export interface OrderCustomAttributeVisibleDeletedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute.visible.deleted"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/OrderCustomAttributeVisibleUpdatedEvent.ts b/src/api/types/OrderCustomAttributeVisibleUpdatedEvent.ts index 55d63c538..adf2ee907 100644 --- a/src/api/types/OrderCustomAttributeVisibleUpdatedEvent.ts +++ b/src/api/types/OrderCustomAttributeVisibleUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is updated. */ export interface OrderCustomAttributeVisibleUpdatedEvent { /** The ID of the target seller associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of this event. The value is `"order.custom_attribute.visible.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The data associated with the event. */ data?: Square.CustomAttributeEventData; } diff --git a/src/api/types/OrderEntry.ts b/src/api/types/OrderEntry.ts index 1d662c616..9b817b79d 100644 --- a/src/api/types/OrderEntry.ts +++ b/src/api/types/OrderEntry.ts @@ -8,7 +8,7 @@ */ export interface OrderEntry { /** The ID of the order. */ - orderId?: string | null; + order_id?: 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 @@ -18,5 +18,5 @@ export interface OrderEntry { */ version?: number; /** The location ID the order belongs to. */ - locationId?: string | null; + location_id?: string | null; } diff --git a/src/api/types/OrderFulfillmentUpdated.ts b/src/api/types/OrderFulfillmentUpdated.ts index 088c57d49..944e035c9 100644 --- a/src/api/types/OrderFulfillmentUpdated.ts +++ b/src/api/types/OrderFulfillmentUpdated.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderFulfillmentUpdated { /** The order's unique ID. */ - orderId?: string | null; + order_id?: 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 @@ -16,16 +16,16 @@ export interface OrderFulfillmentUpdated { */ version?: number; /** The ID of the seller location that this order is associated with. */ - locationId?: string | null; + location_id?: string | null; /** * The state of the order. * See [OrderState](#type-orderstate) for possible values */ state?: Square.OrderState; /** The timestamp for when the order was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp for when the order was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** The fulfillments that were updated with this version change. */ - fulfillmentUpdate?: Square.OrderFulfillmentUpdatedUpdate[] | null; + fulfillment_update?: Square.OrderFulfillmentUpdatedUpdate[] | null; } diff --git a/src/api/types/OrderFulfillmentUpdatedEvent.ts b/src/api/types/OrderFulfillmentUpdatedEvent.ts index c396022e6..b29e90bcb 100644 --- a/src/api/types/OrderFulfillmentUpdatedEvent.ts +++ b/src/api/types/OrderFulfillmentUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an [OrderFulfillment](entity:OrderFulfillment) @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface OrderFulfillmentUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"order.fulfillment.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.OrderFulfillmentUpdatedEventData; } diff --git a/src/api/types/OrderFulfillmentUpdatedEventData.ts b/src/api/types/OrderFulfillmentUpdatedEventData.ts index ea8cfcf5e..5f7ed3c97 100644 --- a/src/api/types/OrderFulfillmentUpdatedEventData.ts +++ b/src/api/types/OrderFulfillmentUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderFulfillmentUpdatedEventData { /** Name of the affected object’s type, `"order_fulfillment_updated"`. */ diff --git a/src/api/types/OrderFulfillmentUpdatedObject.ts b/src/api/types/OrderFulfillmentUpdatedObject.ts index 5c587e29f..fa132c491 100644 --- a/src/api/types/OrderFulfillmentUpdatedObject.ts +++ b/src/api/types/OrderFulfillmentUpdatedObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderFulfillmentUpdatedObject { /** Information about the updated order fulfillment. */ - orderFulfillmentUpdated?: Square.OrderFulfillmentUpdated; + order_fulfillment_updated?: Square.OrderFulfillmentUpdated; } diff --git a/src/api/types/OrderFulfillmentUpdatedUpdate.ts b/src/api/types/OrderFulfillmentUpdatedUpdate.ts index 266b6d6e4..5ceec2367 100644 --- a/src/api/types/OrderFulfillmentUpdatedUpdate.ts +++ b/src/api/types/OrderFulfillmentUpdatedUpdate.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Information about fulfillment updates. */ export interface OrderFulfillmentUpdatedUpdate { /** A unique ID that identifies the fulfillment only within this order. */ - fulfillmentUid?: string | null; + fulfillment_uid?: string | null; /** * The state of the fulfillment before the change. * The state is not populated if the fulfillment is created with this new `Order` version. */ - oldState?: Square.FulfillmentState; + old_state?: Square.FulfillmentState; /** * The state of the fulfillment after the change. The state might be equal to `old_state` if a non-state * field was changed on the fulfillment (such as the tracking number). */ - newState?: Square.FulfillmentState; + new_state?: Square.FulfillmentState; } diff --git a/src/api/types/OrderLineItem.ts b/src/api/types/OrderLineItem.ts index bba33a54e..149e9338c 100644 --- a/src/api/types/OrderLineItem.ts +++ b/src/api/types/OrderLineItem.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a line item in an order. Each line item describes a different @@ -27,21 +27,21 @@ export interface OrderLineItem { */ quantity: string; /** The measurement unit and decimal precision that this line item's quantity is measured in. */ - quantityUnit?: Square.OrderQuantityUnit; + quantity_unit?: 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; + catalog_object_id?: string | null; /** The version of the catalog object that this line item references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The name of the variation applied to this line item. */ - variationName?: string | null; + variation_name?: 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; + item_type?: 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 @@ -78,7 +78,7 @@ export interface OrderLineItem { * * To change the amount of a tax, modify the referenced top-level tax. */ - appliedTaxes?: Square.OrderLineItemAppliedTax[] | null; + applied_taxes?: 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 @@ -92,7 +92,7 @@ export interface OrderLineItem { * * To change the amount of a discount, modify the referenced top-level discount. */ - appliedDiscounts?: Square.OrderLineItemAppliedDiscount[] | null; + applied_discounts?: 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 @@ -101,34 +101,34 @@ export interface OrderLineItem { * * To change the amount of a service charge, modify the referenced top-level service charge. */ - appliedServiceCharges?: Square.OrderLineItemAppliedServiceCharge[] | null; + applied_service_charges?: Square.OrderLineItemAppliedServiceCharge[] | null; /** The base price for a single unit of the line item. */ - basePriceMoney?: Square.Money; + base_price_money?: 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; + variation_total_price_money?: 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; + gross_sales_money?: Square.Money; /** The total amount of tax money to collect for the line item. */ - totalTaxMoney?: Square.Money; + total_tax_money?: Square.Money; /** The total amount of discount money to collect for the line item. */ - totalDiscountMoney?: Square.Money; + total_discount_money?: Square.Money; /** The total amount of money to collect for this line item. */ - totalMoney?: Square.Money; + total_money?: 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; + pricing_blocklists?: Square.OrderLineItemPricingBlocklists; /** The total amount of apportioned service charge money to collect for the line item. */ - totalServiceChargeMoney?: Square.Money; + total_service_charge_money?: Square.Money; } diff --git a/src/api/types/OrderLineItemAppliedDiscount.ts b/src/api/types/OrderLineItemAppliedDiscount.ts index fca878465..624d6478a 100644 --- a/src/api/types/OrderLineItemAppliedDiscount.ts +++ b/src/api/types/OrderLineItemAppliedDiscount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an applied portion of a discount to a line item in an order. @@ -22,7 +22,7 @@ export interface OrderLineItemAppliedDiscount { * 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; + discount_uid: string; /** The amount of money applied by the discount to the line item. */ - appliedMoney?: Square.Money; + applied_money?: Square.Money; } diff --git a/src/api/types/OrderLineItemAppliedServiceCharge.ts b/src/api/types/OrderLineItemAppliedServiceCharge.ts index a33c341e0..70da2ea42 100644 --- a/src/api/types/OrderLineItemAppliedServiceCharge.ts +++ b/src/api/types/OrderLineItemAppliedServiceCharge.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderLineItemAppliedServiceCharge { /** A unique ID that identifies the applied service charge only within this order. */ @@ -14,7 +14,7 @@ export interface OrderLineItemAppliedServiceCharge { * This field is immutable. To change which service charges apply to a line item, * delete and add a new `OrderLineItemAppliedServiceCharge`. */ - serviceChargeUid: string; + service_charge_uid: string; /** The amount of money applied by the service charge to the line item. */ - appliedMoney?: Square.Money; + applied_money?: Square.Money; } diff --git a/src/api/types/OrderLineItemAppliedTax.ts b/src/api/types/OrderLineItemAppliedTax.ts index f858e9670..c0ac8663a 100644 --- a/src/api/types/OrderLineItemAppliedTax.ts +++ b/src/api/types/OrderLineItemAppliedTax.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an applied portion of a tax to a line item in an order. @@ -22,7 +22,7 @@ export interface OrderLineItemAppliedTax { * This field is immutable. To change which taxes apply to a line item, delete and add a new * `OrderLineItemAppliedTax`. */ - taxUid: string; + tax_uid: string; /** The amount of money applied by the tax to the line item. */ - appliedMoney?: Square.Money; + applied_money?: Square.Money; } diff --git a/src/api/types/OrderLineItemDiscount.ts b/src/api/types/OrderLineItemDiscount.ts index 25778f56b..4122df798 100644 --- a/src/api/types/OrderLineItemDiscount.ts +++ b/src/api/types/OrderLineItemDiscount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a discount that applies to one or more line items in an @@ -16,9 +16,9 @@ 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; + catalog_object_id?: string | null; /** The version of the catalog object that this discount references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The discount's name. */ name?: string | null; /** @@ -41,7 +41,7 @@ export interface OrderLineItemDiscount { * * `amount_money` is not set for percentage-based discounts. */ - amountMoney?: Square.Money; + amount_money?: Square.Money; /** * The amount of discount actually applied to the line item. * @@ -50,7 +50,7 @@ export interface OrderLineItemDiscount { * of `applied_money` is different than `amount_money` because the total * amount of the discount is distributed across all line items. */ - appliedMoney?: Square.Money; + applied_money?: 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 @@ -90,12 +90,12 @@ export interface OrderLineItemDiscount { * 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[]; + reward_ids?: 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; + pricing_rule_id?: string; } diff --git a/src/api/types/OrderLineItemModifier.ts b/src/api/types/OrderLineItemModifier.ts index c1c4344b6..bf4f853f6 100644 --- a/src/api/types/OrderLineItemModifier.ts +++ b/src/api/types/OrderLineItemModifier.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A [CatalogModifier](entity:CatalogModifier). @@ -11,9 +11,9 @@ 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; + catalog_object_id?: string | null; /** The version of the catalog object that this modifier references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The name of the item modifier. */ name?: string | null; /** @@ -33,12 +33,12 @@ export interface OrderLineItemModifier { * 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; + base_price_money?: 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; + total_price_money?: 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 diff --git a/src/api/types/OrderLineItemPricingBlocklists.ts b/src/api/types/OrderLineItemPricingBlocklists.ts index 68ac4f5f9..e17b39cb9 100644 --- a/src/api/types/OrderLineItemPricingBlocklists.ts +++ b/src/api/types/OrderLineItemPricingBlocklists.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes pricing adjustments that are blocked from automatic @@ -15,11 +15,11 @@ export interface OrderLineItemPricingBlocklists { * 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; + blocked_discounts?: 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; + blocked_taxes?: Square.OrderLineItemPricingBlocklistsBlockedTax[] | null; } diff --git a/src/api/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts b/src/api/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts index 6a89a96d9..9b3492dee 100644 --- a/src/api/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts +++ b/src/api/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts @@ -13,11 +13,11 @@ export interface OrderLineItemPricingBlocklistsBlockedDiscount { * 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; + discount_uid?: 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; + discount_catalog_object_id?: string | null; } diff --git a/src/api/types/OrderLineItemPricingBlocklistsBlockedTax.ts b/src/api/types/OrderLineItemPricingBlocklistsBlockedTax.ts index d6fe3da17..6c5a17629 100644 --- a/src/api/types/OrderLineItemPricingBlocklistsBlockedTax.ts +++ b/src/api/types/OrderLineItemPricingBlocklistsBlockedTax.ts @@ -13,11 +13,11 @@ export interface OrderLineItemPricingBlocklistsBlockedTax { * 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; + tax_uid?: 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; + tax_catalog_object_id?: string | null; } diff --git a/src/api/types/OrderLineItemTax.ts b/src/api/types/OrderLineItemTax.ts index 350cca4f6..591e20c7d 100644 --- a/src/api/types/OrderLineItemTax.ts +++ b/src/api/types/OrderLineItemTax.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a tax that applies to one or more line item in the order. @@ -15,9 +15,9 @@ 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; + catalog_object_id?: string | null; /** The version of the catalog object that this tax references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The tax's name. */ name?: string | null; /** @@ -58,7 +58,7 @@ export interface OrderLineItemTax { * - For percentage-based taxes, `applied_money` is the money * calculated using the percentage. */ - appliedMoney?: Square.Money; + applied_money?: 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 @@ -75,5 +75,5 @@ export interface OrderLineItemTax { * 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; + auto_applied?: boolean; } diff --git a/src/api/types/OrderMoneyAmounts.ts b/src/api/types/OrderMoneyAmounts.ts index 39a9d1a5c..6b84117bf 100644 --- a/src/api/types/OrderMoneyAmounts.ts +++ b/src/api/types/OrderMoneyAmounts.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A collection of various money amounts. */ export interface OrderMoneyAmounts { /** The total money. */ - totalMoney?: Square.Money; + total_money?: Square.Money; /** The money associated with taxes. */ - taxMoney?: Square.Money; + tax_money?: Square.Money; /** The money associated with discounts. */ - discountMoney?: Square.Money; + discount_money?: Square.Money; /** The money associated with tips. */ - tipMoney?: Square.Money; + tip_money?: Square.Money; /** The money associated with service charges. */ - serviceChargeMoney?: Square.Money; + service_charge_money?: Square.Money; } diff --git a/src/api/types/OrderPricingOptions.ts b/src/api/types/OrderPricingOptions.ts index b93c380b2..e2daa69ee 100644 --- a/src/api/types/OrderPricingOptions.ts +++ b/src/api/types/OrderPricingOptions.ts @@ -12,10 +12,10 @@ export interface OrderPricingOptions { * The option to determine whether pricing rule-based * discounts are automatically applied to an order. */ - autoApplyDiscounts?: boolean | null; + auto_apply_discounts?: 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; + auto_apply_taxes?: boolean | null; } diff --git a/src/api/types/OrderQuantityUnit.ts b/src/api/types/OrderQuantityUnit.ts index a8a12af82..5fbfc3df7 100644 --- a/src/api/types/OrderQuantityUnit.ts +++ b/src/api/types/OrderQuantityUnit.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains the measurement unit for a quantity and a precision that @@ -13,7 +13,7 @@ export interface OrderQuantityUnit { * A [MeasurementUnit](entity:MeasurementUnit) that represents the * unit of measure for the quantity. */ - measurementUnit?: Square.MeasurementUnit; + measurement_unit?: Square.MeasurementUnit; /** * For non-integer quantities, represents the number of digits after the decimal point that are * recorded for this quantity. @@ -29,11 +29,11 @@ export interface OrderQuantityUnit { * * This field is set when this is a catalog-backed measurement unit. */ - catalogObjectId?: string | null; + catalog_object_id?: 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; + catalog_version?: (number | bigint) | null; } diff --git a/src/api/types/OrderReturn.ts b/src/api/types/OrderReturn.ts index 81654aaa2..c0e0fe2da 100644 --- a/src/api/types/OrderReturn.ts +++ b/src/api/types/OrderReturn.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order. @@ -14,31 +14,31 @@ export interface OrderReturn { * An order that contains the original sale of these return line items. This is unset * for unlinked returns. */ - sourceOrderId?: string | null; + source_order_id?: string | null; /** A collection of line items that are being returned. */ - returnLineItems?: Square.OrderReturnLineItem[] | null; + return_line_items?: Square.OrderReturnLineItem[] | null; /** A collection of service charges that are being returned. */ - returnServiceCharges?: Square.OrderReturnServiceCharge[] | null; + return_service_charges?: 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[]; + return_taxes?: 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[]; + return_discounts?: Square.OrderReturnDiscount[]; /** A collection of references to tips being returned for an order. */ - returnTips?: Square.OrderReturnTip[] | null; + return_tips?: 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; + rounding_adjustment?: Square.OrderRoundingAdjustment; /** An aggregate monetary value being returned by this return entry. */ - returnAmounts?: Square.OrderMoneyAmounts; + return_amounts?: Square.OrderMoneyAmounts; } diff --git a/src/api/types/OrderReturnDiscount.ts b/src/api/types/OrderReturnDiscount.ts index 7df41273b..e344e51a6 100644 --- a/src/api/types/OrderReturnDiscount.ts +++ b/src/api/types/OrderReturnDiscount.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a discount being returned that applies to one or more return line items in an @@ -16,11 +16,11 @@ 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; + source_discount_uid?: string | null; /** The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). */ - catalogObjectId?: string | null; + catalog_object_id?: string | null; /** The version of the catalog object that this discount references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The discount's name. */ name?: string | null; /** @@ -43,13 +43,13 @@ export interface OrderReturnDiscount { * * `amount_money` is not set for percentage-based discounts. */ - amountMoney?: Square.Money; + amount_money?: 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; + applied_money?: Square.Money; /** * Indicates the level at which the `OrderReturnDiscount` applies. For `ORDER` scoped * discounts, the server generates references in `applied_discounts` on all diff --git a/src/api/types/OrderReturnLineItem.ts b/src/api/types/OrderReturnLineItem.ts index 94f42b8e1..e393c2f5f 100644 --- a/src/api/types/OrderReturnLineItem.ts +++ b/src/api/types/OrderReturnLineItem.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The line item being returned in an order. @@ -11,7 +11,7 @@ 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; + source_line_item_uid?: string | null; /** The name of the line item. */ name?: string | null; /** @@ -23,60 +23,60 @@ export interface OrderReturnLineItem { */ quantity: string; /** The unit and precision that this return line item's quantity is measured in. */ - quantityUnit?: Square.OrderQuantityUnit; + quantity_unit?: 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; + catalog_object_id?: string | null; /** The version of the catalog object that this line item references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The name of the variation applied to this return line item. */ - variationName?: string | null; + variation_name?: 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; + item_type?: Square.OrderLineItemItemType; /** The [CatalogModifier](entity:CatalogModifier)s applied to this line item. */ - returnModifiers?: Square.OrderReturnLineItemModifier[] | null; + return_modifiers?: 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; + applied_taxes?: 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; + applied_discounts?: Square.OrderLineItemAppliedDiscount[] | null; /** The base price for a single unit of the line item. */ - basePriceMoney?: Square.Money; + base_price_money?: 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; + variation_total_price_money?: Square.Money; /** The gross return amount of money calculated as (item base price + modifiers price) * quantity. */ - grossReturnMoney?: Square.Money; + gross_return_money?: Square.Money; /** The total amount of tax money to return for the line item. */ - totalTaxMoney?: Square.Money; + total_tax_money?: Square.Money; /** The total amount of discount money to return for the line item. */ - totalDiscountMoney?: Square.Money; + total_discount_money?: Square.Money; /** The total amount of money to return for this line item. */ - totalMoney?: Square.Money; + total_money?: 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; + applied_service_charges?: Square.OrderLineItemAppliedServiceCharge[] | null; /** The total amount of apportioned service charge money to return for the line item. */ - totalServiceChargeMoney?: Square.Money; + total_service_charge_money?: Square.Money; } diff --git a/src/api/types/OrderReturnLineItemModifier.ts b/src/api/types/OrderReturnLineItemModifier.ts index 91f5a1fe0..aa1656c3a 100644 --- a/src/api/types/OrderReturnLineItemModifier.ts +++ b/src/api/types/OrderReturnLineItemModifier.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A line item modifier being returned. @@ -14,11 +14,11 @@ export interface OrderReturnLineItemModifier { * The modifier `uid` from the order's line item that contains the * original sale of this line item modifier. */ - sourceModifierUid?: string | null; + source_modifier_uid?: string | null; /** The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). */ - catalogObjectId?: string | null; + catalog_object_id?: string | null; /** The version of the catalog object that this line item modifier references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The name of the item modifier. */ name?: string | null; /** @@ -27,12 +27,12 @@ export interface OrderReturnLineItemModifier { * `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; + base_price_money?: 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; + total_price_money?: 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 diff --git a/src/api/types/OrderReturnServiceCharge.ts b/src/api/types/OrderReturnServiceCharge.ts index 6e55c018a..0abd23048 100644 --- a/src/api/types/OrderReturnServiceCharge.ts +++ b/src/api/types/OrderReturnServiceCharge.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the service charge applied to the original order. @@ -15,13 +15,13 @@ export interface OrderReturnServiceCharge { * service charge. `source_service_charge_uid` is `null` for * unlinked returns. */ - sourceServiceChargeUid?: string | null; + source_service_charge_uid?: string | null; /** The name of the service charge. */ name?: string | null; /** The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge). */ - catalogObjectId?: string | null; + catalog_object_id?: string | null; /** The version of the catalog object that this service charge references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | 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 @@ -35,7 +35,7 @@ export interface OrderReturnServiceCharge { * * Either `percentage` or `amount_money` should be set, but not both. */ - amountMoney?: Square.Money; + amount_money?: Square.Money; /** * The amount of money applied to the order by the service charge, including * any inclusive tax amounts, as calculated by Square. @@ -43,7 +43,7 @@ export interface OrderReturnServiceCharge { * - 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; + applied_money?: Square.Money; /** * The total amount of money to collect for the service charge. * @@ -51,14 +51,14 @@ export interface OrderReturnServiceCharge { * 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; + total_money?: Square.Money; /** The total amount of tax money to collect for the service charge. */ - totalTaxMoney?: Square.Money; + total_tax_money?: Square.Money; /** * The calculation phase after which to apply the service charge. * See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values */ - calculationPhase?: Square.OrderServiceChargeCalculationPhase; + calculation_phase?: Square.OrderServiceChargeCalculationPhase; /** * Indicates whether the surcharge can be taxed. Service charges * calculated in the `TOTAL_PHASE` cannot be marked as taxable. @@ -71,12 +71,12 @@ export interface OrderReturnServiceCharge { * applied to the `OrderReturnServiceCharge`. On reads, the applied amount is * populated. */ - appliedTaxes?: Square.OrderLineItemAppliedTax[] | null; + applied_taxes?: Square.OrderLineItemAppliedTax[] | null; /** * The treatment type of the service charge. * See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values */ - treatmentType?: Square.OrderServiceChargeTreatmentType; + treatment_type?: 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 diff --git a/src/api/types/OrderReturnTax.ts b/src/api/types/OrderReturnTax.ts index 62c7ba5f0..3479f7eca 100644 --- a/src/api/types/OrderReturnTax.ts +++ b/src/api/types/OrderReturnTax.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a tax being returned that applies to one or more return line items in an order. @@ -15,11 +15,11 @@ 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; + source_tax_uid?: string | null; /** The catalog object ID referencing [CatalogTax](entity:CatalogTax). */ - catalogObjectId?: string | null; + catalog_object_id?: string | null; /** The version of the catalog object that this tax references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | bigint) | null; /** The tax's name. */ name?: string | null; /** @@ -33,7 +33,7 @@ export interface OrderReturnTax { */ percentage?: string | null; /** The amount of money applied by the tax in an order. */ - appliedMoney?: Square.Money; + applied_money?: Square.Money; /** * Indicates the level at which the `OrderReturnTax` applies. For `ORDER` scoped * taxes, Square generates references in `applied_taxes` on all diff --git a/src/api/types/OrderReturnTip.ts b/src/api/types/OrderReturnTip.ts index 3031cee77..bf6dbd1ab 100644 --- a/src/api/types/OrderReturnTip.ts +++ b/src/api/types/OrderReturnTip.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A tip being returned. @@ -14,9 +14,9 @@ export interface OrderReturnTip { * The amount of tip being returned * -- */ - appliedMoney?: Square.Money; + applied_money?: Square.Money; /** The tender `uid` from the order that contains the original application of this tip. */ - sourceTenderUid?: string | null; + source_tender_uid?: string | null; /** The tender `id` from the order that contains the original application of this tip. */ - sourceTenderId?: string | null; + source_tender_id?: string | null; } diff --git a/src/api/types/OrderReward.ts b/src/api/types/OrderReward.ts index 2ee82beb8..2546b9ae6 100644 --- a/src/api/types/OrderReward.ts +++ b/src/api/types/OrderReward.ts @@ -10,5 +10,5 @@ export interface OrderReward { /** The identifier of the reward. */ id: string; /** The identifier of the reward tier corresponding to this reward. */ - rewardTierId: string; + reward_tier_id: string; } diff --git a/src/api/types/OrderRoundingAdjustment.ts b/src/api/types/OrderRoundingAdjustment.ts index b14027bf6..1f3921ef1 100644 --- a/src/api/types/OrderRoundingAdjustment.ts +++ b/src/api/types/OrderRoundingAdjustment.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A rounding adjustment of the money being returned. Commonly used to apply cash rounding @@ -14,5 +14,5 @@ export interface OrderRoundingAdjustment { /** The name of the rounding adjustment from the original sale order. */ name?: string | null; /** The actual rounding adjustment amount. */ - amountMoney?: Square.Money; + amount_money?: Square.Money; } diff --git a/src/api/types/OrderServiceCharge.ts b/src/api/types/OrderServiceCharge.ts index bbf802c55..3a7a84109 100644 --- a/src/api/types/OrderServiceCharge.ts +++ b/src/api/types/OrderServiceCharge.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a service charge applied to an order. @@ -13,9 +13,9 @@ export interface OrderServiceCharge { /** The name of the service charge. */ name?: string | null; /** The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject). */ - catalogObjectId?: string | null; + catalog_object_id?: string | null; /** The version of the catalog object that this service charge references. */ - catalogVersion?: bigint | null; + catalog_version?: (number | 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%. @@ -28,7 +28,7 @@ export interface OrderServiceCharge { * * Exactly one of `percentage` or `amount_money` should be set. */ - amountMoney?: Square.Money; + amount_money?: Square.Money; /** * The amount of money applied to the order by the service charge, * including any inclusive tax amounts, as calculated by Square. @@ -37,7 +37,7 @@ export interface OrderServiceCharge { * - For percentage-based service charges, `applied_money` is the money * calculated using the percentage. */ - appliedMoney?: Square.Money; + applied_money?: Square.Money; /** * The total amount of money to collect for the service charge. * @@ -46,14 +46,14 @@ export interface OrderServiceCharge { * because the inclusive tax amount is already included in both * `applied_money` and `total_tax_money`. */ - totalMoney?: Square.Money; + total_money?: Square.Money; /** The total amount of tax money to collect for the service charge. */ - totalTaxMoney?: Square.Money; + total_tax_money?: Square.Money; /** * The calculation phase at which to apply the service charge. * See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values */ - calculationPhase?: Square.OrderServiceChargeCalculationPhase; + calculation_phase?: 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 @@ -74,7 +74,7 @@ export interface OrderServiceCharge { * * To change the amount of a tax, modify the referenced top-level tax. */ - appliedTaxes?: Square.OrderLineItemAppliedTax[] | null; + applied_taxes?: 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 @@ -105,7 +105,7 @@ export interface OrderServiceCharge { * The treatment type of the service charge. * See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values */ - treatmentType?: Square.OrderServiceChargeTreatmentType; + treatment_type?: 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 diff --git a/src/api/types/OrderUpdated.ts b/src/api/types/OrderUpdated.ts index e9d9371d4..e92499efa 100644 --- a/src/api/types/OrderUpdated.ts +++ b/src/api/types/OrderUpdated.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderUpdated { /** The order's unique ID. */ - orderId?: string | null; + order_id?: 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 @@ -16,14 +16,14 @@ export interface OrderUpdated { */ version?: number; /** The ID of the seller location that this order is associated with. */ - locationId?: string | null; + location_id?: string | null; /** * The state of the order. * See [OrderState](#type-orderstate) for possible values */ state?: Square.OrderState; /** The timestamp for when the order was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp for when the order was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/OrderUpdatedEvent.ts b/src/api/types/OrderUpdatedEvent.ts index 99045bcbb..377ec7572 100644 --- a/src/api/types/OrderUpdatedEvent.ts +++ b/src/api/types/OrderUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when an [Order](entity:Order) is updated. This @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface OrderUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"order.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.OrderUpdatedEventData; } diff --git a/src/api/types/OrderUpdatedEventData.ts b/src/api/types/OrderUpdatedEventData.ts index a077e59f3..0fc56a1f5 100644 --- a/src/api/types/OrderUpdatedEventData.ts +++ b/src/api/types/OrderUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderUpdatedEventData { /** Name of the affected object’s type, `"order_updated"`. */ diff --git a/src/api/types/OrderUpdatedObject.ts b/src/api/types/OrderUpdatedObject.ts index 476a7ad60..9490b3def 100644 --- a/src/api/types/OrderUpdatedObject.ts +++ b/src/api/types/OrderUpdatedObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface OrderUpdatedObject { /** Information about the updated order. */ - orderUpdated?: Square.OrderUpdated; + order_updated?: Square.OrderUpdated; } diff --git a/src/api/types/PauseSubscriptionResponse.ts b/src/api/types/PauseSubscriptionResponse.ts index 0a0c66a4d..f7fc33313 100644 --- a/src/api/types/PauseSubscriptionResponse.ts +++ b/src/api/types/PauseSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the diff --git a/src/api/types/PayOrderResponse.ts b/src/api/types/PayOrderResponse.ts index a1618a8f1..e6078fbd7 100644 --- a/src/api/types/PayOrderResponse.ts +++ b/src/api/types/PayOrderResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of a request to the diff --git a/src/api/types/Payment.ts b/src/api/types/Payment.ts index e374c606c..62a201051 100644 --- a/src/api/types/Payment.ts +++ b/src/api/types/Payment.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a payment processed by the Square API. @@ -11,9 +11,9 @@ 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; + created_at?: string; /** The timestamp of when the payment was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** * The amount processed for this payment, not including `tip_money`. * @@ -21,7 +21,7 @@ export interface Payment { * 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; + amount_money?: Square.Money; /** * The amount designated as a tip. * @@ -29,14 +29,14 @@ export interface Payment { * 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; + tip_money?: 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; + total_money?: 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 @@ -48,21 +48,21 @@ export interface Payment { * 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; + app_fee_money?: 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; + approved_money?: Square.Money; /** The processing fees and fee adjustments assessed by Square for this payment. */ - processingFee?: Square.ProcessingFee[]; + processing_fee?: 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; + refunded_money?: Square.Money; /** Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED. */ status?: string; /** @@ -81,13 +81,13 @@ export interface Payment { * - Card-present payments: "PT36H" (36 hours) from the creation time. * - Card-not-present payments: "P7D" (7 days) from the creation time. */ - delayDuration?: string; + delay_duration?: string; /** * The action to be applied to the payment when the `delay_duration` has elapsed. * * Current values include `CANCEL` and `COMPLETE`. */ - delayAction?: string | null; + delay_action?: string | null; /** * The read-only timestamp of when the `delay_action` is automatically applied, * in RFC 3339 format. @@ -96,7 +96,7 @@ export interface Payment { * fields. The `created_at` field is generated by Square and might not exactly match the * time on your local machine. */ - delayedUntil?: string; + delayed_until?: string; /** * The source type for this payment. * @@ -104,43 +104,43 @@ export interface Payment { * `CASH` and `EXTERNAL`. For information about these payment source types, * see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). */ - sourceType?: string; + source_type?: string; /** Details about a card payment. These details are only populated if the source_type is `CARD`. */ - cardDetails?: Square.CardPaymentDetails; + card_details?: Square.CardPaymentDetails; /** Details about a cash payment. These details are only populated if the source_type is `CASH`. */ - cashDetails?: Square.CashPaymentDetails; + cash_details?: Square.CashPaymentDetails; /** Details about a bank account payment. These details are only populated if the source_type is `BANK_ACCOUNT`. */ - bankAccountDetails?: Square.BankAccountPaymentDetails; + bank_account_details?: Square.BankAccountPaymentDetails; /** * Details about an external payment. The details are only populated * if the `source_type` is `EXTERNAL`. */ - externalDetails?: Square.ExternalPaymentDetails; + external_details?: Square.ExternalPaymentDetails; /** * Details about an wallet payment. The details are only populated * if the `source_type` is `WALLET`. */ - walletDetails?: Square.DigitalWalletDetails; + wallet_details?: 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; + buy_now_pay_later_details?: Square.BuyNowPayLaterDetails; /** * Details about a Square Account payment. The details are only populated * if the `source_type` is `SQUARE_ACCOUNT`. */ - squareAccountDetails?: Square.SquareAccountDetails; + square_account_details?: Square.SquareAccountDetails; /** The ID of the location associated with the payment. */ - locationId?: string; + location_id?: string; /** The ID of the order associated with the payment. */ - orderId?: string; + order_id?: string; /** * An optional ID that associates the payment with an entity in * another system. */ - referenceId?: string; + reference_id?: 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`, @@ -156,31 +156,31 @@ export interface Payment { * this process is asynchronous and it may take some time before a * customer ID is added to the payment. */ - customerId?: string; + customer_id?: string; /** * __Deprecated__: Use `Payment.team_member_id` instead. * * An optional ID of the employee associated with taking the payment. */ - employeeId?: string; + employee_id?: string; /** An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment. */ - teamMemberId?: string | null; + team_member_id?: string | null; /** A list of `refund_id`s identifying refunds for the payment. */ - refundIds?: string[]; + refund_ids?: 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; + risk_evaluation?: Square.RiskEvaluation; /** An optional ID for a Terminal checkout that is associated with the payment. */ - terminalCheckoutId?: string; + terminal_checkout_id?: string; /** The buyer's email address. */ - buyerEmailAddress?: string; + buyer_email_address?: string; /** The buyer's billing address. */ - billingAddress?: Square.Address; + billing_address?: Square.Address; /** The buyer's shipping address. */ - shippingAddress?: Square.Address; + shipping_address?: Square.Address; /** An optional note to include when creating a payment. */ note?: string; /** @@ -191,7 +191,7 @@ export interface Payment { * to fit the required information including the Square identifier (SQ *) and the name of the * seller taking the payment. */ - statementDescriptionIdentifier?: string; + statement_description_identifier?: string; /** * Actions that can be performed on this payment: * - `EDIT_AMOUNT_UP` - The payment amount can be edited up. @@ -205,23 +205,23 @@ export interface Payment { * The payment's receipt number. * The field is missing if a payment is canceled. */ - receiptNumber?: string; + receipt_number?: string; /** * The URL for the payment's receipt. * The field is only populated for COMPLETED payments. */ - receiptUrl?: string; + receipt_url?: string; /** Details about the device that took the payment. */ - deviceDetails?: Square.DeviceDetails; + device_details?: Square.DeviceDetails; /** Details about the application that took the payment. */ - applicationDetails?: Square.ApplicationDetails; + application_details?: Square.ApplicationDetails; /** Whether or not this payment was taken offline. */ - isOfflinePayment?: boolean; + is_offline_payment?: boolean; /** Additional information about the payment if it was taken offline. */ - offlinePaymentDetails?: Square.OfflinePaymentDetails; + offline_payment_details?: Square.OfflinePaymentDetails; /** * Used for optimistic concurrency. This opaque token identifies a specific version of the * `Payment` object. */ - versionToken?: string | null; + version_token?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityAppFeeRefundDetail.ts b/src/api/types/PaymentBalanceActivityAppFeeRefundDetail.ts index 8ae3e35b9..d6e3938d7 100644 --- a/src/api/types/PaymentBalanceActivityAppFeeRefundDetail.ts +++ b/src/api/types/PaymentBalanceActivityAppFeeRefundDetail.ts @@ -4,9 +4,9 @@ export interface PaymentBalanceActivityAppFeeRefundDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the refund associated with this activity. */ - refundId?: string | null; + refund_id?: string | null; /** The ID of the location of the merchant associated with the payment refund activity */ - locationId?: string | null; + location_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityAppFeeRevenueDetail.ts b/src/api/types/PaymentBalanceActivityAppFeeRevenueDetail.ts index 3365241f6..f65774d55 100644 --- a/src/api/types/PaymentBalanceActivityAppFeeRevenueDetail.ts +++ b/src/api/types/PaymentBalanceActivityAppFeeRevenueDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityAppFeeRevenueDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the location of the merchant associated with the payment activity */ - locationId?: string | null; + location_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityAutomaticSavingsDetail.ts b/src/api/types/PaymentBalanceActivityAutomaticSavingsDetail.ts index d74597394..90c7f1389 100644 --- a/src/api/types/PaymentBalanceActivityAutomaticSavingsDetail.ts +++ b/src/api/types/PaymentBalanceActivityAutomaticSavingsDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityAutomaticSavingsDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the payout associated with this activity. */ - payoutId?: string | null; + payout_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts b/src/api/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts index 2d37f5c08..e9594d7c0 100644 --- a/src/api/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts +++ b/src/api/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityAutomaticSavingsReversedDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the payout associated with this activity. */ - payoutId?: string | null; + payout_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityChargeDetail.ts b/src/api/types/PaymentBalanceActivityChargeDetail.ts index 9c0ebb78b..e2b412274 100644 --- a/src/api/types/PaymentBalanceActivityChargeDetail.ts +++ b/src/api/types/PaymentBalanceActivityChargeDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityChargeDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityDepositFeeDetail.ts b/src/api/types/PaymentBalanceActivityDepositFeeDetail.ts index 1c2b38a39..3d7b00e52 100644 --- a/src/api/types/PaymentBalanceActivityDepositFeeDetail.ts +++ b/src/api/types/PaymentBalanceActivityDepositFeeDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityDepositFeeDetail { /** The ID of the payout that triggered this deposit fee activity. */ - payoutId?: string | null; + payout_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityDepositFeeReversedDetail.ts b/src/api/types/PaymentBalanceActivityDepositFeeReversedDetail.ts index 0c14b36ce..6800d83b2 100644 --- a/src/api/types/PaymentBalanceActivityDepositFeeReversedDetail.ts +++ b/src/api/types/PaymentBalanceActivityDepositFeeReversedDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityDepositFeeReversedDetail { /** The ID of the payout that triggered this deposit fee activity. */ - payoutId?: string | null; + payout_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityDisputeDetail.ts b/src/api/types/PaymentBalanceActivityDisputeDetail.ts index d8650ce27..0f5c3ae12 100644 --- a/src/api/types/PaymentBalanceActivityDisputeDetail.ts +++ b/src/api/types/PaymentBalanceActivityDisputeDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityDisputeDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the dispute associated with this activity. */ - disputeId?: string | null; + dispute_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityFeeDetail.ts b/src/api/types/PaymentBalanceActivityFeeDetail.ts index 0a718c269..11e8508c4 100644 --- a/src/api/types/PaymentBalanceActivityFeeDetail.ts +++ b/src/api/types/PaymentBalanceActivityFeeDetail.ts @@ -9,5 +9,5 @@ export interface PaymentBalanceActivityFeeDetail { * If the fee is independent (there is no principal LedgerEntryToken) then this will likely not * be populated. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityFreeProcessingDetail.ts b/src/api/types/PaymentBalanceActivityFreeProcessingDetail.ts index 80871927f..2b53bf419 100644 --- a/src/api/types/PaymentBalanceActivityFreeProcessingDetail.ts +++ b/src/api/types/PaymentBalanceActivityFreeProcessingDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityFreeProcessingDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityHoldAdjustmentDetail.ts b/src/api/types/PaymentBalanceActivityHoldAdjustmentDetail.ts index cabfda713..19aecf3ab 100644 --- a/src/api/types/PaymentBalanceActivityHoldAdjustmentDetail.ts +++ b/src/api/types/PaymentBalanceActivityHoldAdjustmentDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityHoldAdjustmentDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityOpenDisputeDetail.ts b/src/api/types/PaymentBalanceActivityOpenDisputeDetail.ts index 5a6a4e388..18b2b872b 100644 --- a/src/api/types/PaymentBalanceActivityOpenDisputeDetail.ts +++ b/src/api/types/PaymentBalanceActivityOpenDisputeDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityOpenDisputeDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the dispute associated with this activity. */ - disputeId?: string | null; + dispute_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityOtherAdjustmentDetail.ts b/src/api/types/PaymentBalanceActivityOtherAdjustmentDetail.ts index 9a23c3c21..9f27e4367 100644 --- a/src/api/types/PaymentBalanceActivityOtherAdjustmentDetail.ts +++ b/src/api/types/PaymentBalanceActivityOtherAdjustmentDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityOtherAdjustmentDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityOtherDetail.ts b/src/api/types/PaymentBalanceActivityOtherDetail.ts index ca0c2015e..c711e5bc1 100644 --- a/src/api/types/PaymentBalanceActivityOtherDetail.ts +++ b/src/api/types/PaymentBalanceActivityOtherDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityOtherDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityRefundDetail.ts b/src/api/types/PaymentBalanceActivityRefundDetail.ts index edf5fbeac..51a60e8dd 100644 --- a/src/api/types/PaymentBalanceActivityRefundDetail.ts +++ b/src/api/types/PaymentBalanceActivityRefundDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityRefundDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the refund associated with this activity. */ - refundId?: string | null; + refund_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts b/src/api/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts index 1264c364b..217167df1 100644 --- a/src/api/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts +++ b/src/api/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityReleaseAdjustmentDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityReserveHoldDetail.ts b/src/api/types/PaymentBalanceActivityReserveHoldDetail.ts index 8aa150e24..620d03725 100644 --- a/src/api/types/PaymentBalanceActivityReserveHoldDetail.ts +++ b/src/api/types/PaymentBalanceActivityReserveHoldDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityReserveHoldDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityReserveReleaseDetail.ts b/src/api/types/PaymentBalanceActivityReserveReleaseDetail.ts index 11999dd2d..32c47d55c 100644 --- a/src/api/types/PaymentBalanceActivityReserveReleaseDetail.ts +++ b/src/api/types/PaymentBalanceActivityReserveReleaseDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityReserveReleaseDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts b/src/api/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts index faea6cc0a..b7a365149 100644 --- a/src/api/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts +++ b/src/api/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivitySquareCapitalPaymentDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts b/src/api/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts index b906d7614..8bd4854a1 100644 --- a/src/api/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts +++ b/src/api/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivitySquareCapitalReversedPaymentDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts b/src/api/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts index 16740b83c..84c0d0903 100644 --- a/src/api/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts +++ b/src/api/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivitySquarePayrollTransferDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts b/src/api/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts index 9746b2c10..c0de463a2 100644 --- a/src/api/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts +++ b/src/api/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivitySquarePayrollTransferReversedDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityTaxOnFeeDetail.ts b/src/api/types/PaymentBalanceActivityTaxOnFeeDetail.ts index b85595f25..448cea2d9 100644 --- a/src/api/types/PaymentBalanceActivityTaxOnFeeDetail.ts +++ b/src/api/types/PaymentBalanceActivityTaxOnFeeDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityTaxOnFeeDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The description of the tax rate being applied. For example: "GST", "HST". */ - taxRateDescription?: string | null; + tax_rate_description?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityThirdPartyFeeDetail.ts b/src/api/types/PaymentBalanceActivityThirdPartyFeeDetail.ts index 9f3e4172a..8e949cbe6 100644 --- a/src/api/types/PaymentBalanceActivityThirdPartyFeeDetail.ts +++ b/src/api/types/PaymentBalanceActivityThirdPartyFeeDetail.ts @@ -4,5 +4,5 @@ export interface PaymentBalanceActivityThirdPartyFeeDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; } diff --git a/src/api/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts b/src/api/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts index e84a88472..66196f542 100644 --- a/src/api/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts +++ b/src/api/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts @@ -4,7 +4,7 @@ export interface PaymentBalanceActivityThirdPartyFeeRefundDetail { /** The ID of the payment associated with this activity. */ - paymentId?: string | null; + payment_id?: string | null; /** The public refund id associated with this activity. */ - refundId?: string | null; + refund_id?: string | null; } diff --git a/src/api/types/PaymentCreatedEvent.ts b/src/api/types/PaymentCreatedEvent.ts index 3e865157b..cbaef85b8 100644 --- a/src/api/types/PaymentCreatedEvent.ts +++ b/src/api/types/PaymentCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Payment](entity:Payment) is created. */ export interface PaymentCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"payment.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.PaymentCreatedEventData; } diff --git a/src/api/types/PaymentCreatedEventData.ts b/src/api/types/PaymentCreatedEventData.ts index 39936a8d2..9e4e61baa 100644 --- a/src/api/types/PaymentCreatedEventData.ts +++ b/src/api/types/PaymentCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PaymentCreatedEventData { /** Name of the affected object’s type, `"payment"`. */ diff --git a/src/api/types/PaymentCreatedEventObject.ts b/src/api/types/PaymentCreatedEventObject.ts index 6fe3ce9c8..b82dcd3a8 100644 --- a/src/api/types/PaymentCreatedEventObject.ts +++ b/src/api/types/PaymentCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PaymentCreatedEventObject { /** The created payment. */ diff --git a/src/api/types/PaymentLink.ts b/src/api/types/PaymentLink.ts index 65ddee385..7b6017fb1 100644 --- a/src/api/types/PaymentLink.ts +++ b/src/api/types/PaymentLink.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PaymentLink { /** The Square-assigned ID of the payment link. */ @@ -15,28 +15,28 @@ export interface PaymentLink { */ description?: string | null; /** The ID of the order associated with the payment link. */ - orderId?: string; + order_id?: 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; + checkout_options?: Square.CheckoutOptions; /** * Describes buyer data to prepopulate * on the checkout page. */ - prePopulatedData?: Square.PrePopulatedData; + pre_populated_data?: Square.PrePopulatedData; /** The shortened URL of the payment link. */ url?: string; /** The long URL of the payment link. */ - longUrl?: string; + long_url?: string; /** The timestamp when the payment link was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the payment link was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** * An optional note. After Square processes the payment, this note is added to the * resulting `Payment`. */ - paymentNote?: string | null; + payment_note?: string | null; } diff --git a/src/api/types/PaymentLinkRelatedResources.ts b/src/api/types/PaymentLinkRelatedResources.ts index 1161d468d..2143afd05 100644 --- a/src/api/types/PaymentLinkRelatedResources.ts +++ b/src/api/types/PaymentLinkRelatedResources.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + subscription_plans?: Square.CatalogObject[] | null; } diff --git a/src/api/types/PaymentOptions.ts b/src/api/types/PaymentOptions.ts index b1ad4dbad..d5efaaa03 100644 --- a/src/api/types/PaymentOptions.ts +++ b/src/api/types/PaymentOptions.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PaymentOptions { /** @@ -26,7 +26,7 @@ export interface PaymentOptions { * * Default: "PT36H" (36 hours) from the creation time */ - delayDuration?: string | null; + delay_duration?: 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 @@ -40,7 +40,7 @@ export interface PaymentOptions { * * Default: false */ - acceptPartialAuthorization?: boolean | null; + accept_partial_authorization?: boolean | null; /** * The action to be applied to the `Payment` when the delay_duration has elapsed. * The action must be CANCEL or COMPLETE. @@ -53,5 +53,5 @@ export interface PaymentOptions { * Default: CANCEL * See [DelayAction](#type-delayaction) for possible values */ - delayAction?: Square.PaymentOptionsDelayAction; + delay_action?: Square.PaymentOptionsDelayAction; } diff --git a/src/api/types/PaymentRefund.ts b/src/api/types/PaymentRefund.ts index 7118cb959..4ccba6ad0 100644 --- a/src/api/types/PaymentRefund.ts +++ b/src/api/types/PaymentRefund.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a refund of a payment made using Square. Contains information about @@ -20,7 +20,7 @@ export interface PaymentRefund { */ status?: string | null; /** The location ID associated with the payment this refund is attached to. */ - locationId?: string | null; + location_id?: string | null; /** Flag indicating whether or not the refund is linked to an existing payment in Square. */ unlinked?: boolean; /** @@ -29,38 +29,38 @@ export interface PaymentRefund { * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, * `EXTERNAL`, and `SQUARE_ACCOUNT`. */ - destinationType?: string | null; + destination_type?: 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; + destination_details?: 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; + amount_money: 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; + app_fee_money?: Square.Money; /** Processing fees and fee adjustments assessed by Square for this refund. */ - processingFee?: Square.ProcessingFee[] | null; + processing_fee?: Square.ProcessingFee[] | null; /** The ID of the payment associated with this refund. */ - paymentId?: string | null; + payment_id?: string | null; /** The ID of the order associated with the refund. */ - orderId?: string | null; + order_id?: string | null; /** The reason for the refund. */ reason?: string | null; /** The timestamp of when the refund was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp of when the refund was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** An optional ID of the team member associated with taking the payment. */ - teamMemberId?: string; + team_member_id?: string; /** An optional ID for a Terminal refund. */ - terminalRefundId?: string; + terminal_refund_id?: string; } diff --git a/src/api/types/PaymentUpdatedEvent.ts b/src/api/types/PaymentUpdatedEvent.ts index 60a30a58c..0664f1529 100644 --- a/src/api/types/PaymentUpdatedEvent.ts +++ b/src/api/types/PaymentUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Payment](entity:Payment) is updated. @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface PaymentUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"payment.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.PaymentUpdatedEventData; } diff --git a/src/api/types/PaymentUpdatedEventData.ts b/src/api/types/PaymentUpdatedEventData.ts index 69310b4da..8e1ce7cde 100644 --- a/src/api/types/PaymentUpdatedEventData.ts +++ b/src/api/types/PaymentUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PaymentUpdatedEventData { /** Name of the affected object’s type, `"payment"`. */ diff --git a/src/api/types/PaymentUpdatedEventObject.ts b/src/api/types/PaymentUpdatedEventObject.ts index 4c3d2fc5b..fb1fcc93d 100644 --- a/src/api/types/PaymentUpdatedEventObject.ts +++ b/src/api/types/PaymentUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PaymentUpdatedEventObject { /** The updated payment. */ diff --git a/src/api/types/Payout.ts b/src/api/types/Payout.ts index bd8aa5bfe..3a7accde8 100644 --- a/src/api/types/Payout.ts +++ b/src/api/types/Payout.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An accounting of the amount owed the seller and record of the actual transfer to their @@ -17,13 +17,13 @@ export interface Payout { */ status?: Square.PayoutStatus; /** The ID of the location associated with the payout. */ - locationId: string; + location_id: 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; + created_at?: string; /** The timestamp of when the payout was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: 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; + amount_money?: Square.Money; /** * Information about the banking destination (such as a bank account, Square checking account, or debit card) * against which the payout was made. @@ -40,9 +40,9 @@ export interface Payout { */ type?: Square.PayoutType; /** A list of transfer fees and any taxes on the fees assessed by Square for this payout. */ - payoutFee?: Square.PayoutFee[] | null; + payout_fee?: 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; + arrival_date?: 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; + end_to_end_id?: string | null; } diff --git a/src/api/types/PayoutEntry.ts b/src/api/types/PayoutEntry.ts index 50311ca45..3de2fd7f3 100644 --- a/src/api/types/PayoutEntry.ts +++ b/src/api/types/PayoutEntry.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. @@ -12,68 +12,68 @@ export interface PayoutEntry { /** A unique ID for the payout entry. */ id: string; /** The ID of the payout entries’ associated payout. */ - payoutId: string; + payout_id: string; /** The timestamp of when the payout entry affected the balance, in RFC 3339 format. */ - effectiveAt?: string | null; + effective_at?: 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; + gross_amount_money?: Square.Money; /** The amount of Square fees associated with this payout entry. */ - feeAmountMoney?: Square.Money; + fee_amount_money?: Square.Money; /** The net proceeds from this transaction after any fees. */ - netAmountMoney?: Square.Money; + net_amount_money?: Square.Money; /** Details of any developer app fee revenue generated on a payment. */ - typeAppFeeRevenueDetails?: Square.PaymentBalanceActivityAppFeeRevenueDetail; + type_app_fee_revenue_details?: Square.PaymentBalanceActivityAppFeeRevenueDetail; /** Details of a refund for an app fee on a payment. */ - typeAppFeeRefundDetails?: Square.PaymentBalanceActivityAppFeeRefundDetail; + type_app_fee_refund_details?: 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; + type_automatic_savings_details?: 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; + type_automatic_savings_reversed_details?: Square.PaymentBalanceActivityAutomaticSavingsReversedDetail; /** Details of credit card payment captures. */ - typeChargeDetails?: Square.PaymentBalanceActivityChargeDetail; + type_charge_details?: Square.PaymentBalanceActivityChargeDetail; /** Details of any fees involved with deposits such as for instant deposits. */ - typeDepositFeeDetails?: Square.PaymentBalanceActivityDepositFeeDetail; + type_deposit_fee_details?: Square.PaymentBalanceActivityDepositFeeDetail; /** Details of any reversal or refund of fees involved with deposits such as for instant deposits. */ - typeDepositFeeReversedDetails?: Square.PaymentBalanceActivityDepositFeeReversedDetail; + type_deposit_fee_reversed_details?: Square.PaymentBalanceActivityDepositFeeReversedDetail; /** Details of any balance change due to a dispute event. */ - typeDisputeDetails?: Square.PaymentBalanceActivityDisputeDetail; + type_dispute_details?: Square.PaymentBalanceActivityDisputeDetail; /** Details of adjustments due to the Square processing fee. */ - typeFeeDetails?: Square.PaymentBalanceActivityFeeDetail; + type_fee_details?: 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; + type_free_processing_details?: Square.PaymentBalanceActivityFreeProcessingDetail; /** Details of any adjustment made by Square related to the holding or releasing of a payment. */ - typeHoldAdjustmentDetails?: Square.PaymentBalanceActivityHoldAdjustmentDetail; + type_hold_adjustment_details?: Square.PaymentBalanceActivityHoldAdjustmentDetail; /** Details of any open disputes. */ - typeOpenDisputeDetails?: Square.PaymentBalanceActivityOpenDisputeDetail; + type_open_dispute_details?: Square.PaymentBalanceActivityOpenDisputeDetail; /** Details of any other type that does not belong in the rest of the types. */ - typeOtherDetails?: Square.PaymentBalanceActivityOtherDetail; + type_other_details?: Square.PaymentBalanceActivityOtherDetail; /** Details of any other type of adjustments that don't fall under existing types. */ - typeOtherAdjustmentDetails?: Square.PaymentBalanceActivityOtherAdjustmentDetail; + type_other_adjustment_details?: Square.PaymentBalanceActivityOtherAdjustmentDetail; /** Details of a refund for an existing card payment. */ - typeRefundDetails?: Square.PaymentBalanceActivityRefundDetail; + type_refund_details?: Square.PaymentBalanceActivityRefundDetail; /** Details of fees released for adjustments. */ - typeReleaseAdjustmentDetails?: Square.PaymentBalanceActivityReleaseAdjustmentDetail; + type_release_adjustment_details?: Square.PaymentBalanceActivityReleaseAdjustmentDetail; /** Details of fees paid for funding risk reserve. */ - typeReserveHoldDetails?: Square.PaymentBalanceActivityReserveHoldDetail; + type_reserve_hold_details?: Square.PaymentBalanceActivityReserveHoldDetail; /** Details of fees released from risk reserve. */ - typeReserveReleaseDetails?: Square.PaymentBalanceActivityReserveReleaseDetail; + type_reserve_release_details?: 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; + type_square_capital_payment_details?: 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; + type_square_capital_reversed_payment_details?: Square.PaymentBalanceActivitySquareCapitalReversedPaymentDetail; /** Details of tax paid on fee amounts. */ - typeTaxOnFeeDetails?: Square.PaymentBalanceActivityTaxOnFeeDetail; + type_tax_on_fee_details?: Square.PaymentBalanceActivityTaxOnFeeDetail; /** Details of fees collected by a 3rd party platform. */ - typeThirdPartyFeeDetails?: Square.PaymentBalanceActivityThirdPartyFeeDetail; + type_third_party_fee_details?: Square.PaymentBalanceActivityThirdPartyFeeDetail; /** Details of refunded fees from a 3rd party platform. */ - typeThirdPartyFeeRefundDetails?: Square.PaymentBalanceActivityThirdPartyFeeRefundDetail; + type_third_party_fee_refund_details?: Square.PaymentBalanceActivityThirdPartyFeeRefundDetail; /** Details of a payroll payment that was transferred to a team member’s bank account. */ - typeSquarePayrollTransferDetails?: Square.PaymentBalanceActivitySquarePayrollTransferDetail; + type_square_payroll_transfer_details?: 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; + type_square_payroll_transfer_reversed_details?: Square.PaymentBalanceActivitySquarePayrollTransferReversedDetail; } diff --git a/src/api/types/PayoutFailedEvent.ts b/src/api/types/PayoutFailedEvent.ts index 02b523dec..7827224e5 100644 --- a/src/api/types/PayoutFailedEvent.ts +++ b/src/api/types/PayoutFailedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Payout](entity:Payout) has failed. */ export interface PayoutFailedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event that this represents, `payout.failed`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** The timestamp of when the event was verified, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.PayoutFailedEventData; } diff --git a/src/api/types/PayoutFailedEventData.ts b/src/api/types/PayoutFailedEventData.ts index c81cca237..3121e82b3 100644 --- a/src/api/types/PayoutFailedEventData.ts +++ b/src/api/types/PayoutFailedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PayoutFailedEventData { /** The name of the affected object's type, `payout`. */ diff --git a/src/api/types/PayoutFailedEventObject.ts b/src/api/types/PayoutFailedEventObject.ts index 92a5df18a..a435d5925 100644 --- a/src/api/types/PayoutFailedEventObject.ts +++ b/src/api/types/PayoutFailedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PayoutFailedEventObject { /** The payout that failed. */ diff --git a/src/api/types/PayoutFee.ts b/src/api/types/PayoutFee.ts index 0535fc9c8..5dfdebf06 100644 --- a/src/api/types/PayoutFee.ts +++ b/src/api/types/PayoutFee.ts @@ -2,16 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + amount_money?: Square.Money; /** The timestamp of when the fee takes effect, in RFC 3339 format. */ - effectiveAt?: string | null; + effective_at?: string | null; /** * The type of fee assessed as part of the payout. * See [PayoutFeeType](#type-payoutfeetype) for possible values diff --git a/src/api/types/PayoutPaidEvent.ts b/src/api/types/PayoutPaidEvent.ts index b781c6cdf..aace234c7 100644 --- a/src/api/types/PayoutPaidEvent.ts +++ b/src/api/types/PayoutPaidEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Payout](entity:Payout) is complete. */ export interface PayoutPaidEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"payout.paid"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was verified, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.PayoutPaidEventData; } diff --git a/src/api/types/PayoutPaidEventData.ts b/src/api/types/PayoutPaidEventData.ts index f91bfda41..93d4e60c6 100644 --- a/src/api/types/PayoutPaidEventData.ts +++ b/src/api/types/PayoutPaidEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PayoutPaidEventData { /** Name of the affected object’s type, `"payout"`. */ diff --git a/src/api/types/PayoutPaidEventObject.ts b/src/api/types/PayoutPaidEventObject.ts index 295d4d3a8..5bb1d65e0 100644 --- a/src/api/types/PayoutPaidEventObject.ts +++ b/src/api/types/PayoutPaidEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PayoutPaidEventObject { /** The payout that has completed. */ diff --git a/src/api/types/PayoutSentEvent.ts b/src/api/types/PayoutSentEvent.ts index 8a6bd6f40..4bff4d9cc 100644 --- a/src/api/types/PayoutSentEvent.ts +++ b/src/api/types/PayoutSentEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Payout](entity:Payout) is sent. */ export interface PayoutSentEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of the target location associated with the event. */ - locationId?: string | null; + location_id?: string | null; /** The type of event this represents, `"payout.sent"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was verified, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.PayoutSentEventData; } diff --git a/src/api/types/PayoutSentEventData.ts b/src/api/types/PayoutSentEventData.ts index 5882f125e..38bca0787 100644 --- a/src/api/types/PayoutSentEventData.ts +++ b/src/api/types/PayoutSentEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PayoutSentEventData { /** Name of the affected object’s type, `"payout"`. */ diff --git a/src/api/types/PayoutSentEventObject.ts b/src/api/types/PayoutSentEventObject.ts index d776568b3..9fc7cc131 100644 --- a/src/api/types/PayoutSentEventObject.ts +++ b/src/api/types/PayoutSentEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface PayoutSentEventObject { /** The payout that was sent. */ diff --git a/src/api/types/Phase.ts b/src/api/types/Phase.ts index f3e728a97..901659bc9 100644 --- a/src/api/types/Phase.ts +++ b/src/api/types/Phase.ts @@ -9,9 +9,9 @@ export interface Phase { /** id of subscription phase */ uid?: string | null; /** index of phase in total subscription plan */ - ordinal?: bigint | null; + ordinal?: (number | bigint) | null; /** id of order to be used in billing */ - orderTemplateId?: string | null; + order_template_id?: string | null; /** the uid from the plan's phase in catalog */ - planPhaseUid?: string | null; + plan_phase_uid?: string | null; } diff --git a/src/api/types/PhaseInput.ts b/src/api/types/PhaseInput.ts index 6337c2d0c..2a3f42c2a 100644 --- a/src/api/types/PhaseInput.ts +++ b/src/api/types/PhaseInput.ts @@ -7,7 +7,7 @@ */ export interface PhaseInput { /** index of phase in total subscription plan */ - ordinal: bigint; + ordinal: number | bigint; /** id of order to be used in billing */ - orderTemplateId?: string | null; + order_template_id?: string | null; } diff --git a/src/api/types/PrePopulatedData.ts b/src/api/types/PrePopulatedData.ts index c44aa1414..351997122 100644 --- a/src/api/types/PrePopulatedData.ts +++ b/src/api/types/PrePopulatedData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes buyer data to prepopulate in the payment form. @@ -11,9 +11,9 @@ import * as Square from "../index"; */ export interface PrePopulatedData { /** The buyer email to prepopulate in the payment form. */ - buyerEmail?: string | null; + buyer_email?: string | null; /** The buyer phone number to prepopulate in the payment form. */ - buyerPhoneNumber?: string | null; + buyer_phone_number?: string | null; /** The buyer address to prepopulate in the payment form. */ - buyerAddress?: Square.Address; + buyer_address?: Square.Address; } diff --git a/src/api/types/ProcessingFee.ts b/src/api/types/ProcessingFee.ts index cc656115c..d2b1ae191 100644 --- a/src/api/types/ProcessingFee.ts +++ b/src/api/types/ProcessingFee.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the Square processing fee. */ export interface ProcessingFee { /** The timestamp of when the fee takes effect, in RFC 3339 format. */ - effectiveAt?: string | null; + effective_at?: string | null; /** The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`. */ type?: string | null; /** @@ -18,5 +18,5 @@ export interface ProcessingFee { * Positive values represent funds being assessed, while negative values represent * funds being returned. */ - amountMoney?: Square.Money; + amount_money?: Square.Money; } diff --git a/src/api/types/PublishInvoiceResponse.ts b/src/api/types/PublishInvoiceResponse.ts index bdbf60710..6dfcc1508 100644 --- a/src/api/types/PublishInvoiceResponse.ts +++ b/src/api/types/PublishInvoiceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a `PublishInvoice` response. diff --git a/src/api/types/PublishScheduledShiftResponse.ts b/src/api/types/PublishScheduledShiftResponse.ts index daaa7dcb3..7a09d1883 100644 --- a/src/api/types/PublishScheduledShiftResponse.ts +++ b/src/api/types/PublishScheduledShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface PublishScheduledShiftResponse { /** The published scheduled shift. */ - scheduledShift?: Square.ScheduledShift; + scheduled_shift?: Square.ScheduledShift; /** Any errors that occurred during the request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/QrCodeOptions.ts b/src/api/types/QrCodeOptions.ts index ab7e8b989..189fa9a3b 100644 --- a/src/api/types/QrCodeOptions.ts +++ b/src/api/types/QrCodeOptions.ts @@ -14,5 +14,5 @@ export interface QrCodeOptions { * The text representation of the data to show in the QR code * as UTF8-encoded data. */ - barcodeContents: string; + barcode_contents: string; } diff --git a/src/api/types/QuickPay.ts b/src/api/types/QuickPay.ts index f0ac1d1d6..22236fd04 100644 --- a/src/api/types/QuickPay.ts +++ b/src/api/types/QuickPay.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes an ad hoc item and price to generate a quick pay checkout link. @@ -13,7 +13,7 @@ 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; + price_money: Square.Money; /** The ID of the business location the checkout is associated with. */ - locationId: string; + location_id: string; } diff --git a/src/api/types/ReceiptOptions.ts b/src/api/types/ReceiptOptions.ts index 28a17e87f..60d8e5677 100644 --- a/src/api/types/ReceiptOptions.ts +++ b/src/api/types/ReceiptOptions.ts @@ -7,16 +7,16 @@ */ export interface ReceiptOptions { /** The reference to the Square payment ID for the receipt. */ - paymentId: string; + payment_id: 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; + print_only?: boolean | null; /** * Identify the receipt as a reprint rather than an original receipt. * Defaults to false. */ - isDuplicate?: boolean | null; + is_duplicate?: boolean | null; } diff --git a/src/api/types/RedeemLoyaltyRewardResponse.ts b/src/api/types/RedeemLoyaltyRewardResponse.ts index b3233091b..f7704a1ee 100644 --- a/src/api/types/RedeemLoyaltyRewardResponse.ts +++ b/src/api/types/RedeemLoyaltyRewardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that includes the `LoyaltyEvent` published for redeeming the reward. diff --git a/src/api/types/Refund.ts b/src/api/types/Refund.ts index 3614a38f5..22b545b37 100644 --- a/src/api/types/Refund.ts +++ b/src/api/types/Refund.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a refund processed for a Square transaction. @@ -11,17 +11,17 @@ export interface Refund { /** The refund's unique ID. */ id: string; /** The ID of the refund's associated location. */ - locationId: string; + location_id: string; /** The ID of the transaction that the refunded tender is part of. */ - transactionId?: string | null; + transaction_id?: string | null; /** The ID of the refunded tender. */ - tenderId?: string | null; + tender_id?: string | null; /** The timestamp for when the refund was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The reason for the refund being issued. */ reason: string; /** The amount of money refunded to the buyer. */ - amountMoney: Square.Money; + amount_money: Square.Money; /** * The current status of the refund (`PENDING`, `APPROVED`, `REJECTED`, * or `FAILED`). @@ -29,10 +29,10 @@ export interface Refund { */ status: Square.RefundStatus; /** The amount of Square processing fee money refunded to the *merchant*. */ - processingFeeMoney?: Square.Money; + processing_fee_money?: 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; + additional_recipients?: Square.AdditionalRecipient[] | null; } diff --git a/src/api/types/RefundCreatedEvent.ts b/src/api/types/RefundCreatedEvent.ts index 39ab7bd33..5ce2e2aad 100644 --- a/src/api/types/RefundCreatedEvent.ts +++ b/src/api/types/RefundCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Refund](entity:PaymentRefund) is created. */ export interface RefundCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"refund.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.RefundCreatedEventData; } diff --git a/src/api/types/RefundCreatedEventData.ts b/src/api/types/RefundCreatedEventData.ts index e2b8b8c75..c6115508a 100644 --- a/src/api/types/RefundCreatedEventData.ts +++ b/src/api/types/RefundCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RefundCreatedEventData { /** Name of the affected object’s type, `"refund"`. */ diff --git a/src/api/types/RefundCreatedEventObject.ts b/src/api/types/RefundCreatedEventObject.ts index 4f04f92b8..a9ca689bf 100644 --- a/src/api/types/RefundCreatedEventObject.ts +++ b/src/api/types/RefundCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RefundCreatedEventObject { /** The created refund. */ diff --git a/src/api/types/RefundPaymentResponse.ts b/src/api/types/RefundPaymentResponse.ts index 708d54360..8e6325423 100644 --- a/src/api/types/RefundPaymentResponse.ts +++ b/src/api/types/RefundPaymentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by diff --git a/src/api/types/RefundUpdatedEvent.ts b/src/api/types/RefundUpdatedEvent.ts index 605abdeda..6693cab14 100644 --- a/src/api/types/RefundUpdatedEvent.ts +++ b/src/api/types/RefundUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Refund](entity:PaymentRefund) is updated. @@ -10,13 +10,13 @@ import * as Square from "../index"; */ export interface RefundUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"refund.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.RefundUpdatedEventData; } diff --git a/src/api/types/RefundUpdatedEventData.ts b/src/api/types/RefundUpdatedEventData.ts index 289303776..188ab6c49 100644 --- a/src/api/types/RefundUpdatedEventData.ts +++ b/src/api/types/RefundUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RefundUpdatedEventData { /** Name of the affected object’s type, `"refund"`. */ diff --git a/src/api/types/RefundUpdatedEventObject.ts b/src/api/types/RefundUpdatedEventObject.ts index acfb97f5b..65034462e 100644 --- a/src/api/types/RefundUpdatedEventObject.ts +++ b/src/api/types/RefundUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RefundUpdatedEventObject { /** The updated refund. */ diff --git a/src/api/types/RegisterDomainResponse.ts b/src/api/types/RegisterDomainResponse.ts index 840e6d51d..02aeb7afe 100644 --- a/src/api/types/RegisterDomainResponse.ts +++ b/src/api/types/RegisterDomainResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/RemoveGroupFromCustomerResponse.ts b/src/api/types/RemoveGroupFromCustomerResponse.ts index 964682649..be663f87d 100644 --- a/src/api/types/RemoveGroupFromCustomerResponse.ts +++ b/src/api/types/RemoveGroupFromCustomerResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/ResumeSubscriptionResponse.ts b/src/api/types/ResumeSubscriptionResponse.ts index 286cb12aa..13a5c605a 100644 --- a/src/api/types/ResumeSubscriptionResponse.ts +++ b/src/api/types/ResumeSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the diff --git a/src/api/types/RetrieveBookingCustomAttributeDefinitionResponse.ts b/src/api/types/RetrieveBookingCustomAttributeDefinitionResponse.ts index a2ba2f0eb..072392ce9 100644 --- a/src/api/types/RetrieveBookingCustomAttributeDefinitionResponse.ts +++ b/src/api/types/RetrieveBookingCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface RetrieveBookingCustomAttributeDefinitionResponse { /** The retrieved custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 0664f5398..af4b4d6a3 100644 --- a/src/api/types/RetrieveBookingCustomAttributeResponse.ts +++ b/src/api/types/RetrieveBookingCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveBookingCustomAttribute](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttribute) response. @@ -13,7 +13,7 @@ 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; + custom_attribute?: 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 index b7609f394..679f5047e 100644 --- a/src/api/types/RetrieveJobResponse.ts +++ b/src/api/types/RetrieveJobResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveJob](api-endpoint:Team-RetrieveJob) response. Either `job` or `errors` diff --git a/src/api/types/RetrieveLocationBookingProfileResponse.ts b/src/api/types/RetrieveLocationBookingProfileResponse.ts index 35e4ae298..657a0fec9 100644 --- a/src/api/types/RetrieveLocationBookingProfileResponse.ts +++ b/src/api/types/RetrieveLocationBookingProfileResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RetrieveLocationBookingProfileResponse { /** The requested location booking profile. */ - locationBookingProfile?: Square.LocationBookingProfile; + location_booking_profile?: 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 index fa2a38bde..637e2501d 100644 --- a/src/api/types/RetrieveLocationCustomAttributeDefinitionResponse.ts +++ b/src/api/types/RetrieveLocationCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface RetrieveLocationCustomAttributeDefinitionResponse { /** The retrieved custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 20f15a340..27fef2cdf 100644 --- a/src/api/types/RetrieveLocationCustomAttributeResponse.ts +++ b/src/api/types/RetrieveLocationCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveLocationCustomAttribute](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttribute) response. @@ -13,7 +13,7 @@ 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; + custom_attribute?: 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 index 41432cd77..f9025b9c9 100644 --- a/src/api/types/RetrieveLocationSettingsResponse.ts +++ b/src/api/types/RetrieveLocationSettingsResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RetrieveLocationSettingsResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The location settings. */ - locationSettings?: Square.CheckoutLocationSettings; + location_settings?: Square.CheckoutLocationSettings; } diff --git a/src/api/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts index a751ea6df..624bc14e0 100644 --- a/src/api/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts +++ b/src/api/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface RetrieveMerchantCustomAttributeDefinitionResponse { /** The retrieved custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 2db96df0f..901a7d39f 100644 --- a/src/api/types/RetrieveMerchantCustomAttributeResponse.ts +++ b/src/api/types/RetrieveMerchantCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttribute) response. @@ -13,7 +13,7 @@ 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; + custom_attribute?: 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 index 2f0065bbe..2dbe70795 100644 --- a/src/api/types/RetrieveMerchantSettingsResponse.ts +++ b/src/api/types/RetrieveMerchantSettingsResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RetrieveMerchantSettingsResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The merchant settings. */ - merchantSettings?: Square.CheckoutMerchantSettings; + merchant_settings?: Square.CheckoutMerchantSettings; } diff --git a/src/api/types/RetrieveOrderCustomAttributeDefinitionResponse.ts b/src/api/types/RetrieveOrderCustomAttributeDefinitionResponse.ts index ad84e3d07..cef027a60 100644 --- a/src/api/types/RetrieveOrderCustomAttributeDefinitionResponse.ts +++ b/src/api/types/RetrieveOrderCustomAttributeDefinitionResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from getting an order custom attribute definition. */ export interface RetrieveOrderCustomAttributeDefinitionResponse { /** The retrieved custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 0d8556525..e6b359a5d 100644 --- a/src/api/types/RetrieveOrderCustomAttributeResponse.ts +++ b/src/api/types/RetrieveOrderCustomAttributeResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + custom_attribute?: Square.CustomAttribute; /** Any errors that occurred during the request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/RetrieveScheduledShiftResponse.ts b/src/api/types/RetrieveScheduledShiftResponse.ts index 277fa98b4..29956de09 100644 --- a/src/api/types/RetrieveScheduledShiftResponse.ts +++ b/src/api/types/RetrieveScheduledShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [RetrieveScheduledShift](api-endpoint:Labor-RetrieveScheduledShift) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface RetrieveScheduledShiftResponse { /** The requested scheduled shift. */ - scheduledShift?: Square.ScheduledShift; + scheduled_shift?: Square.ScheduledShift; /** Any errors that occurred during the request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/RetrieveTimecardResponse.ts b/src/api/types/RetrieveTimecardResponse.ts index a3b172908..3e1ab8fb9 100644 --- a/src/api/types/RetrieveTimecardResponse.ts +++ b/src/api/types/RetrieveTimecardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response to a request to get a `Timecard`. The response contains diff --git a/src/api/types/RetrieveTokenStatusResponse.ts b/src/api/types/RetrieveTokenStatusResponse.ts index 36f64d7c8..88083a3e3 100644 --- a/src/api/types/RetrieveTokenStatusResponse.ts +++ b/src/api/types/RetrieveTokenStatusResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -12,11 +12,11 @@ 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; + expires_at?: string; /** The Square-issued application ID associated with the access token. This is the same application ID used to obtain the token. */ - clientId?: string; + client_id?: string; /** The ID of the authorizing merchant's business. */ - merchantId?: string; + merchant_id?: 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 index fe48f8c9e..cf248d364 100644 --- a/src/api/types/RevokeTokenResponse.ts +++ b/src/api/types/RevokeTokenResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface RevokeTokenResponse { /** If the request is successful, this is `true`. */ diff --git a/src/api/types/RiskEvaluation.ts b/src/api/types/RiskEvaluation.ts index b672456bc..fd23ac9e5 100644 --- a/src/api/types/RiskEvaluation.ts +++ b/src/api/types/RiskEvaluation.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents fraud risk information for the associated payment. @@ -14,10 +14,10 @@ import * as Square from "../index"; */ export interface RiskEvaluation { /** The timestamp when payment risk was evaluated, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** * The risk level associated with the payment * See [RiskEvaluationRiskLevel](#type-riskevaluationrisklevel) for possible values */ - riskLevel?: Square.RiskEvaluationRiskLevel; + risk_level?: Square.RiskEvaluationRiskLevel; } diff --git a/src/api/types/SaveCardOptions.ts b/src/api/types/SaveCardOptions.ts index 78f8c0223..0e340ba51 100644 --- a/src/api/types/SaveCardOptions.ts +++ b/src/api/types/SaveCardOptions.ts @@ -7,13 +7,13 @@ */ export interface SaveCardOptions { /** The square-assigned ID of the customer linked to the saved card. */ - customerId: string; + customer_id: string; /** The id of the created card-on-file. */ - cardId?: string; + card_id?: 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; + reference_id?: string | null; } diff --git a/src/api/types/ScheduledShift.ts b/src/api/types/ScheduledShift.ts index 77abb571a..c2afc2c9c 100644 --- a/src/api/types/ScheduledShift.ts +++ b/src/api/types/ScheduledShift.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a specific time slot in a work schedule. This object is used to manage the @@ -16,12 +16,12 @@ export interface ScheduledShift { * The latest draft shift details for the scheduled shift. Draft shift details are used to * stage and manage shifts before publishing. This field is always present. */ - draftShiftDetails?: Square.ScheduledShiftDetails; + draft_shift_details?: Square.ScheduledShiftDetails; /** * The current published (public) shift details for the scheduled shift. This field is * present only if the shift was published. */ - publishedShiftDetails?: Square.ScheduledShiftDetails; + published_shift_details?: Square.ScheduledShiftDetails; /** * **Read only** The current version of the scheduled shift, which is incremented with each update. * This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) @@ -29,7 +29,7 @@ export interface ScheduledShift { */ version?: number; /** The timestamp of when the scheduled shift was created, in RFC 3339 format presented as UTC. */ - createdAt?: string; + created_at?: string; /** The timestamp of when the scheduled shift was last updated, in RFC 3339 format presented as UTC. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/ScheduledShiftDetails.ts b/src/api/types/ScheduledShiftDetails.ts index 0e3900e68..59181701b 100644 --- a/src/api/types/ScheduledShiftDetails.ts +++ b/src/api/types/ScheduledShiftDetails.ts @@ -8,23 +8,23 @@ */ export interface ScheduledShiftDetails { /** The ID of the [team member](entity:TeamMember) scheduled for the shift. */ - teamMemberId?: string | null; + team_member_id?: string | null; /** The ID of the [location](entity:Location) the shift is scheduled for. */ - locationId?: string | null; + location_id?: string | null; /** The ID of the [job](entity:Job) the shift is scheduled for. */ - jobId?: string | null; + job_id?: string | null; /** * The start time of the shift, in RFC 3339 format in the time zone + * offset of the shift location specified in `location_id`. Precision up to the minute * is respected; seconds are truncated. */ - startAt?: string | null; + start_at?: string | null; /** * The end time for the shift, in RFC 3339 format in the time zone + * offset of the shift location specified in `location_id`. Precision up to the minute * is respected; seconds are truncated. */ - endAt?: string | null; + end_at?: string | null; /** Optional notes for the shift. */ notes?: string | null; /** @@ -32,7 +32,7 @@ export interface ScheduledShiftDetails { * is published, the entire scheduled shift (including the published shift) is deleted and * cannot be accessed using any endpoint. */ - isDeleted?: boolean | null; + is_deleted?: boolean | null; /** * The time zone of the shift location, calculated based on the `location_id`. This field * is provided for convenience. diff --git a/src/api/types/ScheduledShiftFilter.ts b/src/api/types/ScheduledShiftFilter.ts index 5a9ca9dd0..8de5484db 100644 --- a/src/api/types/ScheduledShiftFilter.ts +++ b/src/api/types/ScheduledShiftFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines filter criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) @@ -14,7 +14,7 @@ export interface ScheduledShiftFilter { * locations are returned. If needed, call [ListLocations](api-endpoint:Locations-ListLocations) * to get location IDs. */ - locationIds?: string[] | null; + location_ids?: string[] | null; /** * Return shifts whose `start_at` time is within the specified * time range (inclusive). @@ -35,7 +35,7 @@ export interface ScheduledShiftFilter { * `assignment_status` filter in the query. Otherwise, all unassigned shifts are * returned along with shifts assigned to the specified team members. */ - teamMemberIds?: string[] | null; + team_member_ids?: string[] | null; /** * Return shifts based on whether a team member is assigned. A shift is * assigned if the `team_member_id` field is populated in the `draft_shift_details` @@ -45,7 +45,7 @@ export interface ScheduledShiftFilter { * filter in the query. * See [ScheduledShiftFilterAssignmentStatus](#type-scheduledshiftfilterassignmentstatus) for possible values */ - assignmentStatus?: Square.ScheduledShiftFilterAssignmentStatus; + assignment_status?: Square.ScheduledShiftFilterAssignmentStatus; /** * Return shifts based on the draft or published status of the shift. * A shift is published if the `published_shift_details` field is present. @@ -54,5 +54,5 @@ export interface ScheduledShiftFilter { * with the `DRAFT` filter. * See [ScheduledShiftFilterScheduledShiftStatus](#type-scheduledshiftfilterscheduledshiftstatus) for possible values */ - scheduledShiftStatuses?: Square.ScheduledShiftFilterScheduledShiftStatus[] | null; + scheduled_shift_statuses?: Square.ScheduledShiftFilterScheduledShiftStatus[] | null; } diff --git a/src/api/types/ScheduledShiftQuery.ts b/src/api/types/ScheduledShiftQuery.ts index ad1b5005d..c99540df5 100644 --- a/src/api/types/ScheduledShiftQuery.ts +++ b/src/api/types/ScheduledShiftQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents filter and sort criteria for the `query` field in a diff --git a/src/api/types/ScheduledShiftSort.ts b/src/api/types/ScheduledShiftSort.ts index 41126ffd1..010aa7e4d 100644 --- a/src/api/types/ScheduledShiftSort.ts +++ b/src/api/types/ScheduledShiftSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines sort criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) diff --git a/src/api/types/ScheduledShiftWorkday.ts b/src/api/types/ScheduledShiftWorkday.ts index ea90c2756..0dd4310df 100644 --- a/src/api/types/ScheduledShiftWorkday.ts +++ b/src/api/types/ScheduledShiftWorkday.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A `ScheduledShift` search query filter parameter that sets a range of days that @@ -10,17 +10,17 @@ import * as Square from "../index"; */ export interface ScheduledShiftWorkday { /** Dates for fetching the scheduled shifts. */ - dateRange?: Square.DateRange; + date_range?: Square.DateRange; /** * The strategy on which the dates are applied. * See [ScheduledShiftWorkdayMatcher](#type-scheduledshiftworkdaymatcher) for possible values */ - matchScheduledShiftsBy?: Square.ScheduledShiftWorkdayMatcher; + match_scheduled_shifts_by?: Square.ScheduledShiftWorkdayMatcher; /** * 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; + default_timezone?: string | null; } diff --git a/src/api/types/SearchAvailabilityFilter.ts b/src/api/types/SearchAvailabilityFilter.ts index 41099dbd3..59e25db4f 100644 --- a/src/api/types/SearchAvailabilityFilter.ts +++ b/src/api/types/SearchAvailabilityFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A query filter to search for buyer-accessible availabilities by. @@ -13,23 +13,23 @@ export interface SearchAvailabilityFilter { * 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; + start_at_range: 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; + location_id?: 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; + segment_filters?: 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; + booking_id?: string | null; } diff --git a/src/api/types/SearchAvailabilityQuery.ts b/src/api/types/SearchAvailabilityQuery.ts index 5314cfebb..07facb7c6 100644 --- a/src/api/types/SearchAvailabilityQuery.ts +++ b/src/api/types/SearchAvailabilityQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The query used to search for buyer-accessible availabilities of bookings. diff --git a/src/api/types/SearchAvailabilityResponse.ts b/src/api/types/SearchAvailabilityResponse.ts index a6fafea09..c537d5ee6 100644 --- a/src/api/types/SearchAvailabilityResponse.ts +++ b/src/api/types/SearchAvailabilityResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SearchAvailabilityResponse { /** List of appointment slots available for booking. */ diff --git a/src/api/types/SearchCatalogItemsResponse.ts b/src/api/types/SearchCatalogItemsResponse.ts index 71e916d48..3d6ccbd61 100644 --- a/src/api/types/SearchCatalogItemsResponse.ts +++ b/src/api/types/SearchCatalogItemsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response body returned from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint. @@ -15,5 +15,5 @@ export interface SearchCatalogItemsResponse { /** 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[]; + matched_variation_ids?: string[]; } diff --git a/src/api/types/SearchCatalogObjectsResponse.ts b/src/api/types/SearchCatalogObjectsResponse.ts index daa11c3af..4a2a3afdc 100644 --- a/src/api/types/SearchCatalogObjectsResponse.ts +++ b/src/api/types/SearchCatalogObjectsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SearchCatalogObjectsResponse { /** Any errors that occurred during the request. */ @@ -15,10 +15,10 @@ export interface SearchCatalogObjectsResponse { /** The CatalogObjects returned. */ objects?: Square.CatalogObject[]; /** A list of CatalogObjects referenced by the objects in the `objects` field. */ - relatedObjects?: Square.CatalogObject[]; + related_objects?: 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; + latest_time?: string; } diff --git a/src/api/types/SearchCustomersResponse.ts b/src/api/types/SearchCustomersResponse.ts index 5667827f2..058af6fd4 100644 --- a/src/api/types/SearchCustomersResponse.ts +++ b/src/api/types/SearchCustomersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -33,5 +33,5 @@ export interface SearchCustomersResponse { * 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; + count?: number | bigint; } diff --git a/src/api/types/SearchEventsFilter.ts b/src/api/types/SearchEventsFilter.ts index ccbb04b26..a75d3a704 100644 --- a/src/api/types/SearchEventsFilter.ts +++ b/src/api/types/SearchEventsFilter.ts @@ -2,18 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Criteria to filter events by. */ export interface SearchEventsFilter { /** Filter events by event types. */ - eventTypes?: string[] | null; + event_types?: string[] | null; /** Filter events by merchant. */ - merchantIds?: string[] | null; + merchant_ids?: string[] | null; /** Filter events by location. */ - locationIds?: string[] | null; + location_ids?: string[] | null; /** Filter events by when they were created. */ - createdAt?: Square.TimeRange; + created_at?: Square.TimeRange; } diff --git a/src/api/types/SearchEventsQuery.ts b/src/api/types/SearchEventsQuery.ts index c4923434d..ad482f690 100644 --- a/src/api/types/SearchEventsQuery.ts +++ b/src/api/types/SearchEventsQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains query criteria for the search. diff --git a/src/api/types/SearchEventsResponse.ts b/src/api/types/SearchEventsResponse.ts index d28d5ee28..df63a3d52 100644 --- a/src/api/types/SearchEventsResponse.ts +++ b/src/api/types/SearchEventsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/SearchEventsSort.ts b/src/api/types/SearchEventsSort.ts index 2bedcf9cc..07429321b 100644 --- a/src/api/types/SearchEventsSort.ts +++ b/src/api/types/SearchEventsSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Criteria to sort events by. diff --git a/src/api/types/SearchInvoicesResponse.ts b/src/api/types/SearchInvoicesResponse.ts index d8a9d2bd1..bd460bc62 100644 --- a/src/api/types/SearchInvoicesResponse.ts +++ b/src/api/types/SearchInvoicesResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a `SearchInvoices` response. diff --git a/src/api/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts b/src/api/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts index 01bd91e80..45a9f0888 100644 --- a/src/api/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts +++ b/src/api/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The search criteria for the loyalty accounts. @@ -23,5 +23,5 @@ export interface SearchLoyaltyAccountsRequestLoyaltyAccountQuery { * * Max: 30 customer IDs */ - customerIds?: string[] | null; + customer_ids?: string[] | null; } diff --git a/src/api/types/SearchLoyaltyAccountsResponse.ts b/src/api/types/SearchLoyaltyAccountsResponse.ts index e3b9e6ea4..f822c21c9 100644 --- a/src/api/types/SearchLoyaltyAccountsResponse.ts +++ b/src/api/types/SearchLoyaltyAccountsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that includes loyalty accounts that satisfy the search criteria. @@ -14,7 +14,7 @@ export interface SearchLoyaltyAccountsResponse { * The loyalty accounts that met the search criteria, * in order of creation date. */ - loyaltyAccounts?: Square.LoyaltyAccount[]; + loyalty_accounts?: Square.LoyaltyAccount[]; /** * The pagination cursor to use in a subsequent * request. If empty, this is the final response. diff --git a/src/api/types/SearchLoyaltyEventsResponse.ts b/src/api/types/SearchLoyaltyEventsResponse.ts index 035520dad..3c9f425f0 100644 --- a/src/api/types/SearchLoyaltyEventsResponse.ts +++ b/src/api/types/SearchLoyaltyEventsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains loyalty events that satisfy the search diff --git a/src/api/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts b/src/api/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts index 387555f18..2af343a1f 100644 --- a/src/api/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts +++ b/src/api/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The set of search requirements. */ export interface SearchLoyaltyRewardsRequestLoyaltyRewardQuery { /** The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs. */ - loyaltyAccountId: string; + loyalty_account_id: string; /** * The status of the loyalty reward. * See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values diff --git a/src/api/types/SearchLoyaltyRewardsResponse.ts b/src/api/types/SearchLoyaltyRewardsResponse.ts index 4227870d5..6015375c9 100644 --- a/src/api/types/SearchLoyaltyRewardsResponse.ts +++ b/src/api/types/SearchLoyaltyRewardsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that includes the loyalty rewards satisfying the search criteria. diff --git a/src/api/types/SearchOrdersCustomerFilter.ts b/src/api/types/SearchOrdersCustomerFilter.ts index 167772657..927fd8a6a 100644 --- a/src/api/types/SearchOrdersCustomerFilter.ts +++ b/src/api/types/SearchOrdersCustomerFilter.ts @@ -13,5 +13,5 @@ export interface SearchOrdersCustomerFilter { * * Max: 10 customer ids. */ - customerIds?: string[] | null; + customer_ids?: string[] | null; } diff --git a/src/api/types/SearchOrdersDateTimeFilter.ts b/src/api/types/SearchOrdersDateTimeFilter.ts index 8895aee16..fd15daea3 100644 --- a/src/api/types/SearchOrdersDateTimeFilter.ts +++ b/src/api/types/SearchOrdersDateTimeFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Filter for `Order` objects based on whether their `CREATED_AT`, @@ -26,17 +26,17 @@ export interface SearchOrdersDateTimeFilter { * value, you must set the `sort_field` in the `OrdersSearchSort` object to * `CREATED_AT`. */ - createdAt?: Square.TimeRange; + created_at?: 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; + updated_at?: 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; + closed_at?: Square.TimeRange; } diff --git a/src/api/types/SearchOrdersFilter.ts b/src/api/types/SearchOrdersFilter.ts index f7999cca0..13879aeb7 100644 --- a/src/api/types/SearchOrdersFilter.ts +++ b/src/api/types/SearchOrdersFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Filtering criteria to use for a `SearchOrders` request. Multiple filters @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface SearchOrdersFilter { /** Filter by [OrderState](entity:OrderState). */ - stateFilter?: Square.SearchOrdersStateFilter; + state_filter?: Square.SearchOrdersStateFilter; /** * Filter for results within a time range. * @@ -18,11 +18,11 @@ export interface SearchOrdersFilter { * 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; + date_time_filter?: Square.SearchOrdersDateTimeFilter; /** Filter by the fulfillment type or state. */ - fulfillmentFilter?: Square.SearchOrdersFulfillmentFilter; + fulfillment_filter?: Square.SearchOrdersFulfillmentFilter; /** Filter by the source of the order. */ - sourceFilter?: Square.SearchOrdersSourceFilter; + source_filter?: Square.SearchOrdersSourceFilter; /** Filter by customers associated with the order. */ - customerFilter?: Square.SearchOrdersCustomerFilter; + customer_filter?: Square.SearchOrdersCustomerFilter; } diff --git a/src/api/types/SearchOrdersFulfillmentFilter.ts b/src/api/types/SearchOrdersFulfillmentFilter.ts index 9ba85a337..9394931a2 100644 --- a/src/api/types/SearchOrdersFulfillmentFilter.ts +++ b/src/api/types/SearchOrdersFulfillmentFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Filter based on [order fulfillment](entity:Fulfillment) information. @@ -14,12 +14,12 @@ export interface SearchOrdersFulfillmentFilter { * listed in this field. * See [FulfillmentType](#type-fulfillmenttype) for possible values */ - fulfillmentTypes?: Square.FulfillmentType[] | null; + fulfillment_types?: 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; + fulfillment_states?: Square.FulfillmentState[] | null; } diff --git a/src/api/types/SearchOrdersQuery.ts b/src/api/types/SearchOrdersQuery.ts index 8e0d23b82..39d47cdaf 100644 --- a/src/api/types/SearchOrdersQuery.ts +++ b/src/api/types/SearchOrdersQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains query criteria for the search. diff --git a/src/api/types/SearchOrdersResponse.ts b/src/api/types/SearchOrdersResponse.ts index 750a9606f..f99916ab1 100644 --- a/src/api/types/SearchOrdersResponse.ts +++ b/src/api/types/SearchOrdersResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Either the `order_entries` or `orders` field is set, depending on whether @@ -13,7 +13,7 @@ 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[]; + order_entries?: Square.OrderEntry[]; /** * A list of * [Order](entity:Order) objects that match the query conditions. The list is populated only if diff --git a/src/api/types/SearchOrdersSort.ts b/src/api/types/SearchOrdersSort.ts index a2137e503..12096b53e 100644 --- a/src/api/types/SearchOrdersSort.ts +++ b/src/api/types/SearchOrdersSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Sorting criteria for a `SearchOrders` request. Results can only be sorted @@ -22,10 +22,10 @@ export interface SearchOrdersSort { * Default: `CREATED_AT`. * See [SearchOrdersSortField](#type-searchorderssortfield) for possible values */ - sortField: Square.SearchOrdersSortField; + sort_field: Square.SearchOrdersSortField; /** * The chronological order in which results are returned. Defaults to `DESC`. * See [SortOrder](#type-sortorder) for possible values */ - sortOrder?: Square.SortOrder; + sort_order?: Square.SortOrder; } diff --git a/src/api/types/SearchOrdersSourceFilter.ts b/src/api/types/SearchOrdersSourceFilter.ts index 0b1475c9d..9e0d9d745 100644 --- a/src/api/types/SearchOrdersSourceFilter.ts +++ b/src/api/types/SearchOrdersSourceFilter.ts @@ -12,5 +12,5 @@ export interface SearchOrdersSourceFilter { * * Max: 10 source names. */ - sourceNames?: string[] | null; + source_names?: string[] | null; } diff --git a/src/api/types/SearchOrdersStateFilter.ts b/src/api/types/SearchOrdersStateFilter.ts index fa5759b0b..3c73a037e 100644 --- a/src/api/types/SearchOrdersStateFilter.ts +++ b/src/api/types/SearchOrdersStateFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Filter by the current order `state`. diff --git a/src/api/types/SearchScheduledShiftsResponse.ts b/src/api/types/SearchScheduledShiftsResponse.ts index 895464c09..d32079b4c 100644 --- a/src/api/types/SearchScheduledShiftsResponse.ts +++ b/src/api/types/SearchScheduledShiftsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface SearchScheduledShiftsResponse { /** A paginated list of scheduled shifts that match the query conditions. */ - scheduledShifts?: Square.ScheduledShift[]; + scheduled_shifts?: Square.ScheduledShift[]; /** * The pagination cursor used to retrieve the next page of results. This field is present * only if additional results are available. diff --git a/src/api/types/SearchShiftsResponse.ts b/src/api/types/SearchShiftsResponse.ts index 427926dc2..ce2f70f74 100644 --- a/src/api/types/SearchShiftsResponse.ts +++ b/src/api/types/SearchShiftsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request for `Shift` objects. The response contains diff --git a/src/api/types/SearchSubscriptionsFilter.ts b/src/api/types/SearchSubscriptionsFilter.ts index 41b97918d..16bb3031e 100644 --- a/src/api/types/SearchSubscriptionsFilter.ts +++ b/src/api/types/SearchSubscriptionsFilter.ts @@ -8,9 +8,9 @@ */ export interface SearchSubscriptionsFilter { /** A filter to select subscriptions based on the subscribing customer IDs. */ - customerIds?: string[] | null; + customer_ids?: string[] | null; /** A filter to select subscriptions based on the location. */ - locationIds?: string[] | null; + location_ids?: string[] | null; /** A filter to select subscriptions based on the source application. */ - sourceNames?: string[] | null; + source_names?: string[] | null; } diff --git a/src/api/types/SearchSubscriptionsQuery.ts b/src/api/types/SearchSubscriptionsQuery.ts index 224516676..50139153c 100644 --- a/src/api/types/SearchSubscriptionsQuery.ts +++ b/src/api/types/SearchSubscriptionsQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a query, consisting of specified query expressions, used to search for subscriptions. diff --git a/src/api/types/SearchSubscriptionsResponse.ts b/src/api/types/SearchSubscriptionsResponse.ts index 4e71da01a..4d5cd1082 100644 --- a/src/api/types/SearchSubscriptionsResponse.ts +++ b/src/api/types/SearchSubscriptionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the diff --git a/src/api/types/SearchTeamMembersFilter.ts b/src/api/types/SearchTeamMembersFilter.ts index c21df9ad8..129dd2bf4 100644 --- a/src/api/types/SearchTeamMembersFilter.ts +++ b/src/api/types/SearchTeamMembersFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied @@ -18,7 +18,7 @@ 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; + location_ids?: string[] | null; /** * When present, filters by team members who match the given status. * When empty, includes team members of all statuses. @@ -26,5 +26,5 @@ export interface SearchTeamMembersFilter { */ status?: Square.TeamMemberStatus; /** When present and set to true, returns the team member who is the owner of the Square account. */ - isOwner?: boolean | null; + is_owner?: boolean | null; } diff --git a/src/api/types/SearchTeamMembersQuery.ts b/src/api/types/SearchTeamMembersQuery.ts index 657d67159..1833ea5b7 100644 --- a/src/api/types/SearchTeamMembersQuery.ts +++ b/src/api/types/SearchTeamMembersQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the parameters in a search for `TeamMember` objects. diff --git a/src/api/types/SearchTeamMembersResponse.ts b/src/api/types/SearchTeamMembersResponse.ts index 0b84c9c15..31ba3d278 100644 --- a/src/api/types/SearchTeamMembersResponse.ts +++ b/src/api/types/SearchTeamMembersResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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[]; + team_members?: Square.TeamMember[]; /** * The opaque cursor for fetching the next page. For more information, see * [pagination](https://developer.squareup.com/docs/working-with-apis/pagination). diff --git a/src/api/types/SearchTerminalActionsResponse.ts b/src/api/types/SearchTerminalActionsResponse.ts index 243a6fb58..2489e4cd9 100644 --- a/src/api/types/SearchTerminalActionsResponse.ts +++ b/src/api/types/SearchTerminalActionsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SearchTerminalActionsResponse { /** Information on errors encountered during the request. */ diff --git a/src/api/types/SearchTerminalCheckoutsResponse.ts b/src/api/types/SearchTerminalCheckoutsResponse.ts index 764c4b2f9..4327e39b2 100644 --- a/src/api/types/SearchTerminalCheckoutsResponse.ts +++ b/src/api/types/SearchTerminalCheckoutsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SearchTerminalCheckoutsResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/SearchTerminalRefundsResponse.ts b/src/api/types/SearchTerminalRefundsResponse.ts index 0beaece31..05fecc619 100644 --- a/src/api/types/SearchTerminalRefundsResponse.ts +++ b/src/api/types/SearchTerminalRefundsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SearchTerminalRefundsResponse { /** Information about errors encountered during the request. */ diff --git a/src/api/types/SearchTimecardsResponse.ts b/src/api/types/SearchTimecardsResponse.ts index 7d83caa1c..35bd1c78f 100644 --- a/src/api/types/SearchTimecardsResponse.ts +++ b/src/api/types/SearchTimecardsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request for `Timecard` objects. The response contains diff --git a/src/api/types/SearchVendorsRequestFilter.ts b/src/api/types/SearchVendorsRequestFilter.ts index 973b97569..f19a82d97 100644 --- a/src/api/types/SearchVendorsRequestFilter.ts +++ b/src/api/types/SearchVendorsRequestFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines supported query expressions to search for vendors by. diff --git a/src/api/types/SearchVendorsRequestSort.ts b/src/api/types/SearchVendorsRequestSort.ts index 99caa763d..9bf7c8dc8 100644 --- a/src/api/types/SearchVendorsRequestSort.ts +++ b/src/api/types/SearchVendorsRequestSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines a sorter used to sort results from [SearchVendors](api-endpoint:Vendors-SearchVendors). diff --git a/src/api/types/SearchVendorsResponse.ts b/src/api/types/SearchVendorsResponse.ts index 3b001cbba..eb90adc48 100644 --- a/src/api/types/SearchVendorsResponse.ts +++ b/src/api/types/SearchVendorsResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an output from a call to [SearchVendors](api-endpoint:Vendors-SearchVendors). diff --git a/src/api/types/SegmentFilter.ts b/src/api/types/SegmentFilter.ts index 65e099271..ec10149dd 100644 --- a/src/api/types/SegmentFilter.ts +++ b/src/api/types/SegmentFilter.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + service_variation_id: 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. @@ -18,5 +18,5 @@ export interface SegmentFilter { * * When no expression is specified, any service-providing team member is eligible to fulfill the Booking. */ - teamMemberIdFilter?: Square.FilterValue; + team_member_id_filter?: Square.FilterValue; } diff --git a/src/api/types/SelectOption.ts b/src/api/types/SelectOption.ts index 2cb33751a..a5100f123 100644 --- a/src/api/types/SelectOption.ts +++ b/src/api/types/SelectOption.ts @@ -4,7 +4,7 @@ export interface SelectOption { /** The reference id for the option. */ - referenceId: string; + reference_id: 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 index 26d3b1af5..10952fe48 100644 --- a/src/api/types/SelectOptions.ts +++ b/src/api/types/SelectOptions.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SelectOptions { /** The title text to display in the select flow on the Terminal. */ @@ -12,5 +12,5 @@ export interface SelectOptions { /** 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; + selected_option?: Square.SelectOption; } diff --git a/src/api/types/Shift.ts b/src/api/types/Shift.ts index 4b53daf35..534df67e3 100644 --- a/src/api/types/Shift.ts +++ b/src/api/types/Shift.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A record of the hourly rate, start, and end times for a single work shift @@ -16,12 +16,12 @@ 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; + employee_id?: string | null; /** * The ID of the location this shift occurred at. The location should be based on * where the employee clocked in. */ - locationId: string; + location_id: 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 @@ -32,12 +32,12 @@ export interface Shift { * RFC 3339; shifted to the location timezone + offset. Precision up to the * minute is respected; seconds are truncated. */ - startAt: string; + start_at: string; /** * RFC 3339; shifted to the timezone + offset. Precision up to the minute is * respected; seconds are truncated. */ - endAt?: string | null; + end_at?: 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 @@ -59,11 +59,11 @@ export interface Shift { */ version?: number; /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - createdAt?: string; + created_at?: string; /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - updatedAt?: string; + updated_at?: string; /** The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26". */ - teamMemberId?: string | null; + team_member_id?: string | null; /** The tips declared by the team member for the shift. */ - declaredCashTipMoney?: Square.Money; + declared_cash_tip_money?: Square.Money; } diff --git a/src/api/types/ShiftFilter.ts b/src/api/types/ShiftFilter.ts index 09bde57b1..1ff868688 100644 --- a/src/api/types/ShiftFilter.ts +++ b/src/api/types/ShiftFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines a filter used in a search for `Shift` records. `AND` logic is @@ -12,9 +12,9 @@ import * as Square from "../index"; */ export interface ShiftFilter { /** Fetch shifts for the specified location. */ - locationIds?: string[] | null; + location_ids?: string[] | null; /** Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead. */ - employeeIds?: string[] | null; + employee_ids?: string[] | null; /** * Fetch a `Shift` instance by `Shift.status`. * See [ShiftFilterStatus](#type-shiftfilterstatus) for possible values @@ -27,5 +27,5 @@ export interface ShiftFilter { /** 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; + team_member_ids?: string[] | null; } diff --git a/src/api/types/ShiftQuery.ts b/src/api/types/ShiftQuery.ts index 7b977e3a3..e0d34e77a 100644 --- a/src/api/types/ShiftQuery.ts +++ b/src/api/types/ShiftQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The parameters of a `Shift` search query, which includes filter and sort options. diff --git a/src/api/types/ShiftSort.ts b/src/api/types/ShiftSort.ts index d12abc47d..ff1c6e74d 100644 --- a/src/api/types/ShiftSort.ts +++ b/src/api/types/ShiftSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Sets the sort order of search results. diff --git a/src/api/types/ShiftWage.ts b/src/api/types/ShiftWage.ts index ad082a8cc..8adf8a09e 100644 --- a/src/api/types/ShiftWage.ts +++ b/src/api/types/ShiftWage.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The hourly wage rate used to compensate an employee for this shift. @@ -16,12 +16,12 @@ export interface ShiftWage { * 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; + hourly_rate?: Square.Money; /** * The id of the job performed during this shift. Square * labor-reporting UIs might group shifts together by id. */ - jobId?: string; + job_id?: string; /** Whether team members are eligible for tips when working this job. */ - tipEligible?: boolean | null; + tip_eligible?: boolean | null; } diff --git a/src/api/types/ShiftWorkday.ts b/src/api/types/ShiftWorkday.ts index dcfc185f5..ab5fb58a3 100644 --- a/src/api/types/ShiftWorkday.ts +++ b/src/api/types/ShiftWorkday.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A `Shift` search query filter parameter that sets a range of days that @@ -12,17 +12,17 @@ import * as Square from "../index"; */ export interface ShiftWorkday { /** Dates for fetching the shifts. */ - dateRange?: Square.DateRange; + date_range?: Square.DateRange; /** * The strategy on which the dates are applied. * See [ShiftWorkdayMatcher](#type-shiftworkdaymatcher) for possible values */ - matchShiftsBy?: Square.ShiftWorkdayMatcher; + match_shifts_by?: 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; + default_timezone?: string | null; } diff --git a/src/api/types/ShippingFee.ts b/src/api/types/ShippingFee.ts index 9418d0a85..99cc6facc 100644 --- a/src/api/types/ShippingFee.ts +++ b/src/api/types/ShippingFee.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface ShippingFee { /** The name for the shipping fee. */ diff --git a/src/api/types/SignatureImage.ts b/src/api/types/SignatureImage.ts index 8147a46eb..432ea34d7 100644 --- a/src/api/types/SignatureImage.ts +++ b/src/api/types/SignatureImage.ts @@ -7,7 +7,7 @@ export interface SignatureImage { * The mime/type of the image data. * Use `image/png;base64` for png. */ - imageType?: string; + image_type?: string; /** The base64 representation of the image. */ data?: string; } diff --git a/src/api/types/SignatureOptions.ts b/src/api/types/SignatureOptions.ts index 0f8c1dd8c..d9e6b9adb 100644 --- a/src/api/types/SignatureOptions.ts +++ b/src/api/types/SignatureOptions.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SignatureOptions { /** The title text to display in the signature capture flow on the Terminal. */ diff --git a/src/api/types/Site.ts b/src/api/types/Site.ts index 2980bd188..098f20ab0 100644 --- a/src/api/types/Site.ts +++ b/src/api/types/Site.ts @@ -9,13 +9,13 @@ export interface Site { /** The Square-assigned ID of the site. */ id?: string; /** The title of the site. */ - siteTitle?: string | null; + site_title?: 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; + is_published?: boolean | null; /** The timestamp of when the site was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp of when the site was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/Snippet.ts b/src/api/types/Snippet.ts index 912e3fd6e..7f6b46714 100644 --- a/src/api/types/Snippet.ts +++ b/src/api/types/Snippet.ts @@ -9,11 +9,11 @@ export interface Snippet { /** The Square-assigned ID for the snippet. */ id?: string; /** The ID of the site that contains the snippet. */ - siteId?: string; + site_id?: 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; + created_at?: string; /** The timestamp of when the snippet was last updated on the site, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/SourceApplication.ts b/src/api/types/SourceApplication.ts index 5cbddc36b..4e2638bc1 100644 --- a/src/api/types/SourceApplication.ts +++ b/src/api/types/SourceApplication.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents information about the application used to generate a change. @@ -17,7 +17,7 @@ export interface SourceApplication { * __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; + application_id?: string | null; /** * __Read only__ The display name of the application * (for example, `"Custom Application"` or `"Square POS 4.74 for Android"`). diff --git a/src/api/types/SquareAccountDetails.ts b/src/api/types/SquareAccountDetails.ts index edacd3d33..5312dfec2 100644 --- a/src/api/types/SquareAccountDetails.ts +++ b/src/api/types/SquareAccountDetails.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Additional details about Square Account payments. */ export interface SquareAccountDetails { /** Unique identifier for the payment source used for this payment. */ - paymentSourceToken?: string | null; + payment_source_token?: 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 index 66e3a9ab2..21601dfd3 100644 --- a/src/api/types/StandardUnitDescription.ts +++ b/src/api/types/StandardUnitDescription.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Contains the name and abbreviation for standard measurement unit. diff --git a/src/api/types/StandardUnitDescriptionGroup.ts b/src/api/types/StandardUnitDescriptionGroup.ts index 55625e4c6..8be7bd76c 100644 --- a/src/api/types/StandardUnitDescriptionGroup.ts +++ b/src/api/types/StandardUnitDescriptionGroup.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Group of standard measurement units. */ export interface StandardUnitDescriptionGroup { /** List of standard (non-custom) measurement units in this description group. */ - standardUnitDescriptions?: Square.StandardUnitDescription[] | null; + standard_unit_descriptions?: Square.StandardUnitDescription[] | null; /** IETF language tag. */ - languageCode?: string | null; + language_code?: string | null; } diff --git a/src/api/types/SubmitEvidenceResponse.ts b/src/api/types/SubmitEvidenceResponse.ts index 5e647ee24..9bed0ed9d 100644 --- a/src/api/types/SubmitEvidenceResponse.ts +++ b/src/api/types/SubmitEvidenceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields in a `SubmitEvidence` response. diff --git a/src/api/types/Subscription.ts b/src/api/types/Subscription.ts index 8a209bba2..912882db4 100644 --- a/src/api/types/Subscription.ts +++ b/src/api/types/Subscription.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a subscription purchased by a customer. @@ -14,13 +14,13 @@ export interface Subscription { /** The Square-assigned ID of the subscription. */ id?: string; /** The ID of the location associated with the subscription. */ - locationId?: string; + location_id?: string; /** The ID of the subscribed-to [subscription plan variation](entity:CatalogSubscriptionPlanVariation). */ - planVariationId?: string; + plan_variation_id?: string; /** The ID of the subscribing [customer](entity:Customer) profile. */ - customerId?: string; + customer_id?: string; /** The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to start the subscription. */ - startDate?: string; + start_date?: 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. @@ -29,7 +29,7 @@ export interface Subscription { * * This field cannot be updated, other than being cleared. */ - canceledDate?: string | null; + canceled_date?: string | null; /** * The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the * subscription. @@ -41,7 +41,7 @@ export interface Subscription { * (or charged the card) on May 1. For the monthly billing scenario, * this date is then set to May 31. */ - chargedThroughDate?: string; + charged_through_date?: string; /** * The current status of the subscription. * See [SubscriptionStatus](#type-subscriptionstatus) for possible values @@ -53,32 +53,32 @@ export interface Subscription { * separator and without a `'%'` sign. For example, a value of `7.5` * corresponds to 7.5%. */ - taxPercentage?: string | null; + tax_percentage?: 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[]; + invoice_ids?: 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; + price_override_money?: 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; + version?: number | bigint; /** The timestamp when the subscription was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** * The ID of the [subscriber's](entity:Customer) [card](entity:Card) * used to charge for the subscription. */ - cardId?: string | null; + card_id?: string | null; /** * Timezone that will be used in date calculations for the subscription. * Defaults to the timezone of the location based on `location_id`. @@ -96,7 +96,7 @@ export interface Subscription { */ actions?: Square.SubscriptionAction[] | null; /** The day of the month on which the subscription will issue invoices and publish orders. */ - monthlyBillingAnchorDate?: number; + monthly_billing_anchor_date?: number; /** array of phases for this subscription */ phases?: Square.Phase[]; } diff --git a/src/api/types/SubscriptionAction.ts b/src/api/types/SubscriptionAction.ts index a9542aced..25a7d4081 100644 --- a/src/api/types/SubscriptionAction.ts +++ b/src/api/types/SubscriptionAction.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an action as a pending change to a subscription. @@ -16,11 +16,11 @@ export interface SubscriptionAction { */ type?: Square.SubscriptionActionType; /** The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. */ - effectiveDate?: string | null; + effective_date?: string | null; /** The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. */ - monthlyBillingAnchorDate?: number | null; + monthly_billing_anchor_date?: 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; + new_plan_variation_id?: string | null; } diff --git a/src/api/types/SubscriptionCreatedEvent.ts b/src/api/types/SubscriptionCreatedEvent.ts index 438c22f09..40aaf29d3 100644 --- a/src/api/types/SubscriptionCreatedEvent.ts +++ b/src/api/types/SubscriptionCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Subscription](entity:Subscription) is created. */ export interface SubscriptionCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"subscription.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.SubscriptionCreatedEventData; } diff --git a/src/api/types/SubscriptionCreatedEventData.ts b/src/api/types/SubscriptionCreatedEventData.ts index 560b27b55..d82588d98 100644 --- a/src/api/types/SubscriptionCreatedEventData.ts +++ b/src/api/types/SubscriptionCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SubscriptionCreatedEventData { /** Name of the affected object’s type, `"subscription"`. */ diff --git a/src/api/types/SubscriptionCreatedEventObject.ts b/src/api/types/SubscriptionCreatedEventObject.ts index d9c964abc..3a7f0ec25 100644 --- a/src/api/types/SubscriptionCreatedEventObject.ts +++ b/src/api/types/SubscriptionCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SubscriptionCreatedEventObject { /** The created subscription. */ diff --git a/src/api/types/SubscriptionEvent.ts b/src/api/types/SubscriptionEvent.ts index d5e54af48..be59e72dc 100644 --- a/src/api/types/SubscriptionEvent.ts +++ b/src/api/types/SubscriptionEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes changes to a subscription and the subscription status. @@ -14,15 +14,15 @@ export interface SubscriptionEvent { * Type of the subscription event. * See [SubscriptionEventSubscriptionEventType](#type-subscriptioneventsubscriptioneventtype) for possible values */ - subscriptionEventType: Square.SubscriptionEventSubscriptionEventType; + subscription_event_type: Square.SubscriptionEventSubscriptionEventType; /** The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. */ - effectiveDate: string; + effective_date: string; /** The day-of-the-month the billing anchor date was changed to, if applicable. */ - monthlyBillingAnchorDate?: number; + monthly_billing_anchor_date?: 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; + plan_variation_id: string; } diff --git a/src/api/types/SubscriptionEventInfo.ts b/src/api/types/SubscriptionEventInfo.ts index 4b46a5784..61ed1b5e8 100644 --- a/src/api/types/SubscriptionEventInfo.ts +++ b/src/api/types/SubscriptionEventInfo.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Provides information about the subscription event. diff --git a/src/api/types/SubscriptionPhase.ts b/src/api/types/SubscriptionPhase.ts index d12e92001..40fff5eec 100644 --- a/src/api/types/SubscriptionPhase.ts +++ b/src/api/types/SubscriptionPhase.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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). @@ -18,9 +18,9 @@ export interface SubscriptionPhase { /** 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; + recurring_price_money?: 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; + ordinal?: (number | bigint) | null; /** The subscription pricing. */ pricing?: Square.SubscriptionPricing; } diff --git a/src/api/types/SubscriptionPricing.ts b/src/api/types/SubscriptionPricing.ts index 26fdc06f0..66db5ec45 100644 --- a/src/api/types/SubscriptionPricing.ts +++ b/src/api/types/SubscriptionPricing.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes the pricing for the subscription. @@ -14,7 +14,7 @@ export interface SubscriptionPricing { */ type?: Square.SubscriptionPricingType; /** The ids of the discount catalog objects */ - discountIds?: string[] | null; + discount_ids?: string[] | null; /** The price of the subscription, if STATIC */ - priceMoney?: Square.Money; + price_money?: Square.Money; } diff --git a/src/api/types/SubscriptionTestResult.ts b/src/api/types/SubscriptionTestResult.ts index dcaa70218..1d64e2cda 100644 --- a/src/api/types/SubscriptionTestResult.ts +++ b/src/api/types/SubscriptionTestResult.ts @@ -10,17 +10,17 @@ 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; + status_code?: 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; + created_at?: 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; + updated_at?: string; } diff --git a/src/api/types/SubscriptionUpdatedEvent.ts b/src/api/types/SubscriptionUpdatedEvent.ts index 6e2b3ceaa..87b5f6084 100644 --- a/src/api/types/SubscriptionUpdatedEvent.ts +++ b/src/api/types/SubscriptionUpdatedEvent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Subscription](entity:Subscription) is updated. @@ -11,13 +11,13 @@ import * as Square from "../index"; */ export interface SubscriptionUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"subscription.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.SubscriptionUpdatedEventData; } diff --git a/src/api/types/SubscriptionUpdatedEventData.ts b/src/api/types/SubscriptionUpdatedEventData.ts index 5d66a89cc..9342966b5 100644 --- a/src/api/types/SubscriptionUpdatedEventData.ts +++ b/src/api/types/SubscriptionUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SubscriptionUpdatedEventData { /** Name of the affected object’s type, `"subscription"`. */ diff --git a/src/api/types/SubscriptionUpdatedEventObject.ts b/src/api/types/SubscriptionUpdatedEventObject.ts index e284b9256..dabacb34a 100644 --- a/src/api/types/SubscriptionUpdatedEventObject.ts +++ b/src/api/types/SubscriptionUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface SubscriptionUpdatedEventObject { /** The updated subscription. */ diff --git a/src/api/types/SwapPlanResponse.ts b/src/api/types/SwapPlanResponse.ts index d431f6471..3b308986b 100644 --- a/src/api/types/SwapPlanResponse.ts +++ b/src/api/types/SwapPlanResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response of the diff --git a/src/api/types/TaxIds.ts b/src/api/types/TaxIds.ts index 42ce0d3f6..7b8155e99 100644 --- a/src/api/types/TaxIds.ts +++ b/src/api/types/TaxIds.ts @@ -11,26 +11,26 @@ export interface TaxIds { * If the EU VAT number is present, it is well-formed and has been * validated with VIES, the VAT Information Exchange System. */ - euVat?: string; + eu_vat?: 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; + fr_siret?: 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; + fr_naf?: 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; + es_nif?: string; /** * The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan. * For example, `T1234567890123`. */ - jpQii?: string; + jp_qii?: string; } diff --git a/src/api/types/TeamMember.ts b/src/api/types/TeamMember.ts index b878cb8b5..81aa6fbb9 100644 --- a/src/api/types/TeamMember.ts +++ b/src/api/types/TeamMember.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A record representing an individual team member for a business. @@ -11,35 +11,35 @@ 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; + reference_id?: string | null; /** Whether the team member is the owner of the Square account. */ - isOwner?: boolean; + is_owner?: 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; + given_name?: string | null; /** The family name (that is, the last name) associated with the team member. */ - familyName?: string | null; + family_name?: 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; + email_address?: 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; + phone_number?: string | null; /** The timestamp when the team member was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the team member was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; /** Describes the team member's assigned locations. */ - assignedLocations?: Square.TeamMemberAssignedLocations; + assigned_locations?: Square.TeamMemberAssignedLocations; /** Information about the team member's overtime exemption status, job assignments, and compensation. */ - wageSetting?: Square.WageSetting; + wage_setting?: Square.WageSetting; } diff --git a/src/api/types/TeamMemberAssignedLocations.ts b/src/api/types/TeamMemberAssignedLocations.ts index c55f08566..dac34c19b 100644 --- a/src/api/types/TeamMemberAssignedLocations.ts +++ b/src/api/types/TeamMemberAssignedLocations.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * An object that represents a team member's assignment to locations. @@ -12,7 +12,7 @@ export interface TeamMemberAssignedLocations { * The current assignment type of the team member. * See [TeamMemberAssignedLocationsAssignmentType](#type-teammemberassignedlocationsassignmenttype) for possible values */ - assignmentType?: Square.TeamMemberAssignedLocationsAssignmentType; + assignment_type?: Square.TeamMemberAssignedLocationsAssignmentType; /** The explicit locations that the team member is assigned to. */ - locationIds?: string[] | null; + location_ids?: string[] | null; } diff --git a/src/api/types/TeamMemberBookingProfile.ts b/src/api/types/TeamMemberBookingProfile.ts index 2ac2d2a8c..26baa3dc1 100644 --- a/src/api/types/TeamMemberBookingProfile.ts +++ b/src/api/types/TeamMemberBookingProfile.ts @@ -7,13 +7,13 @@ */ export interface TeamMemberBookingProfile { /** The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile. */ - teamMemberId?: string; + team_member_id?: string; /** The description of the team member. */ description?: string; /** The display name of the team member. */ - displayName?: string; + display_name?: 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; + is_bookable?: boolean | null; /** The URL of the team member's image for the bookings profile. */ - profileImageUrl?: string; + profile_image_url?: string; } diff --git a/src/api/types/TeamMemberCreatedEvent.ts b/src/api/types/TeamMemberCreatedEvent.ts index f7dfbae12..505f184e8 100644 --- a/src/api/types/TeamMemberCreatedEvent.ts +++ b/src/api/types/TeamMemberCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Team Member is created. */ export interface TeamMemberCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"team_member.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TeamMemberCreatedEventData; } diff --git a/src/api/types/TeamMemberCreatedEventData.ts b/src/api/types/TeamMemberCreatedEventData.ts index af2f3edfc..7e4783d78 100644 --- a/src/api/types/TeamMemberCreatedEventData.ts +++ b/src/api/types/TeamMemberCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TeamMemberCreatedEventData { /** Name of the affected object’s type, `"team_member"`. */ diff --git a/src/api/types/TeamMemberCreatedEventObject.ts b/src/api/types/TeamMemberCreatedEventObject.ts index 5b001c88e..693c40387 100644 --- a/src/api/types/TeamMemberCreatedEventObject.ts +++ b/src/api/types/TeamMemberCreatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TeamMemberCreatedEventObject { /** The created team member. */ - teamMember?: Square.TeamMember; + team_member?: Square.TeamMember; } diff --git a/src/api/types/TeamMemberUpdatedEvent.ts b/src/api/types/TeamMemberUpdatedEvent.ts index dc8c82260..35b2b7199 100644 --- a/src/api/types/TeamMemberUpdatedEvent.ts +++ b/src/api/types/TeamMemberUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Team Member is updated. */ export interface TeamMemberUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"team_member.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TeamMemberUpdatedEventData; } diff --git a/src/api/types/TeamMemberUpdatedEventData.ts b/src/api/types/TeamMemberUpdatedEventData.ts index 4d7f14acc..490d0ed38 100644 --- a/src/api/types/TeamMemberUpdatedEventData.ts +++ b/src/api/types/TeamMemberUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TeamMemberUpdatedEventData { /** Name of the affected object’s type, `"team_member"`. */ diff --git a/src/api/types/TeamMemberUpdatedEventObject.ts b/src/api/types/TeamMemberUpdatedEventObject.ts index ce01e2842..951dfba5e 100644 --- a/src/api/types/TeamMemberUpdatedEventObject.ts +++ b/src/api/types/TeamMemberUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TeamMemberUpdatedEventObject { /** The updated team member. */ - teamMember?: Square.TeamMember; + team_member?: Square.TeamMember; } diff --git a/src/api/types/TeamMemberWage.ts b/src/api/types/TeamMemberWage.ts index a1e255c78..542aff5ae 100644 --- a/src/api/types/TeamMemberWage.ts +++ b/src/api/types/TeamMemberWage.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Job and wage information for a [team member](entity:TeamMember). @@ -13,16 +13,16 @@ export interface TeamMemberWage { /** The UUID for this object. */ id?: string; /** The `TeamMember` that this wage is assigned to. */ - teamMemberId?: string | null; + team_member_id?: 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; + hourly_rate?: Square.Money; /** An identifier for the [job](entity:Job) that this wage relates to. */ - jobId?: string | null; + job_id?: string | null; /** Whether team members are eligible for tips when working this job. */ - tipEligible?: boolean | null; + tip_eligible?: boolean | null; } diff --git a/src/api/types/TeamMemberWageSettingUpdatedEvent.ts b/src/api/types/TeamMemberWageSettingUpdatedEvent.ts index a307690d4..2e612c659 100644 --- a/src/api/types/TeamMemberWageSettingUpdatedEvent.ts +++ b/src/api/types/TeamMemberWageSettingUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Wage Setting is updated. */ export interface TeamMemberWageSettingUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"team_member.wage_setting.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TeamMemberWageSettingUpdatedEventData; } diff --git a/src/api/types/TeamMemberWageSettingUpdatedEventData.ts b/src/api/types/TeamMemberWageSettingUpdatedEventData.ts index 29d21b315..788f6ddc3 100644 --- a/src/api/types/TeamMemberWageSettingUpdatedEventData.ts +++ b/src/api/types/TeamMemberWageSettingUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TeamMemberWageSettingUpdatedEventData { /** Name of the affected object’s type, `"wage_setting"`. */ diff --git a/src/api/types/TeamMemberWageSettingUpdatedEventObject.ts b/src/api/types/TeamMemberWageSettingUpdatedEventObject.ts index 5c51b6ca5..97afd421b 100644 --- a/src/api/types/TeamMemberWageSettingUpdatedEventObject.ts +++ b/src/api/types/TeamMemberWageSettingUpdatedEventObject.ts @@ -2,9 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TeamMemberWageSettingUpdatedEventObject { /** The updated team member wage setting. */ - wageSetting?: Square.WageSetting; + wage_setting?: Square.WageSetting; } diff --git a/src/api/types/Tender.ts b/src/api/types/Tender.ts index d0b7b1c0a..72ebe74a8 100644 --- a/src/api/types/Tender.ts +++ b/src/api/types/Tender.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a tender (i.e., a method of payment) used in a Square transaction. @@ -11,11 +11,11 @@ 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; + location_id?: string | null; /** The ID of the tender's associated transaction. */ - transactionId?: string | null; + transaction_id?: string | null; /** The timestamp for when the tender was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** An optional note associated with the tender at the time of payment. */ note?: string | null; /** @@ -23,21 +23,21 @@ export interface Tender { * the `total_money` of the corresponding [Payment](entity:Payment) will be equal to the * `amount_money` of the tender. */ - amountMoney?: Square.Money; + amount_money?: Square.Money; /** The tip's amount of the tender. */ - tipMoney?: Square.Money; + tip_money?: 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; + processing_fee_money?: 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; + customer_id?: string | null; /** * The type of tender, such as `CARD` or `CASH`. * See [TenderType](#type-tendertype) for possible values @@ -48,39 +48,39 @@ export interface Tender { * * This value is present only if the value of `type` is `CARD`. */ - cardDetails?: Square.TenderCardDetails; + card_details?: Square.TenderCardDetails; /** * The details of the cash tender. * * This value is present only if the value of `type` is `CASH`. */ - cashDetails?: Square.TenderCashDetails; + cash_details?: 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; + bank_account_details?: 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; + buy_now_pay_later_details?: 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; + square_account_details?: 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; + additional_recipients?: 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; + payment_id?: string | null; } diff --git a/src/api/types/TenderBankAccountDetails.ts b/src/api/types/TenderBankAccountDetails.ts index 1199c1800..8c35fbe13 100644 --- a/src/api/types/TenderBankAccountDetails.ts +++ b/src/api/types/TenderBankAccountDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the details of a tender with `type` `BANK_ACCOUNT`. diff --git a/src/api/types/TenderBuyNowPayLaterDetails.ts b/src/api/types/TenderBuyNowPayLaterDetails.ts index 0fd644977..e1cceb59c 100644 --- a/src/api/types/TenderBuyNowPayLaterDetails.ts +++ b/src/api/types/TenderBuyNowPayLaterDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. @@ -12,7 +12,7 @@ export interface TenderBuyNowPayLaterDetails { * The Buy Now Pay Later brand. * See [Brand](#type-brand) for possible values */ - buyNowPayLaterBrand?: Square.TenderBuyNowPayLaterDetailsBrand; + buy_now_pay_later_brand?: Square.TenderBuyNowPayLaterDetailsBrand; /** * The buy now pay later payment's current state (such as `AUTHORIZED` or * `CAPTURED`). See [TenderBuyNowPayLaterDetailsStatus](entity:TenderBuyNowPayLaterDetailsStatus) diff --git a/src/api/types/TenderCardDetails.ts b/src/api/types/TenderCardDetails.ts index e31bec1c8..2c1c805aa 100644 --- a/src/api/types/TenderCardDetails.ts +++ b/src/api/types/TenderCardDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` @@ -21,5 +21,5 @@ export interface TenderCardDetails { * The method used to enter the card's details for the transaction. * See [TenderCardDetailsEntryMethod](#type-tendercarddetailsentrymethod) for possible values */ - entryMethod?: Square.TenderCardDetailsEntryMethod; + entry_method?: Square.TenderCardDetailsEntryMethod; } diff --git a/src/api/types/TenderCashDetails.ts b/src/api/types/TenderCashDetails.ts index 423925958..58b738793 100644 --- a/src/api/types/TenderCashDetails.ts +++ b/src/api/types/TenderCashDetails.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + buyer_tendered_money?: Square.Money; /** The amount of change returned to the buyer. */ - changeBackMoney?: Square.Money; + change_back_money?: Square.Money; } diff --git a/src/api/types/TenderSquareAccountDetails.ts b/src/api/types/TenderSquareAccountDetails.ts index 7b340004c..1180e9c4b 100644 --- a/src/api/types/TenderSquareAccountDetails.ts +++ b/src/api/types/TenderSquareAccountDetails.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents the details of a tender with `type` `SQUARE_ACCOUNT`. diff --git a/src/api/types/TerminalAction.ts b/src/api/types/TerminalAction.ts index 0bc88412d..229541e21 100644 --- a/src/api/types/TerminalAction.ts +++ b/src/api/types/TerminalAction.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an action processed by the Square Terminal. @@ -14,7 +14,7 @@ export interface TerminalAction { * The unique Id of the device intended for this `TerminalAction`. * The Id can be retrieved from /v2/devices api. */ - deviceId?: string | null; + device_id?: 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 @@ -24,7 +24,7 @@ export interface TerminalAction { * * Maximum: 5 minutes */ - deadlineDuration?: string | null; + deadline_duration?: string | null; /** * The status of the `TerminalAction`. * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` @@ -34,48 +34,48 @@ export interface TerminalAction { * The reason why `TerminalAction` is canceled. Present if the status is `CANCELED`. * See [ActionCancelReason](#type-actioncancelreason) for possible values */ - cancelReason?: Square.ActionCancelReason; + cancel_reason?: Square.ActionCancelReason; /** The time when the `TerminalAction` was created as an RFC 3339 timestamp. */ - createdAt?: string; + created_at?: string; /** The time when the `TerminalAction` was last updated as an RFC 3339 timestamp. */ - updatedAt?: string; + updated_at?: string; /** The ID of the application that created the action. */ - appId?: string; + app_id?: string; /** The location id the action is attached to, if a link can be made. */ - locationId?: string; + location_id?: 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; + qr_code_options?: Square.QrCodeOptions; /** Describes configuration for the save-card action. Requires `SAVE_CARD` type. */ - saveCardOptions?: Square.SaveCardOptions; + save_card_options?: Square.SaveCardOptions; /** Describes configuration for the signature capture action. Requires `SIGNATURE` type. */ - signatureOptions?: Square.SignatureOptions; + signature_options?: Square.SignatureOptions; /** Describes configuration for the confirmation action. Requires `CONFIRMATION` type. */ - confirmationOptions?: Square.ConfirmationOptions; + confirmation_options?: Square.ConfirmationOptions; /** Describes configuration for the receipt action. Requires `RECEIPT` type. */ - receiptOptions?: Square.ReceiptOptions; + receipt_options?: Square.ReceiptOptions; /** Describes configuration for the data collection action. Requires `DATA_COLLECTION` type. */ - dataCollectionOptions?: Square.DataCollectionOptions; + data_collection_options?: Square.DataCollectionOptions; /** Describes configuration for the select action. Requires `SELECT` type. */ - selectOptions?: Square.SelectOptions; + select_options?: 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; + device_metadata?: 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; + await_next_action?: 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. @@ -84,5 +84,5 @@ export interface TerminalAction { * * Maximum: 5 minutes */ - awaitNextActionDuration?: string | null; + await_next_action_duration?: string | null; } diff --git a/src/api/types/TerminalActionCreatedEvent.ts b/src/api/types/TerminalActionCreatedEvent.ts index f2adf234a..778aa544e 100644 --- a/src/api/types/TerminalActionCreatedEvent.ts +++ b/src/api/types/TerminalActionCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a TerminalAction is created. */ export interface TerminalActionCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"terminal.action.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TerminalActionCreatedEventData; } diff --git a/src/api/types/TerminalActionCreatedEventData.ts b/src/api/types/TerminalActionCreatedEventData.ts index cc97f575a..6c70cb700 100644 --- a/src/api/types/TerminalActionCreatedEventData.ts +++ b/src/api/types/TerminalActionCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalActionCreatedEventData { /** Name of the created object’s type, `"action"`. */ diff --git a/src/api/types/TerminalActionCreatedEventObject.ts b/src/api/types/TerminalActionCreatedEventObject.ts index abc06f71c..94b8b79ab 100644 --- a/src/api/types/TerminalActionCreatedEventObject.ts +++ b/src/api/types/TerminalActionCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalActionCreatedEventObject { /** The created terminal action. */ diff --git a/src/api/types/TerminalActionQuery.ts b/src/api/types/TerminalActionQuery.ts index 8dcd1d695..0ac11be49 100644 --- a/src/api/types/TerminalActionQuery.ts +++ b/src/api/types/TerminalActionQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalActionQuery { /** Options for filtering returned `TerminalAction`s */ diff --git a/src/api/types/TerminalActionQueryFilter.ts b/src/api/types/TerminalActionQueryFilter.ts index b37e776e7..87e9dacf3 100644 --- a/src/api/types/TerminalActionQueryFilter.ts +++ b/src/api/types/TerminalActionQueryFilter.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + device_id?: 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; + created_at?: Square.TimeRange; /** * Filter results with the desired status of the `TerminalAction` * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` diff --git a/src/api/types/TerminalActionQuerySort.ts b/src/api/types/TerminalActionQuerySort.ts index 9bd211967..3e4a4ec74 100644 --- a/src/api/types/TerminalActionQuerySort.ts +++ b/src/api/types/TerminalActionQuerySort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalActionQuerySort { /** @@ -11,5 +11,5 @@ export interface TerminalActionQuerySort { * - `DESC` - Newest to oldest (default). * See [SortOrder](#type-sortorder) for possible values */ - sortOrder?: Square.SortOrder; + sort_order?: Square.SortOrder; } diff --git a/src/api/types/TerminalActionUpdatedEvent.ts b/src/api/types/TerminalActionUpdatedEvent.ts index df9adb9ad..8f1d73cec 100644 --- a/src/api/types/TerminalActionUpdatedEvent.ts +++ b/src/api/types/TerminalActionUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a TerminalAction is updated. */ export interface TerminalActionUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"terminal.action.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TerminalActionUpdatedEventData; } diff --git a/src/api/types/TerminalActionUpdatedEventData.ts b/src/api/types/TerminalActionUpdatedEventData.ts index 785ba72e8..98a8a4d9b 100644 --- a/src/api/types/TerminalActionUpdatedEventData.ts +++ b/src/api/types/TerminalActionUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalActionUpdatedEventData { /** Name of the updated object’s type, `"action"`. */ diff --git a/src/api/types/TerminalActionUpdatedEventObject.ts b/src/api/types/TerminalActionUpdatedEventObject.ts index e287bb58d..edfcf29f0 100644 --- a/src/api/types/TerminalActionUpdatedEventObject.ts +++ b/src/api/types/TerminalActionUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalActionUpdatedEventObject { /** The updated terminal action. */ diff --git a/src/api/types/TerminalCheckout.ts b/src/api/types/TerminalCheckout.ts index 1247ec526..1a14a2b33 100644 --- a/src/api/types/TerminalCheckout.ts +++ b/src/api/types/TerminalCheckout.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a checkout processed by the Square Terminal. @@ -11,25 +11,25 @@ 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; + amount_money: 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; + reference_id?: 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. */ - orderId?: string | null; + order_id?: string | null; /** Payment-specific options for the checkout request. */ - paymentOptions?: Square.PaymentOptions; + payment_options?: Square.PaymentOptions; /** Options to control the display and behavior of the Square Terminal device. */ - deviceOptions: Square.DeviceCheckoutOptions; + device_options: 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 @@ -39,7 +39,7 @@ export interface TerminalCheckout { * * Maximum: 5 minutes */ - deadlineDuration?: string | null; + deadline_duration?: string | null; /** * The status of the `TerminalCheckout`. * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` @@ -49,26 +49,26 @@ export interface TerminalCheckout { * The reason why `TerminalCheckout` is canceled. Present if the status is `CANCELED`. * See [ActionCancelReason](#type-actioncancelreason) for possible values */ - cancelReason?: Square.ActionCancelReason; + cancel_reason?: Square.ActionCancelReason; /** A list of IDs for payments created by this `TerminalCheckout`. */ - paymentIds?: string[]; + payment_ids?: string[]; /** The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp. */ - createdAt?: string; + created_at?: string; /** The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp. */ - updatedAt?: string; + updated_at?: string; /** The ID of the application that created the checkout. */ - appId?: string; + app_id?: string; /** The location of the device where the `TerminalCheckout` was directed. */ - locationId?: string; + location_id?: 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; + payment_type?: Square.CheckoutOptionsPaymentType; /** An optional ID of the team member associated with creating the checkout. */ - teamMemberId?: string | null; + team_member_id?: string | null; /** An optional ID of the customer associated with the checkout. */ - customerId?: string | null; + customer_id?: string | null; /** * The amount the developer is taking as a fee for facilitating the payment on behalf * of the seller. @@ -83,16 +83,16 @@ export interface TerminalCheckout { * * 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; + app_fee_money?: 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. */ - statementDescriptionIdentifier?: string | null; + statement_description_identifier?: 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`). */ - tipMoney?: Square.Money; + tip_money?: Square.Money; } diff --git a/src/api/types/TerminalCheckoutCreatedEvent.ts b/src/api/types/TerminalCheckoutCreatedEvent.ts index 882e22032..2ca5523f4 100644 --- a/src/api/types/TerminalCheckoutCreatedEvent.ts +++ b/src/api/types/TerminalCheckoutCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [TerminalCheckout](entity:TerminalCheckout) is created. */ export interface TerminalCheckoutCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"terminal.checkout.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TerminalCheckoutCreatedEventData; } diff --git a/src/api/types/TerminalCheckoutCreatedEventData.ts b/src/api/types/TerminalCheckoutCreatedEventData.ts index 185540003..0918c9fb3 100644 --- a/src/api/types/TerminalCheckoutCreatedEventData.ts +++ b/src/api/types/TerminalCheckoutCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalCheckoutCreatedEventData { /** Name of the created object’s type, `"checkout"`. */ diff --git a/src/api/types/TerminalCheckoutCreatedEventObject.ts b/src/api/types/TerminalCheckoutCreatedEventObject.ts index 95871ff27..05e1075fa 100644 --- a/src/api/types/TerminalCheckoutCreatedEventObject.ts +++ b/src/api/types/TerminalCheckoutCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalCheckoutCreatedEventObject { /** The created terminal checkout */ diff --git a/src/api/types/TerminalCheckoutQuery.ts b/src/api/types/TerminalCheckoutQuery.ts index ff31643bc..6ccfd9186 100644 --- a/src/api/types/TerminalCheckoutQuery.ts +++ b/src/api/types/TerminalCheckoutQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalCheckoutQuery { /** Options for filtering returned `TerminalCheckout` objects. */ diff --git a/src/api/types/TerminalCheckoutQueryFilter.ts b/src/api/types/TerminalCheckoutQueryFilter.ts index 0bad649c3..71204be32 100644 --- a/src/api/types/TerminalCheckoutQueryFilter.ts +++ b/src/api/types/TerminalCheckoutQueryFilter.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + device_id?: 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; + created_at?: Square.TimeRange; /** * Filtered results with the desired status of the `TerminalCheckout`. * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` diff --git a/src/api/types/TerminalCheckoutQuerySort.ts b/src/api/types/TerminalCheckoutQuerySort.ts index f9cec6434..f37f21edd 100644 --- a/src/api/types/TerminalCheckoutQuerySort.ts +++ b/src/api/types/TerminalCheckoutQuerySort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalCheckoutQuerySort { /** @@ -10,5 +10,5 @@ export interface TerminalCheckoutQuerySort { * Default: `DESC` * See [SortOrder](#type-sortorder) for possible values */ - sortOrder?: Square.SortOrder; + sort_order?: Square.SortOrder; } diff --git a/src/api/types/TerminalCheckoutUpdatedEvent.ts b/src/api/types/TerminalCheckoutUpdatedEvent.ts index 5a3e54993..dc070bb33 100644 --- a/src/api/types/TerminalCheckoutUpdatedEvent.ts +++ b/src/api/types/TerminalCheckoutUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [TerminalCheckout](entity:TerminalCheckout) is updated. */ export interface TerminalCheckoutUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"terminal.checkout.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TerminalCheckoutUpdatedEventData; } diff --git a/src/api/types/TerminalCheckoutUpdatedEventData.ts b/src/api/types/TerminalCheckoutUpdatedEventData.ts index eec1ee3d3..c15f5c9ea 100644 --- a/src/api/types/TerminalCheckoutUpdatedEventData.ts +++ b/src/api/types/TerminalCheckoutUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalCheckoutUpdatedEventData { /** Name of the updated object’s type, `"checkout"`. */ diff --git a/src/api/types/TerminalCheckoutUpdatedEventObject.ts b/src/api/types/TerminalCheckoutUpdatedEventObject.ts index 7a51fb290..97b047055 100644 --- a/src/api/types/TerminalCheckoutUpdatedEventObject.ts +++ b/src/api/types/TerminalCheckoutUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalCheckoutUpdatedEventObject { /** The updated terminal checkout */ diff --git a/src/api/types/TerminalRefund.ts b/src/api/types/TerminalRefund.ts index eb858f1e9..4c67c41c4 100644 --- a/src/api/types/TerminalRefund.ts +++ b/src/api/types/TerminalRefund.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. @@ -11,24 +11,24 @@ export interface TerminalRefund { /** A unique ID for this `TerminalRefund`. */ id?: string; /** The reference to the payment refund created by completing this `TerminalRefund`. */ - refundId?: string; + refund_id?: string; /** The unique ID of the payment being refunded. */ - paymentId: string; + payment_id: string; /** The reference to the Square order ID for the payment identified by the `payment_id`. */ - orderId?: string; + order_id?: 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; + amount_money: 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; + device_id: 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 @@ -38,7 +38,7 @@ export interface TerminalRefund { * * Maximum: 5 minutes */ - deadlineDuration?: string | null; + deadline_duration?: string | null; /** * The status of the `TerminalRefund`. * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. @@ -48,13 +48,13 @@ export interface TerminalRefund { * Present if the status is `CANCELED`. * See [ActionCancelReason](#type-actioncancelreason) for possible values */ - cancelReason?: Square.ActionCancelReason; + cancel_reason?: Square.ActionCancelReason; /** The time when the `TerminalRefund` was created, as an RFC 3339 timestamp. */ - createdAt?: string; + created_at?: string; /** The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp. */ - updatedAt?: string; + updated_at?: string; /** The ID of the application that created the refund. */ - appId?: string; + app_id?: string; /** The location of the device where the `TerminalRefund` was directed. */ - locationId?: string; + location_id?: string; } diff --git a/src/api/types/TerminalRefundCreatedEvent.ts b/src/api/types/TerminalRefundCreatedEvent.ts index 4b4dab55a..69b7b2d63 100644 --- a/src/api/types/TerminalRefundCreatedEvent.ts +++ b/src/api/types/TerminalRefundCreatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Terminal API refund is created. */ export interface TerminalRefundCreatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"terminal.refund.created"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TerminalRefundCreatedEventData; } diff --git a/src/api/types/TerminalRefundCreatedEventData.ts b/src/api/types/TerminalRefundCreatedEventData.ts index f8477f22a..b405cb0ca 100644 --- a/src/api/types/TerminalRefundCreatedEventData.ts +++ b/src/api/types/TerminalRefundCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalRefundCreatedEventData { /** Name of the created object’s type, `"refund"`. */ diff --git a/src/api/types/TerminalRefundCreatedEventObject.ts b/src/api/types/TerminalRefundCreatedEventObject.ts index 5cc3e3ac0..46b1f99d3 100644 --- a/src/api/types/TerminalRefundCreatedEventObject.ts +++ b/src/api/types/TerminalRefundCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalRefundCreatedEventObject { /** The created terminal refund. */ diff --git a/src/api/types/TerminalRefundQuery.ts b/src/api/types/TerminalRefundQuery.ts index 99a8c3ebd..3d9ec2fa2 100644 --- a/src/api/types/TerminalRefundQuery.ts +++ b/src/api/types/TerminalRefundQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalRefundQuery { /** The filter for the Terminal refund query. */ diff --git a/src/api/types/TerminalRefundQueryFilter.ts b/src/api/types/TerminalRefundQueryFilter.ts index 8afc83ed8..6722910db 100644 --- a/src/api/types/TerminalRefundQueryFilter.ts +++ b/src/api/types/TerminalRefundQueryFilter.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + device_id?: 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; + created_at?: Square.TimeRange; /** * Filtered results with the desired status of the `TerminalRefund`. * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. diff --git a/src/api/types/TerminalRefundQuerySort.ts b/src/api/types/TerminalRefundQuerySort.ts index 277d8f115..197420450 100644 --- a/src/api/types/TerminalRefundQuerySort.ts +++ b/src/api/types/TerminalRefundQuerySort.ts @@ -8,5 +8,5 @@ export interface TerminalRefundQuerySort { * - `ASC` - Oldest to newest. * - `DESC` - Newest to oldest (default). */ - sortOrder?: string | null; + sort_order?: string | null; } diff --git a/src/api/types/TerminalRefundUpdatedEvent.ts b/src/api/types/TerminalRefundUpdatedEvent.ts index fd38c9e1d..2bb96ea86 100644 --- a/src/api/types/TerminalRefundUpdatedEvent.ts +++ b/src/api/types/TerminalRefundUpdatedEvent.ts @@ -2,20 +2,20 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a Terminal API refund is updated. */ export interface TerminalRefundUpdatedEvent { /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The type of event this represents, `"terminal.refund.updated"`. */ type?: string | null; /** A unique ID for the event. */ - eventId?: string | null; + event_id?: string | null; /** RFC 3339 timestamp of when the event was created. */ - createdAt?: string; + created_at?: string; /** Data associated with the event. */ data?: Square.TerminalRefundUpdatedEventData; } diff --git a/src/api/types/TerminalRefundUpdatedEventData.ts b/src/api/types/TerminalRefundUpdatedEventData.ts index ec64faf3a..acfe688fe 100644 --- a/src/api/types/TerminalRefundUpdatedEventData.ts +++ b/src/api/types/TerminalRefundUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalRefundUpdatedEventData { /** Name of the updated object’s type, `"refund"`. */ diff --git a/src/api/types/TerminalRefundUpdatedEventObject.ts b/src/api/types/TerminalRefundUpdatedEventObject.ts index 2f20e8473..da454f142 100644 --- a/src/api/types/TerminalRefundUpdatedEventObject.ts +++ b/src/api/types/TerminalRefundUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface TerminalRefundUpdatedEventObject { /** The updated terminal refund. */ diff --git a/src/api/types/TestWebhookSubscriptionResponse.ts b/src/api/types/TestWebhookSubscriptionResponse.ts index 01af77619..6b47a1dbb 100644 --- a/src/api/types/TestWebhookSubscriptionResponse.ts +++ b/src/api/types/TestWebhookSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -15,5 +15,5 @@ export interface TestWebhookSubscriptionResponse { /** Information on errors encountered during the request. */ errors?: Square.Error_[]; /** The [SubscriptionTestResult](entity:SubscriptionTestResult). */ - subscriptionTestResult?: Square.SubscriptionTestResult; + subscription_test_result?: Square.SubscriptionTestResult; } diff --git a/src/api/types/TimeRange.ts b/src/api/types/TimeRange.ts index f0624288c..74be537ed 100644 --- a/src/api/types/TimeRange.ts +++ b/src/api/types/TimeRange.ts @@ -14,10 +14,10 @@ export interface TimeRange { * A datetime value in RFC 3339 format indicating when the time range * starts. */ - startAt?: string | null; + start_at?: string | null; /** * A datetime value in RFC 3339 format indicating when the time range * ends. */ - endAt?: string | null; + end_at?: string | null; } diff --git a/src/api/types/Timecard.ts b/src/api/types/Timecard.ts index 5e7ff025f..e77e9e46c 100644 --- a/src/api/types/Timecard.ts +++ b/src/api/types/Timecard.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A record of the hourly rate, start time, and end time of a single timecard (shift) @@ -16,7 +16,7 @@ export interface Timecard { * The ID of the [location](entity:Location) for this timecard. The location should be based on * where the team member clocked in. */ - locationId: string; + location_id: string; /** * **Read only** The time zone calculated from the location based on the `location_id`, * provided as a convenience value. Format: the IANA time zone database identifier for the @@ -27,12 +27,12 @@ export interface Timecard { * The start time of the timecard, in RFC 3339 format and shifted to the location * timezone + offset. Precision up to the minute is respected; seconds are truncated. */ - startAt: string; + start_at: string; /** * The end time of the timecard, in RFC 3339 format and shifted to the location * timezone + offset. Precision up to the minute is respected; seconds are truncated. */ - endAt?: string | null; + end_at?: 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 team member @@ -53,11 +53,11 @@ export interface Timecard { */ version?: number; /** The timestamp of when the timecard was created, in RFC 3339 format presented as UTC. */ - createdAt?: string; + created_at?: string; /** The timestamp of when the timecard was last updated, in RFC 3339 format presented as UTC. */ - updatedAt?: string; + updated_at?: string; /** The ID of the [team member](entity:TeamMember) this timecard belongs to. */ - teamMemberId: string; + team_member_id: string; /** The cash tips declared by the team member for this timecard. */ - declaredCashTipMoney?: Square.Money; + declared_cash_tip_money?: Square.Money; } diff --git a/src/api/types/TimecardFilter.ts b/src/api/types/TimecardFilter.ts index b81f5f90f..383cd192e 100644 --- a/src/api/types/TimecardFilter.ts +++ b/src/api/types/TimecardFilter.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines a filter used in a search for `Timecard` records. `AND` logic is @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface TimecardFilter { /** Fetch timecards for the specified location. */ - locationIds?: string[] | null; + location_ids?: string[] | null; /** * Fetch a `Timecard` instance by `Timecard.status`. * See [TimecardFilterStatus](#type-timecardfilterstatus) for possible values @@ -23,5 +23,5 @@ export interface TimecardFilter { /** Fetch the `Timecard` instances based on the workday date range. */ workday?: Square.TimecardWorkday; /** Fetch timecards for the specified team members. */ - teamMemberIds?: string[] | null; + team_member_ids?: string[] | null; } diff --git a/src/api/types/TimecardQuery.ts b/src/api/types/TimecardQuery.ts index 17307416c..358d22a00 100644 --- a/src/api/types/TimecardQuery.ts +++ b/src/api/types/TimecardQuery.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The parameters of a `Timecard` search query, which includes filter and sort options. diff --git a/src/api/types/TimecardSort.ts b/src/api/types/TimecardSort.ts index 5d2e15ebc..a1c71055e 100644 --- a/src/api/types/TimecardSort.ts +++ b/src/api/types/TimecardSort.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Sets the sort order of search results. diff --git a/src/api/types/TimecardWage.ts b/src/api/types/TimecardWage.ts index 1a0a11148..ef5989cff 100644 --- a/src/api/types/TimecardWage.ts +++ b/src/api/types/TimecardWage.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The hourly wage rate used to compensate a team member for a [timecard](entity:Timecard). @@ -14,12 +14,12 @@ export interface TimecardWage { * 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; + hourly_rate?: Square.Money; /** * The ID of the [job](entity:Job) performed for this timecard. Square * labor-reporting UIs might group timecards together by ID. */ - jobId?: string; + job_id?: string; /** Whether team members are eligible for tips when working this job. */ - tipEligible?: boolean | null; + tip_eligible?: boolean | null; } diff --git a/src/api/types/TimecardWorkday.ts b/src/api/types/TimecardWorkday.ts index 260d01157..5b4cfac54 100644 --- a/src/api/types/TimecardWorkday.ts +++ b/src/api/types/TimecardWorkday.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A `Timecard` search query filter parameter that sets a range of days that @@ -10,17 +10,17 @@ import * as Square from "../index"; */ export interface TimecardWorkday { /** Dates for fetching the timecards. */ - dateRange?: Square.DateRange; + date_range?: Square.DateRange; /** * The strategy on which the dates are applied. * See [TimecardWorkdayMatcher](#type-timecardworkdaymatcher) for possible values */ - matchTimecardsBy?: Square.TimecardWorkdayMatcher; + match_timecards_by?: Square.TimecardWorkdayMatcher; /** * 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; + default_timezone?: string | null; } diff --git a/src/api/types/TipSettings.ts b/src/api/types/TipSettings.ts index 00b18e986..0c7ad678e 100644 --- a/src/api/types/TipSettings.ts +++ b/src/api/types/TipSettings.ts @@ -4,19 +4,19 @@ export interface TipSettings { /** Indicates whether tipping is enabled for this checkout. Defaults to false. */ - allowTipping?: boolean | null; + allow_tipping?: 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; + separate_tip_screen?: boolean | null; /** Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false. */ - customTipField?: boolean | null; + custom_tip_field?: 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; + tip_percentages?: number[] | null; /** * Enables the "Smart Tip Amounts" behavior. * Exact tipping options depend on the region in which the Square seller is active. @@ -30,5 +30,5 @@ export interface TipSettings { * * 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; + smart_tipping?: boolean | null; } diff --git a/src/api/types/Transaction.ts b/src/api/types/Transaction.ts index 50ccaf1a3..0404ec8e3 100644 --- a/src/api/types/Transaction.ts +++ b/src/api/types/Transaction.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a transaction processed with Square, either with the @@ -15,9 +15,9 @@ 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; + location_id?: string | null; /** The timestamp for when the transaction was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The tenders used to pay in the transaction. */ tenders?: Square.Tender[] | null; /** Refunds that have been applied to any tender in the transaction. */ @@ -27,7 +27,7 @@ export interface Transaction { * 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; + reference_id?: string | null; /** * The Square product that processed the transaction. * See [TransactionProduct](#type-transactionproduct) for possible values @@ -45,9 +45,9 @@ export interface Transaction { * It is not currently possible with the Connect API to perform a transaction * lookup by this value. */ - clientId?: string | null; + client_id?: string | null; /** The shipping address provided in the request, if any. */ - shippingAddress?: Square.Address; + shipping_address?: Square.Address; /** The order_id is an identifier for the order associated with this transaction, if any. */ - orderId?: string | null; + order_id?: string | null; } diff --git a/src/api/types/UnlinkCustomerFromGiftCardResponse.ts b/src/api/types/UnlinkCustomerFromGiftCardResponse.ts index f8dec48c7..224626f64 100644 --- a/src/api/types/UnlinkCustomerFromGiftCardResponse.ts +++ b/src/api/types/UnlinkCustomerFromGiftCardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response that contains the unlinked `GiftCard` object. If the request resulted in errors, @@ -15,5 +15,5 @@ export interface UnlinkCustomerFromGiftCardResponse { * 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; + gift_card?: Square.GiftCard; } diff --git a/src/api/types/UpdateBookingCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateBookingCustomAttributeDefinitionResponse.ts index 1313eb17f..a87823809 100644 --- a/src/api/types/UpdateBookingCustomAttributeDefinitionResponse.ts +++ b/src/api/types/UpdateBookingCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpdateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-UpdateBookingCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpdateBookingCustomAttributeDefinitionResponse { /** The updated custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 519c8dc71..ecdfaabe4 100644 --- a/src/api/types/UpdateBookingResponse.ts +++ b/src/api/types/UpdateBookingResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface UpdateBookingResponse { /** The booking that was updated. */ diff --git a/src/api/types/UpdateBreakTypeResponse.ts b/src/api/types/UpdateBreakTypeResponse.ts index 094813247..07919f7ea 100644 --- a/src/api/types/UpdateBreakTypeResponse.ts +++ b/src/api/types/UpdateBreakTypeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A response to a request to update a `BreakType`. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface UpdateBreakTypeResponse { /** The response object. */ - breakType?: Square.BreakType; + break_type?: 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 index 89b7091d7..65ffe2590 100644 --- a/src/api/types/UpdateCatalogImageRequest.ts +++ b/src/api/types/UpdateCatalogImageRequest.ts @@ -9,5 +9,5 @@ export interface UpdateCatalogImageRequest { * * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. */ - idempotencyKey: string; + idempotency_key: string; } diff --git a/src/api/types/UpdateCatalogImageResponse.ts b/src/api/types/UpdateCatalogImageResponse.ts index c574bcbf0..2cf5c2378 100644 --- a/src/api/types/UpdateCatalogImageResponse.ts +++ b/src/api/types/UpdateCatalogImageResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface UpdateCatalogImageResponse { /** Any errors that occurred during the request. */ diff --git a/src/api/types/UpdateCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateCustomerCustomAttributeDefinitionResponse.ts index b5760da5b..e29643592 100644 --- a/src/api/types/UpdateCustomerCustomAttributeDefinitionResponse.ts +++ b/src/api/types/UpdateCustomerCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpdateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-UpdateCustomerCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpdateCustomerCustomAttributeDefinitionResponse { /** The updated custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 913d8c6f4..3b1ab40f3 100644 --- a/src/api/types/UpdateCustomerGroupResponse.ts +++ b/src/api/types/UpdateCustomerGroupResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/UpdateCustomerResponse.ts b/src/api/types/UpdateCustomerResponse.ts index 7f949f940..09273572f 100644 --- a/src/api/types/UpdateCustomerResponse.ts +++ b/src/api/types/UpdateCustomerResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/UpdateInvoiceResponse.ts b/src/api/types/UpdateInvoiceResponse.ts index d6f79f3e3..359e1f668 100644 --- a/src/api/types/UpdateInvoiceResponse.ts +++ b/src/api/types/UpdateInvoiceResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Describes a `UpdateInvoice` response. diff --git a/src/api/types/UpdateItemModifierListsResponse.ts b/src/api/types/UpdateItemModifierListsResponse.ts index 0559418e8..571bd1bd4 100644 --- a/src/api/types/UpdateItemModifierListsResponse.ts +++ b/src/api/types/UpdateItemModifierListsResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + updated_at?: string; } diff --git a/src/api/types/UpdateItemTaxesResponse.ts b/src/api/types/UpdateItemTaxesResponse.ts index d0f11d28b..0e5fd05b4 100644 --- a/src/api/types/UpdateItemTaxesResponse.ts +++ b/src/api/types/UpdateItemTaxesResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; 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; + updated_at?: string; } diff --git a/src/api/types/UpdateJobResponse.ts b/src/api/types/UpdateJobResponse.ts index a07019f8e..5a0fcc4aa 100644 --- a/src/api/types/UpdateJobResponse.ts +++ b/src/api/types/UpdateJobResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpdateJob](api-endpoint:Team-UpdateJob) response. Either `job` or `errors` diff --git a/src/api/types/UpdateLocationCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateLocationCustomAttributeDefinitionResponse.ts index 0c649bc07..71a904b6f 100644 --- a/src/api/types/UpdateLocationCustomAttributeDefinitionResponse.ts +++ b/src/api/types/UpdateLocationCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpdateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-UpdateLocationCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpdateLocationCustomAttributeDefinitionResponse { /** The updated custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 25aede1c6..01a09070b 100644 --- a/src/api/types/UpdateLocationResponse.ts +++ b/src/api/types/UpdateLocationResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response object returned by the [UpdateLocation](api-endpoint:Locations-UpdateLocation) endpoint. diff --git a/src/api/types/UpdateLocationSettingsResponse.ts b/src/api/types/UpdateLocationSettingsResponse.ts index f6d4a37d2..a153c2f0b 100644 --- a/src/api/types/UpdateLocationSettingsResponse.ts +++ b/src/api/types/UpdateLocationSettingsResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface UpdateLocationSettingsResponse { /** Any errors that occurred when updating the location settings. */ errors?: Square.Error_[]; /** The updated location settings. */ - locationSettings?: Square.CheckoutLocationSettings; + location_settings?: Square.CheckoutLocationSettings; } diff --git a/src/api/types/UpdateMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateMerchantCustomAttributeDefinitionResponse.ts index c6f872588..a2d0aef62 100644 --- a/src/api/types/UpdateMerchantCustomAttributeDefinitionResponse.ts +++ b/src/api/types/UpdateMerchantCustomAttributeDefinitionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpdateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-UpdateMerchantCustomAttributeDefinition) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpdateMerchantCustomAttributeDefinitionResponse { /** The updated custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 51b94b7f1..5966d9662 100644 --- a/src/api/types/UpdateMerchantSettingsResponse.ts +++ b/src/api/types/UpdateMerchantSettingsResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface UpdateMerchantSettingsResponse { /** Any errors that occurred when updating the merchant settings. */ errors?: Square.Error_[]; /** The updated merchant settings. */ - merchantSettings?: Square.CheckoutMerchantSettings; + merchant_settings?: Square.CheckoutMerchantSettings; } diff --git a/src/api/types/UpdateOrderCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateOrderCustomAttributeDefinitionResponse.ts index 85b32051f..a7e47e20d 100644 --- a/src/api/types/UpdateOrderCustomAttributeDefinitionResponse.ts +++ b/src/api/types/UpdateOrderCustomAttributeDefinitionResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from updating an order custom attribute definition. */ export interface UpdateOrderCustomAttributeDefinitionResponse { /** The updated order custom attribute definition. */ - customAttributeDefinition?: Square.CustomAttributeDefinition; + custom_attribute_definition?: 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 index 50f3ff049..b21409069 100644 --- a/src/api/types/UpdateOrderResponse.ts +++ b/src/api/types/UpdateOrderResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/UpdatePaymentLinkResponse.ts b/src/api/types/UpdatePaymentLinkResponse.ts index 5db98657d..e82da07f0 100644 --- a/src/api/types/UpdatePaymentLinkResponse.ts +++ b/src/api/types/UpdatePaymentLinkResponse.ts @@ -2,11 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface UpdatePaymentLinkResponse { /** Any errors that occurred when updating the payment link. */ errors?: Square.Error_[]; /** The updated payment link. */ - paymentLink?: Square.PaymentLink; + payment_link?: Square.PaymentLink; } diff --git a/src/api/types/UpdatePaymentResponse.ts b/src/api/types/UpdatePaymentResponse.ts index 13c975379..702a5a022 100644 --- a/src/api/types/UpdatePaymentResponse.ts +++ b/src/api/types/UpdatePaymentResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the response returned by diff --git a/src/api/types/UpdateScheduledShiftResponse.ts b/src/api/types/UpdateScheduledShiftResponse.ts index eca29e68b..5c42322d5 100644 --- a/src/api/types/UpdateScheduledShiftResponse.ts +++ b/src/api/types/UpdateScheduledShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpdateScheduledShift](api-endpoint:Labor-UpdateScheduledShift) response. @@ -14,7 +14,7 @@ export interface UpdateScheduledShiftResponse { * [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or * [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts). */ - scheduledShift?: Square.ScheduledShift; + scheduled_shift?: Square.ScheduledShift; /** Any errors that occurred during the request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/UpdateShiftResponse.ts b/src/api/types/UpdateShiftResponse.ts index 0acfcc969..4cf9c4371 100644 --- a/src/api/types/UpdateShiftResponse.ts +++ b/src/api/types/UpdateShiftResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to update a `Shift`. The response contains diff --git a/src/api/types/UpdateSubscriptionResponse.ts b/src/api/types/UpdateSubscriptionResponse.ts index 134a6ac96..349b87134 100644 --- a/src/api/types/UpdateSubscriptionResponse.ts +++ b/src/api/types/UpdateSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines output parameters in a response from the diff --git a/src/api/types/UpdateTeamMemberRequest.ts b/src/api/types/UpdateTeamMemberRequest.ts index 4944b1cf6..feab73a77 100644 --- a/src/api/types/UpdateTeamMemberRequest.ts +++ b/src/api/types/UpdateTeamMemberRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an update request for a `TeamMember` object. @@ -13,5 +13,5 @@ export interface UpdateTeamMemberRequest { * `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; + team_member?: Square.TeamMember; } diff --git a/src/api/types/UpdateTeamMemberResponse.ts b/src/api/types/UpdateTeamMemberResponse.ts index 498af27a0..03a6e779b 100644 --- a/src/api/types/UpdateTeamMemberResponse.ts +++ b/src/api/types/UpdateTeamMemberResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * 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; + team_member?: Square.TeamMember; /** The errors that occurred during the request. */ errors?: Square.Error_[]; } diff --git a/src/api/types/UpdateTimecardResponse.ts b/src/api/types/UpdateTimecardResponse.ts index b7fc67224..be9633e4d 100644 --- a/src/api/types/UpdateTimecardResponse.ts +++ b/src/api/types/UpdateTimecardResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to update a `Timecard`. The response contains diff --git a/src/api/types/UpdateVendorRequest.ts b/src/api/types/UpdateVendorRequest.ts index dcb85e48b..700c613d9 100644 --- a/src/api/types/UpdateVendorRequest.ts +++ b/src/api/types/UpdateVendorRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an input to a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). @@ -16,7 +16,7 @@ export interface UpdateVendorRequest { * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more * information. */ - idempotencyKey?: string | null; + idempotency_key?: 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 index 644dbe1c5..db31f647a 100644 --- a/src/api/types/UpdateVendorResponse.ts +++ b/src/api/types/UpdateVendorResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an output from a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). diff --git a/src/api/types/UpdateWageSettingResponse.ts b/src/api/types/UpdateWageSettingResponse.ts index 62348f77e..c59af75c7 100644 --- a/src/api/types/UpdateWageSettingResponse.ts +++ b/src/api/types/UpdateWageSettingResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from an update request containing the updated `WageSetting` object @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpdateWageSettingResponse { /** The successfully updated `WageSetting` object. */ - wageSetting?: Square.WageSetting; + wage_setting?: 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 index c54292ac6..5e23f56b3 100644 --- a/src/api/types/UpdateWebhookSubscriptionResponse.ts +++ b/src/api/types/UpdateWebhookSubscriptionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts b/src/api/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts index 675854985..99a778d04 100644 --- a/src/api/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts +++ b/src/api/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of @@ -15,5 +15,5 @@ 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; + signature_key?: string; } diff --git a/src/api/types/UpdateWorkweekConfigResponse.ts b/src/api/types/UpdateWorkweekConfigResponse.ts index 20a17afca..9bdfc55a2 100644 --- a/src/api/types/UpdateWorkweekConfigResponse.ts +++ b/src/api/types/UpdateWorkweekConfigResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * The response to a request to update a `WorkweekConfig` object. The response contains @@ -11,7 +11,7 @@ import * as Square from "../index"; */ export interface UpdateWorkweekConfigResponse { /** The response object. */ - workweekConfig?: Square.WorkweekConfig; + workweek_config?: 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 index 8197bcbcb..ea9631b32 100644 --- a/src/api/types/UpsertBookingCustomAttributeResponse.ts +++ b/src/api/types/UpsertBookingCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpsertBookingCustomAttribute](api-endpoint:BookingCustomAttributes-UpsertBookingCustomAttribute) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpsertBookingCustomAttributeResponse { /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index 8fafabd00..cf11abf59 100644 --- a/src/api/types/UpsertCatalogObjectResponse.ts +++ b/src/api/types/UpsertCatalogObjectResponse.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface UpsertCatalogObjectResponse { /** Any errors that occurred during the request. */ errors?: Square.Error_[]; /** The successfully created or updated CatalogObject. */ - catalogObject?: Square.CatalogObject; + catalog_object?: Square.CatalogObject; /** The mapping between client and server IDs for this upsert. */ - idMappings?: Square.CatalogIdMapping[]; + id_mappings?: Square.CatalogIdMapping[]; } diff --git a/src/api/types/UpsertCustomerCustomAttributeResponse.ts b/src/api/types/UpsertCustomerCustomAttributeResponse.ts index 0f76c7631..843323da8 100644 --- a/src/api/types/UpsertCustomerCustomAttributeResponse.ts +++ b/src/api/types/UpsertCustomerCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpsertCustomerCustomAttributeResponse { /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index 131868814..16e19aaee 100644 --- a/src/api/types/UpsertLocationCustomAttributeResponse.ts +++ b/src/api/types/UpsertLocationCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpsertLocationCustomAttributeResponse { /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index 9dc89c1a8..85b80fb80 100644 --- a/src/api/types/UpsertMerchantCustomAttributeResponse.ts +++ b/src/api/types/UpsertMerchantCustomAttributeResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) response. @@ -10,7 +10,7 @@ import * as Square from "../index"; */ export interface UpsertMerchantCustomAttributeResponse { /** The new or updated custom attribute. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index b6e8e1664..30c2e15f6 100644 --- a/src/api/types/UpsertOrderCustomAttributeResponse.ts +++ b/src/api/types/UpsertOrderCustomAttributeResponse.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a response from upserting order custom attribute definitions. */ export interface UpsertOrderCustomAttributeResponse { /** The order custom attribute that was created or modified. */ - customAttribute?: Square.CustomAttribute; + custom_attribute?: 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 index 27e12d945..c9fc41e83 100644 --- a/src/api/types/UpsertSnippetResponse.ts +++ b/src/api/types/UpsertSnippetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`. diff --git a/src/api/types/V1Money.ts b/src/api/types/V1Money.ts index 3cdcdae09..c6d773cbb 100644 --- a/src/api/types/V1Money.ts +++ b/src/api/types/V1Money.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface V1Money { /** @@ -13,5 +13,5 @@ export interface V1Money { /** * See [Currency](#type-currency) for possible values */ - currencyCode?: Square.Currency; + currency_code?: Square.Currency; } diff --git a/src/api/types/V1Order.ts b/src/api/types/V1Order.ts index 106ac9982..71bc2026d 100644 --- a/src/api/types/V1Order.ts +++ b/src/api/types/V1Order.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * V1Order @@ -13,52 +13,52 @@ export interface V1Order { /** The order's unique identifier. */ id?: string; /** The email address of the order's buyer. */ - buyerEmail?: string | null; + buyer_email?: string | null; /** The name of the order's buyer. */ - recipientName?: string | null; + recipient_name?: string | null; /** The phone number to use for the order's delivery. */ - recipientPhoneNumber?: string | null; + recipient_phone_number?: 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; + shipping_address?: Square.Address; /** The amount of all items purchased in the order, before taxes and shipping. */ - subtotalMoney?: Square.V1Money; + subtotal_money?: Square.V1Money; /** The shipping cost for the order. */ - totalShippingMoney?: Square.V1Money; + total_shipping_money?: Square.V1Money; /** The total of all taxes applied to the order. */ - totalTaxMoney?: Square.V1Money; + total_tax_money?: Square.V1Money; /** The total cost of the order. */ - totalPriceMoney?: Square.V1Money; + total_price_money?: Square.V1Money; /** The total of all discounts applied to the order. */ - totalDiscountMoney?: Square.V1Money; + total_discount_money?: Square.V1Money; /** The time when the order was created, in ISO 8601 format. */ - createdAt?: string; + created_at?: string; /** The time when the order was last modified, in ISO 8601 format. */ - updatedAt?: string; + updated_at?: string; /** The time when the order expires if no action is taken, in ISO 8601 format. */ - expiresAt?: string | null; + expires_at?: string | null; /** The unique identifier of the payment associated with the order. */ - paymentId?: string | null; + payment_id?: string | null; /** A note provided by the buyer when the order was created, if any. */ - buyerNote?: string | null; + buyer_note?: string | null; /** A note provided by the merchant when the order's state was set to COMPLETED, if any */ - completedNote?: string | null; + completed_note?: string | null; /** A note provided by the merchant when the order's state was set to REFUNDED, if any. */ - refundedNote?: string | null; + refunded_note?: string | null; /** A note provided by the merchant when the order's state was set to CANCELED, if any. */ - canceledNote?: string | null; + canceled_note?: 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; + order_history?: Square.V1OrderHistoryEntry[] | null; /** The promo code provided by the buyer, if any. */ - promoCode?: string | null; + promo_code?: string | null; /** For Bitcoin transactions, the address that the buyer sent Bitcoin to. */ - btcReceiveAddress?: string | null; + btc_receive_address?: string | null; /** For Bitcoin transactions, the price of the buyer's order in satoshi (100 million satoshi equals 1 BTC). */ - btcPriceSatoshi?: number | null; + btc_price_satoshi?: number | null; } diff --git a/src/api/types/V1OrderHistoryEntry.ts b/src/api/types/V1OrderHistoryEntry.ts index 9781f5148..f922c5db5 100644 --- a/src/api/types/V1OrderHistoryEntry.ts +++ b/src/api/types/V1OrderHistoryEntry.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * V1OrderHistoryEntry @@ -14,5 +14,5 @@ export interface V1OrderHistoryEntry { */ action?: Square.V1OrderHistoryEntryAction; /** The time when the action was performed, in ISO 8601 format. */ - createdAt?: string; + created_at?: string; } diff --git a/src/api/types/V1Tender.ts b/src/api/types/V1Tender.ts index 95e244291..690c33a6d 100644 --- a/src/api/types/V1Tender.ts +++ b/src/api/types/V1Tender.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * A tender represents a discrete monetary exchange. Square represents this @@ -39,35 +39,35 @@ export interface V1Tender { /** A human-readable description of the tender. */ name?: string | null; /** The ID of the employee that processed the tender. */ - employeeId?: string | null; + employee_id?: string | null; /** The URL of the receipt for the tender. */ - receiptUrl?: string | null; + receipt_url?: string | null; /** * The brand of credit card provided. * See [V1TenderCardBrand](#type-v1tendercardbrand) for possible values */ - cardBrand?: Square.V1TenderCardBrand; + card_brand?: Square.V1TenderCardBrand; /** The last four digits of the provided credit card's account number. */ - panSuffix?: string | null; + pan_suffix?: string | null; /** * The tender's unique ID. * See [V1TenderEntryMethod](#type-v1tenderentrymethod) for possible values */ - entryMethod?: Square.V1TenderEntryMethod; + entry_method?: 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; + payment_note?: string | null; /** The total amount of money provided in this form of tender. */ - totalMoney?: Square.V1Money; + total_money?: Square.V1Money; /** The amount of total_money applied to the payment. */ - tenderedMoney?: Square.V1Money; + tendered_money?: Square.V1Money; /** The time when the tender was created, in ISO 8601 format. */ - tenderedAt?: string | null; + tendered_at?: string | null; /** The time when the tender was settled, in ISO 8601 format. */ - settledAt?: string | null; + settled_at?: string | null; /** The amount of total_money returned to the buyer as change. */ - changeBackMoney?: Square.V1Money; + change_back_money?: Square.V1Money; /** The total of all refunds applied to this tender. This amount is always negative or zero. */ - refundedMoney?: Square.V1Money; + refunded_money?: 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; + is_exchange?: boolean | null; } diff --git a/src/api/types/Vendor.ts b/src/api/types/Vendor.ts index b8b908a2a..56c7e44ba 100644 --- a/src/api/types/Vendor.ts +++ b/src/api/types/Vendor.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents a supplier to a seller. @@ -17,12 +17,12 @@ export interface Vendor { * An RFC 3339-formatted timestamp that indicates when the * [Vendor](entity:Vendor) was created. */ - createdAt?: string; + created_at?: string; /** * An RFC 3339-formatted timestamp that indicates when the * [Vendor](entity:Vendor) was last updated. */ - updatedAt?: string; + updated_at?: string; /** * The name of the [Vendor](entity:Vendor). * This field is required when attempting to create or update a [Vendor](entity:Vendor). @@ -33,7 +33,7 @@ export interface Vendor { /** The contacts of the [Vendor](entity:Vendor). */ contacts?: Square.VendorContact[] | null; /** The account number of the [Vendor](entity:Vendor). */ - accountNumber?: string | null; + account_number?: string | null; /** A note detailing information about the [Vendor](entity:Vendor). */ note?: string | null; /** The version of the [Vendor](entity:Vendor). */ diff --git a/src/api/types/VendorContact.ts b/src/api/types/VendorContact.ts index e965078c5..11284520a 100644 --- a/src/api/types/VendorContact.ts +++ b/src/api/types/VendorContact.ts @@ -17,9 +17,9 @@ export interface VendorContact { */ name?: string | null; /** The email address of the [VendorContact](entity:VendorContact). */ - emailAddress?: string | null; + email_address?: string | null; /** The phone number of the [VendorContact](entity:VendorContact). */ - phoneNumber?: string | null; + phone_number?: string | null; /** The state of the [VendorContact](entity:VendorContact). */ removed?: boolean | null; /** The ordinal of the [VendorContact](entity:VendorContact). */ diff --git a/src/api/types/VendorCreatedEvent.ts b/src/api/types/VendorCreatedEvent.ts index 640126d7b..f0e4579e2 100644 --- a/src/api/types/VendorCreatedEvent.ts +++ b/src/api/types/VendorCreatedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Vendor](entity:Vendor) is created. */ export interface VendorCreatedEvent { /** The ID of a seller associated with this event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of a location associated with the event, if the event is associated with the location of the seller. */ - locationId?: string | null; + location_id?: string | null; /** The type of this event. The value is `"vendor.created".` */ type?: string | null; /** A unique ID for this event. */ - eventId?: string | null; + event_id?: string | null; /** The RFC 3339-formatted time when the underlying event data object is created. */ - createdAt?: string; + created_at?: string; /** The data associated with this event. */ data?: Square.VendorCreatedEventData; } diff --git a/src/api/types/VendorCreatedEventData.ts b/src/api/types/VendorCreatedEventData.ts index da0989ecc..fc81871fb 100644 --- a/src/api/types/VendorCreatedEventData.ts +++ b/src/api/types/VendorCreatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the `vendor.created` event data structure. diff --git a/src/api/types/VendorCreatedEventObject.ts b/src/api/types/VendorCreatedEventObject.ts index 67c918471..4659c1183 100644 --- a/src/api/types/VendorCreatedEventObject.ts +++ b/src/api/types/VendorCreatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface VendorCreatedEventObject { /** diff --git a/src/api/types/VendorUpdatedEvent.ts b/src/api/types/VendorUpdatedEvent.ts index 1afc531b4..715c69b5f 100644 --- a/src/api/types/VendorUpdatedEvent.ts +++ b/src/api/types/VendorUpdatedEvent.ts @@ -2,22 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Published when a [Vendor](entity:Vendor) is updated. */ export interface VendorUpdatedEvent { /** The ID of a seller associated with this event. */ - merchantId?: string | null; + merchant_id?: string | null; /** The ID of a seller location associated with this event, if the event is associated with the location. */ - locationId?: string | null; + location_id?: string | null; /** The type of this event. The value is `"vendor.updated".` */ type?: string | null; /** A unique ID for this webhoook event. */ - eventId?: string | null; + event_id?: string | null; /** The RFC 3339-formatted time when the underlying event data object is created. */ - createdAt?: string; + created_at?: string; /** The data associated with this event. */ data?: Square.VendorUpdatedEventData; } diff --git a/src/api/types/VendorUpdatedEventData.ts b/src/api/types/VendorUpdatedEventData.ts index fd4562112..13bb07a24 100644 --- a/src/api/types/VendorUpdatedEventData.ts +++ b/src/api/types/VendorUpdatedEventData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the `vendor.updated` event data structure. diff --git a/src/api/types/VendorUpdatedEventObject.ts b/src/api/types/VendorUpdatedEventObject.ts index 21f421374..82dca564b 100644 --- a/src/api/types/VendorUpdatedEventObject.ts +++ b/src/api/types/VendorUpdatedEventObject.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; export interface VendorUpdatedEventObject { /** diff --git a/src/api/types/VoidTransactionResponse.ts b/src/api/types/VoidTransactionResponse.ts index ad3847dbb..0c4763d02 100644 --- a/src/api/types/VoidTransactionResponse.ts +++ b/src/api/types/VoidTransactionResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Defines the fields that are included in the response body of diff --git a/src/api/types/WageSetting.ts b/src/api/types/WageSetting.ts index eb4401a99..54a8026f8 100644 --- a/src/api/types/WageSetting.ts +++ b/src/api/types/WageSetting.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Represents information about the overtime exemption status, job assignments, and compensation @@ -10,14 +10,14 @@ import * as Square from "../index"; */ export interface WageSetting { /** The ID of the team member associated with the wage setting. */ - teamMemberId?: string | null; + team_member_id?: 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; + job_assignments?: Square.JobAssignment[] | null; /** Whether the team member is exempt from the overtime rules of the seller's country. */ - isOvertimeExempt?: boolean | null; + is_overtime_exempt?: 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, @@ -26,7 +26,7 @@ export interface WageSetting { */ version?: number; /** The timestamp when the wage setting was created, in RFC 3339 format. */ - createdAt?: string; + created_at?: string; /** The timestamp when the wage setting was last updated, in RFC 3339 format. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/WebhookSubscription.ts b/src/api/types/WebhookSubscription.ts index 5691d95e2..b44694cd5 100644 --- a/src/api/types/WebhookSubscription.ts +++ b/src/api/types/WebhookSubscription.ts @@ -14,22 +14,22 @@ export interface WebhookSubscription { /** Indicates whether the subscription is enabled (`true`) or not (`false`). */ enabled?: boolean | null; /** The event types associated with this subscription. */ - eventTypes?: string[] | null; + event_types?: string[] | null; /** The URL to which webhooks are sent. */ - notificationUrl?: string | null; + notification_url?: 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; + api_version?: string | null; /** The Square-generated signature key used to validate the origin of the webhook event. */ - signatureKey?: string; + signature_key?: string; /** The timestamp of when the subscription was created, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". */ - createdAt?: string; + created_at?: string; /** * The timestamp of when the subscription was last updated, in RFC 3339 format. * For example, "2016-09-04T23:59:33.123Z". */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/WorkweekConfig.ts b/src/api/types/WorkweekConfig.ts index 5d26dd907..5628fcd7d 100644 --- a/src/api/types/WorkweekConfig.ts +++ b/src/api/types/WorkweekConfig.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Square from "../index"; +import * as Square from "../index.js"; /** * Sets the day of the week and hour of the day that a business starts a @@ -16,13 +16,13 @@ export interface WorkweekConfig { * compensation purposes. * See [Weekday](#type-weekday) for possible values */ - startOfWeek: Square.Weekday; + start_of_week: 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; + start_of_day_local_time: 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, @@ -31,7 +31,7 @@ export interface WorkweekConfig { */ version?: number; /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - createdAt?: string; + created_at?: string; /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - updatedAt?: string; + updated_at?: string; } diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 58eb9f815..f7c739c62 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,1310 +1,1310 @@ -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 "./BankAccountCreatedEvent"; -export * from "./BankAccountCreatedEventData"; -export * from "./BankAccountCreatedEventObject"; -export * from "./BankAccountDisabledEvent"; -export * from "./BankAccountDisabledEventData"; -export * from "./BankAccountDisabledEventObject"; -export * from "./BankAccountPaymentDetails"; -export * from "./BankAccountStatus"; -export * from "./BankAccountType"; -export * from "./BankAccountVerifiedEvent"; -export * from "./BankAccountVerifiedEventData"; -export * from "./BankAccountVerifiedEventObject"; -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 "./BookingCreatedEvent"; -export * from "./BookingCreatedEventData"; -export * from "./BookingCreatedEventObject"; -export * from "./BookingCreatorDetails"; -export * from "./BookingCreatorDetailsCreatorType"; -export * from "./BookingCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./BookingCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./BookingCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./BookingCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./BookingCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./BookingCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./BookingCustomAttributeDeleteRequest"; -export * from "./BookingCustomAttributeDeleteResponse"; -export * from "./BookingCustomAttributeOwnedDeletedEvent"; -export * from "./BookingCustomAttributeOwnedUpdatedEvent"; -export * from "./BookingCustomAttributeUpsertRequest"; -export * from "./BookingCustomAttributeUpsertResponse"; -export * from "./BookingCustomAttributeVisibleDeletedEvent"; -export * from "./BookingCustomAttributeVisibleUpdatedEvent"; -export * from "./BookingStatus"; -export * from "./BookingUpdatedEvent"; -export * from "./BookingUpdatedEventData"; -export * from "./BookingUpdatedEventObject"; -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 "./BulkPublishScheduledShiftsData"; -export * from "./BulkPublishScheduledShiftsResponse"; -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 "./CardAutomaticallyUpdatedEvent"; -export * from "./CardAutomaticallyUpdatedEventData"; -export * from "./CardAutomaticallyUpdatedEventObject"; -export * from "./CardBrand"; -export * from "./CardCoBrand"; -export * from "./CardCreatedEvent"; -export * from "./CardCreatedEventData"; -export * from "./CardCreatedEventObject"; -export * from "./CardDisabledEvent"; -export * from "./CardDisabledEventData"; -export * from "./CardDisabledEventObject"; -export * from "./CardForgottenEvent"; -export * from "./CardForgottenEventCard"; -export * from "./CardForgottenEventData"; -export * from "./CardForgottenEventObject"; -export * from "./CardIssuerAlert"; -export * from "./CardPaymentDetails"; -export * from "./CardPaymentTimeline"; -export * from "./CardPrepaidType"; -export * from "./CardType"; -export * from "./CardUpdatedEvent"; -export * from "./CardUpdatedEventData"; -export * from "./CardUpdatedEventObject"; -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 "./CatalogAvailabilityPeriod"; -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 "./CatalogSubscriptionPlanVariation"; -export * from "./CatalogTax"; -export * from "./CatalogTimePeriod"; -export * from "./CatalogV1Id"; -export * from "./CatalogVersionUpdatedEvent"; -export * from "./CatalogVersionUpdatedEventCatalogVersion"; -export * from "./CatalogVersionUpdatedEventData"; -export * from "./CatalogVersionUpdatedEventObject"; -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 "./CreateInvoiceAttachmentRequestData"; -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 "./CreateScheduledShiftResponse"; -export * from "./CreateShiftResponse"; -export * from "./CreateSubscriptionResponse"; -export * from "./CreateTeamMemberRequest"; -export * from "./CreateTeamMemberResponse"; -export * from "./CreateTerminalActionResponse"; -export * from "./CreateTerminalCheckoutResponse"; -export * from "./CreateTerminalRefundResponse"; -export * from "./CreateTimecardResponse"; -export * from "./CreateVendorResponse"; -export * from "./CreateWebhookSubscriptionResponse"; -export * from "./Currency"; -export * from "./CustomAttribute"; -export * from "./CustomAttributeDefinition"; -export * from "./CustomAttributeDefinitionEventData"; -export * from "./CustomAttributeDefinitionEventDataObject"; -export * from "./CustomAttributeDefinitionVisibility"; -export * from "./CustomAttributeEventData"; -export * from "./CustomAttributeEventDataObject"; -export * from "./CustomAttributeFilter"; -export * from "./CustomField"; -export * from "./Customer"; -export * from "./CustomerAddressFilter"; -export * from "./CustomerCreatedEvent"; -export * from "./CustomerCreatedEventData"; -export * from "./CustomerCreatedEventEventContext"; -export * from "./CustomerCreatedEventEventContextMerge"; -export * from "./CustomerCreatedEventObject"; -export * from "./CustomerCreationSource"; -export * from "./CustomerCreationSourceFilter"; -export * from "./CustomerCustomAttributeDefinitionCreatedEvent"; -export * from "./CustomerCustomAttributeDefinitionCreatedPublicEvent"; -export * from "./CustomerCustomAttributeDefinitionDeletedEvent"; -export * from "./CustomerCustomAttributeDefinitionDeletedPublicEvent"; -export * from "./CustomerCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./CustomerCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./CustomerCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./CustomerCustomAttributeDefinitionUpdatedEvent"; -export * from "./CustomerCustomAttributeDefinitionUpdatedPublicEvent"; -export * from "./CustomerCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./CustomerCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./CustomerCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./CustomerCustomAttributeDeletedEvent"; -export * from "./CustomerCustomAttributeDeletedPublicEvent"; -export * from "./CustomerCustomAttributeFilter"; -export * from "./CustomerCustomAttributeFilterValue"; -export * from "./CustomerCustomAttributeFilters"; -export * from "./CustomerCustomAttributeOwnedDeletedEvent"; -export * from "./CustomerCustomAttributeOwnedUpdatedEvent"; -export * from "./CustomerCustomAttributeUpdatedEvent"; -export * from "./CustomerCustomAttributeUpdatedPublicEvent"; -export * from "./CustomerCustomAttributeVisibleDeletedEvent"; -export * from "./CustomerCustomAttributeVisibleUpdatedEvent"; -export * from "./CustomerDeletedEvent"; -export * from "./CustomerDeletedEventData"; -export * from "./CustomerDeletedEventEventContext"; -export * from "./CustomerDeletedEventEventContextMerge"; -export * from "./CustomerDeletedEventObject"; -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 "./CustomerUpdatedEvent"; -export * from "./CustomerUpdatedEventData"; -export * from "./CustomerUpdatedEventObject"; -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 "./DeleteTimecardResponse"; -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 "./DeviceCodePairedEvent"; -export * from "./DeviceCodePairedEventData"; -export * from "./DeviceCodePairedEventObject"; -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 "./DeviceCreatedEvent"; -export * from "./DeviceCreatedEventData"; -export * from "./DeviceCreatedEventObject"; -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 "./DisputeCreatedEvent"; -export * from "./DisputeCreatedEventData"; -export * from "./DisputeCreatedEventObject"; -export * from "./DisputeEvidence"; -export * from "./DisputeEvidenceAddedEvent"; -export * from "./DisputeEvidenceAddedEventData"; -export * from "./DisputeEvidenceAddedEventObject"; -export * from "./DisputeEvidenceCreatedEvent"; -export * from "./DisputeEvidenceCreatedEventData"; -export * from "./DisputeEvidenceCreatedEventObject"; -export * from "./DisputeEvidenceDeletedEvent"; -export * from "./DisputeEvidenceDeletedEventData"; -export * from "./DisputeEvidenceDeletedEventObject"; -export * from "./DisputeEvidenceFile"; -export * from "./DisputeEvidenceRemovedEvent"; -export * from "./DisputeEvidenceRemovedEventData"; -export * from "./DisputeEvidenceRemovedEventObject"; -export * from "./DisputeEvidenceType"; -export * from "./DisputeReason"; -export * from "./DisputeState"; -export * from "./DisputeStateChangedEvent"; -export * from "./DisputeStateChangedEventData"; -export * from "./DisputeStateChangedEventObject"; -export * from "./DisputeStateUpdatedEvent"; -export * from "./DisputeStateUpdatedEventData"; -export * from "./DisputeStateUpdatedEventObject"; -export * from "./DisputedPayment"; -export * from "./EcomVisibility"; -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 "./GiftCardActivityCreatedEvent"; -export * from "./GiftCardActivityCreatedEventData"; -export * from "./GiftCardActivityCreatedEventObject"; -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 "./GiftCardActivityUpdatedEvent"; -export * from "./GiftCardActivityUpdatedEventData"; -export * from "./GiftCardActivityUpdatedEventObject"; -export * from "./GiftCardCreatedEvent"; -export * from "./GiftCardCreatedEventData"; -export * from "./GiftCardCreatedEventObject"; -export * from "./GiftCardCustomerLinkedEvent"; -export * from "./GiftCardCustomerLinkedEventData"; -export * from "./GiftCardCustomerLinkedEventObject"; -export * from "./GiftCardCustomerUnlinkedEvent"; -export * from "./GiftCardCustomerUnlinkedEventData"; -export * from "./GiftCardCustomerUnlinkedEventObject"; -export * from "./GiftCardGanSource"; -export * from "./GiftCardStatus"; -export * from "./GiftCardType"; -export * from "./GiftCardUpdatedEvent"; -export * from "./GiftCardUpdatedEventData"; -export * from "./GiftCardUpdatedEventObject"; -export * from "./InventoryAdjustment"; -export * from "./InventoryAdjustmentGroup"; -export * from "./InventoryAlertType"; -export * from "./InventoryChange"; -export * from "./InventoryChangeType"; -export * from "./InventoryCount"; -export * from "./InventoryCountUpdatedEvent"; -export * from "./InventoryCountUpdatedEventData"; -export * from "./InventoryCountUpdatedEventObject"; -export * from "./InventoryPhysicalCount"; -export * from "./InventoryState"; -export * from "./InventoryTransfer"; -export * from "./Invoice"; -export * from "./InvoiceAcceptedPaymentMethods"; -export * from "./InvoiceAttachment"; -export * from "./InvoiceAutomaticPaymentSource"; -export * from "./InvoiceCanceledEvent"; -export * from "./InvoiceCanceledEventData"; -export * from "./InvoiceCanceledEventObject"; -export * from "./InvoiceCreatedEvent"; -export * from "./InvoiceCreatedEventData"; -export * from "./InvoiceCreatedEventObject"; -export * from "./InvoiceCustomField"; -export * from "./InvoiceCustomFieldPlacement"; -export * from "./InvoiceDeletedEvent"; -export * from "./InvoiceDeletedEventData"; -export * from "./InvoiceDeliveryMethod"; -export * from "./InvoiceFilter"; -export * from "./InvoicePaymentMadeEvent"; -export * from "./InvoicePaymentMadeEventData"; -export * from "./InvoicePaymentMadeEventObject"; -export * from "./InvoicePaymentReminder"; -export * from "./InvoicePaymentReminderStatus"; -export * from "./InvoicePaymentRequest"; -export * from "./InvoicePublishedEvent"; -export * from "./InvoicePublishedEventData"; -export * from "./InvoicePublishedEventObject"; -export * from "./InvoiceQuery"; -export * from "./InvoiceRecipient"; -export * from "./InvoiceRecipientTaxIds"; -export * from "./InvoiceRefundedEvent"; -export * from "./InvoiceRefundedEventData"; -export * from "./InvoiceRefundedEventObject"; -export * from "./InvoiceRequestMethod"; -export * from "./InvoiceRequestType"; -export * from "./InvoiceScheduledChargeFailedEvent"; -export * from "./InvoiceScheduledChargeFailedEventData"; -export * from "./InvoiceScheduledChargeFailedEventObject"; -export * from "./InvoiceSort"; -export * from "./InvoiceSortField"; -export * from "./InvoiceStatus"; -export * from "./InvoiceUpdatedEvent"; -export * from "./InvoiceUpdatedEventData"; -export * from "./InvoiceUpdatedEventObject"; -export * from "./ItemVariationLocationOverrides"; -export * from "./Job"; -export * from "./JobAssignment"; -export * from "./JobAssignmentPayType"; -export * from "./JobCreatedEvent"; -export * from "./JobCreatedEventData"; -export * from "./JobCreatedEventObject"; -export * from "./JobUpdatedEvent"; -export * from "./JobUpdatedEventData"; -export * from "./JobUpdatedEventObject"; -export * from "./LaborScheduledShiftCreatedEvent"; -export * from "./LaborScheduledShiftCreatedEventData"; -export * from "./LaborScheduledShiftCreatedEventObject"; -export * from "./LaborScheduledShiftDeletedEvent"; -export * from "./LaborScheduledShiftDeletedEventData"; -export * from "./LaborScheduledShiftPublishedEvent"; -export * from "./LaborScheduledShiftPublishedEventData"; -export * from "./LaborScheduledShiftPublishedEventObject"; -export * from "./LaborScheduledShiftUpdatedEvent"; -export * from "./LaborScheduledShiftUpdatedEventData"; -export * from "./LaborScheduledShiftUpdatedEventObject"; -export * from "./LaborShiftCreatedEvent"; -export * from "./LaborShiftCreatedEventData"; -export * from "./LaborShiftCreatedEventObject"; -export * from "./LaborShiftDeletedEvent"; -export * from "./LaborShiftDeletedEventData"; -export * from "./LaborShiftUpdatedEvent"; -export * from "./LaborShiftUpdatedEventData"; -export * from "./LaborShiftUpdatedEventObject"; -export * from "./LaborTimecardCreatedEvent"; -export * from "./LaborTimecardCreatedEventData"; -export * from "./LaborTimecardCreatedEventObject"; -export * from "./LaborTimecardDeletedEvent"; -export * from "./LaborTimecardDeletedEventData"; -export * from "./LaborTimecardUpdatedEvent"; -export * from "./LaborTimecardUpdatedEventData"; -export * from "./LaborTimecardUpdatedEventObject"; -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 "./ListPaymentRefundsRequestSortField"; -export * from "./ListPaymentRefundsResponse"; -export * from "./ListPaymentsRequestSortField"; -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 "./LocationCreatedEvent"; -export * from "./LocationCreatedEventData"; -export * from "./LocationCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./LocationCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./LocationCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./LocationCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./LocationCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./LocationCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./LocationCustomAttributeOwnedDeletedEvent"; -export * from "./LocationCustomAttributeOwnedUpdatedEvent"; -export * from "./LocationCustomAttributeVisibleDeletedEvent"; -export * from "./LocationCustomAttributeVisibleUpdatedEvent"; -export * from "./LocationSettingsUpdatedEvent"; -export * from "./LocationSettingsUpdatedEventData"; -export * from "./LocationSettingsUpdatedEventObject"; -export * from "./LocationStatus"; -export * from "./LocationType"; -export * from "./LocationUpdatedEvent"; -export * from "./LocationUpdatedEventData"; -export * from "./LoyaltyAccount"; -export * from "./LoyaltyAccountCreatedEvent"; -export * from "./LoyaltyAccountCreatedEventData"; -export * from "./LoyaltyAccountCreatedEventObject"; -export * from "./LoyaltyAccountDeletedEvent"; -export * from "./LoyaltyAccountDeletedEventData"; -export * from "./LoyaltyAccountDeletedEventObject"; -export * from "./LoyaltyAccountExpiringPointDeadline"; -export * from "./LoyaltyAccountMapping"; -export * from "./LoyaltyAccountMappingType"; -export * from "./LoyaltyAccountUpdatedEvent"; -export * from "./LoyaltyAccountUpdatedEventData"; -export * from "./LoyaltyAccountUpdatedEventObject"; -export * from "./LoyaltyEvent"; -export * from "./LoyaltyEventAccumulatePoints"; -export * from "./LoyaltyEventAccumulatePromotionPoints"; -export * from "./LoyaltyEventAdjustPoints"; -export * from "./LoyaltyEventCreateReward"; -export * from "./LoyaltyEventCreatedEvent"; -export * from "./LoyaltyEventCreatedEventData"; -export * from "./LoyaltyEventCreatedEventObject"; -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 "./LoyaltyProgramCreatedEvent"; -export * from "./LoyaltyProgramCreatedEventData"; -export * from "./LoyaltyProgramCreatedEventObject"; -export * from "./LoyaltyProgramExpirationPolicy"; -export * from "./LoyaltyProgramRewardTier"; -export * from "./LoyaltyProgramStatus"; -export * from "./LoyaltyProgramTerminology"; -export * from "./LoyaltyProgramUpdatedEvent"; -export * from "./LoyaltyProgramUpdatedEventData"; -export * from "./LoyaltyProgramUpdatedEventObject"; -export * from "./LoyaltyPromotion"; -export * from "./LoyaltyPromotionAvailableTimeData"; -export * from "./LoyaltyPromotionCreatedEvent"; -export * from "./LoyaltyPromotionCreatedEventData"; -export * from "./LoyaltyPromotionCreatedEventObject"; -export * from "./LoyaltyPromotionIncentive"; -export * from "./LoyaltyPromotionIncentivePointsAdditionData"; -export * from "./LoyaltyPromotionIncentivePointsMultiplierData"; -export * from "./LoyaltyPromotionIncentiveType"; -export * from "./LoyaltyPromotionStatus"; -export * from "./LoyaltyPromotionTriggerLimit"; -export * from "./LoyaltyPromotionTriggerLimitInterval"; -export * from "./LoyaltyPromotionUpdatedEvent"; -export * from "./LoyaltyPromotionUpdatedEventData"; -export * from "./LoyaltyPromotionUpdatedEventObject"; -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 "./MerchantCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./MerchantCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./MerchantCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./MerchantCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./MerchantCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./MerchantCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./MerchantCustomAttributeOwnedDeletedEvent"; -export * from "./MerchantCustomAttributeOwnedUpdatedEvent"; -export * from "./MerchantCustomAttributeVisibleDeletedEvent"; -export * from "./MerchantCustomAttributeVisibleUpdatedEvent"; -export * from "./MerchantSettingsUpdatedEvent"; -export * from "./MerchantSettingsUpdatedEventData"; -export * from "./MerchantSettingsUpdatedEventObject"; -export * from "./MerchantStatus"; -export * from "./ModifierLocationOverrides"; -export * from "./Money"; -export * from "./OauthAuthorizationRevokedEvent"; -export * from "./OauthAuthorizationRevokedEventData"; -export * from "./OauthAuthorizationRevokedEventObject"; -export * from "./OauthAuthorizationRevokedEventRevocationObject"; -export * from "./OauthAuthorizationRevokedEventRevokerType"; -export * from "./ObtainTokenResponse"; -export * from "./OfflinePaymentDetails"; -export * from "./Order"; -export * from "./OrderCreated"; -export * from "./OrderCreatedEvent"; -export * from "./OrderCreatedEventData"; -export * from "./OrderCreatedObject"; -export * from "./OrderCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./OrderCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./OrderCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./OrderCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./OrderCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./OrderCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./OrderCustomAttributeOwnedDeletedEvent"; -export * from "./OrderCustomAttributeOwnedUpdatedEvent"; -export * from "./OrderCustomAttributeVisibleDeletedEvent"; -export * from "./OrderCustomAttributeVisibleUpdatedEvent"; -export * from "./OrderEntry"; -export * from "./OrderFulfillmentDeliveryDetailsScheduleType"; -export * from "./OrderFulfillmentFulfillmentLineItemApplication"; -export * from "./OrderFulfillmentPickupDetailsScheduleType"; -export * from "./OrderFulfillmentState"; -export * from "./OrderFulfillmentType"; -export * from "./OrderFulfillmentUpdated"; -export * from "./OrderFulfillmentUpdatedEvent"; -export * from "./OrderFulfillmentUpdatedEventData"; -export * from "./OrderFulfillmentUpdatedObject"; -export * from "./OrderFulfillmentUpdatedUpdate"; -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 "./OrderUpdated"; -export * from "./OrderUpdatedEvent"; -export * from "./OrderUpdatedEventData"; -export * from "./OrderUpdatedObject"; -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 "./PaymentCreatedEvent"; -export * from "./PaymentCreatedEventData"; -export * from "./PaymentCreatedEventObject"; -export * from "./PaymentLink"; -export * from "./PaymentLinkRelatedResources"; -export * from "./PaymentOptions"; -export * from "./PaymentOptionsDelayAction"; -export * from "./PaymentRefund"; -export * from "./PaymentUpdatedEvent"; -export * from "./PaymentUpdatedEventData"; -export * from "./PaymentUpdatedEventObject"; -export * from "./Payout"; -export * from "./PayoutEntry"; -export * from "./PayoutFailedEvent"; -export * from "./PayoutFailedEventData"; -export * from "./PayoutFailedEventObject"; -export * from "./PayoutFee"; -export * from "./PayoutFeeType"; -export * from "./PayoutPaidEvent"; -export * from "./PayoutPaidEventData"; -export * from "./PayoutPaidEventObject"; -export * from "./PayoutSentEvent"; -export * from "./PayoutSentEventData"; -export * from "./PayoutSentEventObject"; -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 "./PublishScheduledShiftResponse"; -export * from "./QrCodeOptions"; -export * from "./QuickPay"; -export * from "./Range"; -export * from "./ReceiptOptions"; -export * from "./RedeemLoyaltyRewardResponse"; -export * from "./Refund"; -export * from "./RefundCreatedEvent"; -export * from "./RefundCreatedEventData"; -export * from "./RefundCreatedEventObject"; -export * from "./RefundPaymentResponse"; -export * from "./RefundStatus"; -export * from "./RefundUpdatedEvent"; -export * from "./RefundUpdatedEventData"; -export * from "./RefundUpdatedEventObject"; -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 "./RetrieveScheduledShiftResponse"; -export * from "./GetSnippetResponse"; -export * from "./GetSubscriptionResponse"; -export * from "./GetTeamMemberBookingProfileResponse"; -export * from "./GetTeamMemberResponse"; -export * from "./RetrieveTimecardResponse"; -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 "./ScheduledShift"; -export * from "./ScheduledShiftDetails"; -export * from "./ScheduledShiftFilter"; -export * from "./ScheduledShiftFilterAssignmentStatus"; -export * from "./ScheduledShiftFilterScheduledShiftStatus"; -export * from "./ScheduledShiftNotificationAudience"; -export * from "./ScheduledShiftQuery"; -export * from "./ScheduledShiftSort"; -export * from "./ScheduledShiftSortField"; -export * from "./ScheduledShiftWorkday"; -export * from "./ScheduledShiftWorkdayMatcher"; -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 "./SearchScheduledShiftsResponse"; -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 "./SearchTimecardsResponse"; -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 "./SubscriptionCreatedEvent"; -export * from "./SubscriptionCreatedEventData"; -export * from "./SubscriptionCreatedEventObject"; -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 "./SubscriptionUpdatedEvent"; -export * from "./SubscriptionUpdatedEventData"; -export * from "./SubscriptionUpdatedEventObject"; -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 "./TeamMemberCreatedEvent"; -export * from "./TeamMemberCreatedEventData"; -export * from "./TeamMemberCreatedEventObject"; -export * from "./TeamMemberInvitationStatus"; -export * from "./TeamMemberStatus"; -export * from "./TeamMemberUpdatedEvent"; -export * from "./TeamMemberUpdatedEventData"; -export * from "./TeamMemberUpdatedEventObject"; -export * from "./TeamMemberWage"; -export * from "./TeamMemberWageSettingUpdatedEvent"; -export * from "./TeamMemberWageSettingUpdatedEventData"; -export * from "./TeamMemberWageSettingUpdatedEventObject"; -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 "./TerminalActionCreatedEvent"; -export * from "./TerminalActionCreatedEventData"; -export * from "./TerminalActionCreatedEventObject"; -export * from "./TerminalActionQuery"; -export * from "./TerminalActionQueryFilter"; -export * from "./TerminalActionQuerySort"; -export * from "./TerminalActionUpdatedEvent"; -export * from "./TerminalActionUpdatedEventData"; -export * from "./TerminalActionUpdatedEventObject"; -export * from "./TerminalCheckout"; -export * from "./TerminalCheckoutCreatedEvent"; -export * from "./TerminalCheckoutCreatedEventData"; -export * from "./TerminalCheckoutCreatedEventObject"; -export * from "./TerminalCheckoutQuery"; -export * from "./TerminalCheckoutQueryFilter"; -export * from "./TerminalCheckoutQuerySort"; -export * from "./TerminalCheckoutUpdatedEvent"; -export * from "./TerminalCheckoutUpdatedEventData"; -export * from "./TerminalCheckoutUpdatedEventObject"; -export * from "./TerminalRefund"; -export * from "./TerminalRefundCreatedEvent"; -export * from "./TerminalRefundCreatedEventData"; -export * from "./TerminalRefundCreatedEventObject"; -export * from "./TerminalRefundQuery"; -export * from "./TerminalRefundQueryFilter"; -export * from "./TerminalRefundQuerySort"; -export * from "./TerminalRefundUpdatedEvent"; -export * from "./TerminalRefundUpdatedEventData"; -export * from "./TerminalRefundUpdatedEventObject"; -export * from "./TestWebhookSubscriptionResponse"; -export * from "./TimeRange"; -export * from "./Timecard"; -export * from "./TimecardFilter"; -export * from "./TimecardFilterStatus"; -export * from "./TimecardQuery"; -export * from "./TimecardSort"; -export * from "./TimecardSortField"; -export * from "./TimecardStatus"; -export * from "./TimecardWage"; -export * from "./TimecardWorkday"; -export * from "./TimecardWorkdayMatcher"; -export * from "./TipSettings"; -export * from "./Transaction"; -export * from "./TransactionProduct"; -export * from "./TransactionType"; -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 "./UpdateScheduledShiftResponse"; -export * from "./UpdateShiftResponse"; -export * from "./UpdateSubscriptionResponse"; -export * from "./UpdateTeamMemberRequest"; -export * from "./UpdateTeamMemberResponse"; -export * from "./UpdateTimecardResponse"; -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 "./VendorCreatedEvent"; -export * from "./VendorCreatedEventData"; -export * from "./VendorCreatedEventObject"; -export * from "./VendorCreatedEventObjectOperation"; -export * from "./VendorStatus"; -export * from "./VendorUpdatedEvent"; -export * from "./VendorUpdatedEventData"; -export * from "./VendorUpdatedEventObject"; -export * from "./VendorUpdatedEventObjectOperation"; -export * from "./VisibilityFilter"; -export * from "./VoidTransactionResponse"; -export * from "./WageSetting"; -export * from "./WebhookSubscription"; -export * from "./Weekday"; -export * from "./WorkweekConfig"; -export * from "./CatalogObjectItem"; -export * from "./CatalogObjectImage"; -export * from "./CatalogObjectItemVariation"; -export * from "./CatalogObjectTax"; -export * from "./CatalogObjectDiscount"; -export * from "./CatalogObjectModifierList"; -export * from "./CatalogObjectModifier"; -export * from "./CatalogObjectPricingRule"; -export * from "./CatalogObjectProductSet"; -export * from "./CatalogObjectTimePeriod"; -export * from "./CatalogObjectMeasurementUnit"; -export * from "./CatalogObjectSubscriptionPlanVariation"; -export * from "./CatalogObjectItemOption"; -export * from "./CatalogObjectItemOptionValue"; -export * from "./CatalogObjectCustomAttributeDefinition"; -export * from "./CatalogObjectQuickAmountsSettings"; -export * from "./CatalogObjectSubscriptionPlan"; -export * from "./CatalogObjectAvailabilityPeriod"; -export * from "./GetLoyaltyAccountRequest"; -export * from "./GetLoyaltyProgramRequest"; -export * from "./GetLoyaltyPromotionRequest"; -export * from "./GetLoyaltyRewardRequest"; -export * from "./GetCardRequest"; -export * from "./GetDisputeEvidenceRequest"; -export * from "./GetDisputeRequest"; -export * from "./V1GetPaymentRequest"; -export * from "./V1GetSettlementRequest"; -export * from "./GetCustomerGroupRequest"; -export * from "./GetCustomerRequest"; -export * from "./GetCustomerSegmentRequest"; -export * from "./GetTransactionRequest"; -export * from "./GetBookingRequest"; -export * from "./GetBusinessBookingProfileRequest"; -export * from "./GetTeamMemberBookingProfileRequest"; -export * from "./GetSnippetRequest"; -export * from "./GetInventoryAdjustmentRequest"; -export * from "./GetInventoryPhysicalCountRequest"; -export * from "./GetInventoryTransferRequest"; -export * from "./GetVendorRequest"; -export * from "./GetPaymentLinkRequest"; -export * from "./GetGiftCardRequest"; -export * from "./GetOrderRequest"; -export * from "./GetEmployeeRequest"; -export * from "./GetLocationRequest"; -export * from "./GetMerchantRequest"; -export * from "./GetTeamMemberRequest"; -export * from "./GetWageSettingRequest"; -export * from "./GetWebhookSubscriptionRequest"; +export * from "./AchDetails.js"; +export * from "./AcceptDisputeResponse.js"; +export * from "./AcceptedPaymentMethods.js"; +export * from "./AccumulateLoyaltyPointsResponse.js"; +export * from "./ActionCancelReason.js"; +export * from "./ActivityType.js"; +export * from "./AddGroupToCustomerResponse.js"; +export * from "./AdditionalRecipient.js"; +export * from "./Address.js"; +export * from "./AdjustLoyaltyPointsResponse.js"; +export * from "./AfterpayDetails.js"; +export * from "./ApplicationDetails.js"; +export * from "./ApplicationDetailsExternalSquareProduct.js"; +export * from "./ApplicationType.js"; +export * from "./AppointmentSegment.js"; +export * from "./ArchivedState.js"; +export * from "./Availability.js"; +export * from "./BankAccount.js"; +export * from "./BankAccountCreatedEvent.js"; +export * from "./BankAccountCreatedEventData.js"; +export * from "./BankAccountCreatedEventObject.js"; +export * from "./BankAccountDisabledEvent.js"; +export * from "./BankAccountDisabledEventData.js"; +export * from "./BankAccountDisabledEventObject.js"; +export * from "./BankAccountPaymentDetails.js"; +export * from "./BankAccountStatus.js"; +export * from "./BankAccountType.js"; +export * from "./BankAccountVerifiedEvent.js"; +export * from "./BankAccountVerifiedEventData.js"; +export * from "./BankAccountVerifiedEventObject.js"; +export * from "./BatchChangeInventoryRequest.js"; +export * from "./BatchChangeInventoryResponse.js"; +export * from "./BatchDeleteCatalogObjectsResponse.js"; +export * from "./BatchGetCatalogObjectsResponse.js"; +export * from "./BatchRetrieveInventoryChangesRequest.js"; +export * from "./BatchGetInventoryChangesResponse.js"; +export * from "./BatchGetInventoryCountsRequest.js"; +export * from "./BatchGetInventoryCountsResponse.js"; +export * from "./BatchGetOrdersResponse.js"; +export * from "./BatchUpsertCatalogObjectsResponse.js"; +export * from "./Booking.js"; +export * from "./BookingBookingSource.js"; +export * from "./BookingCreatedEvent.js"; +export * from "./BookingCreatedEventData.js"; +export * from "./BookingCreatedEventObject.js"; +export * from "./BookingCreatorDetails.js"; +export * from "./BookingCreatorDetailsCreatorType.js"; +export * from "./BookingCustomAttributeDefinitionOwnedCreatedEvent.js"; +export * from "./BookingCustomAttributeDefinitionOwnedDeletedEvent.js"; +export * from "./BookingCustomAttributeDefinitionOwnedUpdatedEvent.js"; +export * from "./BookingCustomAttributeDefinitionVisibleCreatedEvent.js"; +export * from "./BookingCustomAttributeDefinitionVisibleDeletedEvent.js"; +export * from "./BookingCustomAttributeDefinitionVisibleUpdatedEvent.js"; +export * from "./BookingCustomAttributeDeleteRequest.js"; +export * from "./BookingCustomAttributeDeleteResponse.js"; +export * from "./BookingCustomAttributeOwnedDeletedEvent.js"; +export * from "./BookingCustomAttributeOwnedUpdatedEvent.js"; +export * from "./BookingCustomAttributeUpsertRequest.js"; +export * from "./BookingCustomAttributeUpsertResponse.js"; +export * from "./BookingCustomAttributeVisibleDeletedEvent.js"; +export * from "./BookingCustomAttributeVisibleUpdatedEvent.js"; +export * from "./BookingStatus.js"; +export * from "./BookingUpdatedEvent.js"; +export * from "./BookingUpdatedEventData.js"; +export * from "./BookingUpdatedEventObject.js"; +export * from "./Break.js"; +export * from "./BreakType.js"; +export * from "./BulkCreateCustomerData.js"; +export * from "./BulkCreateCustomersResponse.js"; +export * from "./BatchCreateTeamMembersResponse.js"; +export * from "./BatchCreateVendorsResponse.js"; +export * from "./BulkDeleteBookingCustomAttributesResponse.js"; +export * from "./BulkDeleteCustomersResponse.js"; +export * from "./BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.js"; +export * from "./BulkDeleteLocationCustomAttributesResponse.js"; +export * from "./BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.js"; +export * from "./BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.js"; +export * from "./BulkDeleteMerchantCustomAttributesResponse.js"; +export * from "./BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.js"; +export * from "./BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.js"; +export * from "./BulkDeleteOrderCustomAttributesResponse.js"; +export * from "./BulkPublishScheduledShiftsData.js"; +export * from "./BulkPublishScheduledShiftsResponse.js"; +export * from "./BulkRetrieveBookingsResponse.js"; +export * from "./BulkRetrieveCustomersResponse.js"; +export * from "./BulkRetrieveTeamMemberBookingProfilesResponse.js"; +export * from "./BatchGetVendorsResponse.js"; +export * from "./BulkSwapPlanResponse.js"; +export * from "./BulkUpdateCustomerData.js"; +export * from "./BulkUpdateCustomersResponse.js"; +export * from "./BatchUpdateTeamMembersResponse.js"; +export * from "./BatchUpdateVendorsResponse.js"; +export * from "./BulkUpsertBookingCustomAttributesResponse.js"; +export * from "./BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.js"; +export * from "./BatchUpsertCustomerCustomAttributesResponse.js"; +export * from "./BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.js"; +export * from "./BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.js"; +export * from "./BulkUpsertLocationCustomAttributesResponse.js"; +export * from "./BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.js"; +export * from "./BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.js"; +export * from "./BulkUpsertMerchantCustomAttributesResponse.js"; +export * from "./BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.js"; +export * from "./BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.js"; +export * from "./BulkUpsertOrderCustomAttributesResponse.js"; +export * from "./BusinessAppointmentSettings.js"; +export * from "./BusinessAppointmentSettingsAlignmentTime.js"; +export * from "./BusinessAppointmentSettingsBookingLocationType.js"; +export * from "./BusinessAppointmentSettingsCancellationPolicy.js"; +export * from "./BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.js"; +export * from "./BusinessBookingProfile.js"; +export * from "./BusinessBookingProfileBookingPolicy.js"; +export * from "./BusinessBookingProfileCustomerTimezoneChoice.js"; +export * from "./BusinessHours.js"; +export * from "./BusinessHoursPeriod.js"; +export * from "./BuyNowPayLaterDetails.js"; +export * from "./CalculateLoyaltyPointsResponse.js"; +export * from "./CalculateOrderResponse.js"; +export * from "./CancelBookingResponse.js"; +export * from "./CancelInvoiceResponse.js"; +export * from "./CancelLoyaltyPromotionResponse.js"; +export * from "./CancelPaymentByIdempotencyKeyResponse.js"; +export * from "./CancelPaymentResponse.js"; +export * from "./CancelSubscriptionResponse.js"; +export * from "./CancelTerminalActionResponse.js"; +export * from "./CancelTerminalCheckoutResponse.js"; +export * from "./CancelTerminalRefundResponse.js"; +export * from "./CaptureTransactionResponse.js"; +export * from "./Card.js"; +export * from "./CardAutomaticallyUpdatedEvent.js"; +export * from "./CardAutomaticallyUpdatedEventData.js"; +export * from "./CardAutomaticallyUpdatedEventObject.js"; +export * from "./CardBrand.js"; +export * from "./CardCoBrand.js"; +export * from "./CardCreatedEvent.js"; +export * from "./CardCreatedEventData.js"; +export * from "./CardCreatedEventObject.js"; +export * from "./CardDisabledEvent.js"; +export * from "./CardDisabledEventData.js"; +export * from "./CardDisabledEventObject.js"; +export * from "./CardForgottenEvent.js"; +export * from "./CardForgottenEventCard.js"; +export * from "./CardForgottenEventData.js"; +export * from "./CardForgottenEventObject.js"; +export * from "./CardIssuerAlert.js"; +export * from "./CardPaymentDetails.js"; +export * from "./CardPaymentTimeline.js"; +export * from "./CardPrepaidType.js"; +export * from "./CardType.js"; +export * from "./CardUpdatedEvent.js"; +export * from "./CardUpdatedEventData.js"; +export * from "./CardUpdatedEventObject.js"; +export * from "./CashAppDetails.js"; +export * from "./CashDrawerDevice.js"; +export * from "./CashDrawerEventType.js"; +export * from "./CashDrawerShift.js"; +export * from "./CashDrawerShiftEvent.js"; +export * from "./CashDrawerShiftState.js"; +export * from "./CashDrawerShiftSummary.js"; +export * from "./CashPaymentDetails.js"; +export * from "./CatalogAvailabilityPeriod.js"; +export * from "./CatalogCategory.js"; +export * from "./CatalogCategoryType.js"; +export * from "./CatalogCustomAttributeDefinition.js"; +export * from "./CatalogCustomAttributeDefinitionAppVisibility.js"; +export * from "./CatalogCustomAttributeDefinitionNumberConfig.js"; +export * from "./CatalogCustomAttributeDefinitionSelectionConfig.js"; +export * from "./CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.js"; +export * from "./CatalogCustomAttributeDefinitionSellerVisibility.js"; +export * from "./CatalogCustomAttributeDefinitionStringConfig.js"; +export * from "./CatalogCustomAttributeDefinitionType.js"; +export * from "./CatalogCustomAttributeValue.js"; +export * from "./CatalogDiscount.js"; +export * from "./CatalogDiscountModifyTaxBasis.js"; +export * from "./CatalogDiscountType.js"; +export * from "./CatalogEcomSeoData.js"; +export * from "./CatalogIdMapping.js"; +export * from "./CatalogImage.js"; +export * from "./CatalogInfoResponse.js"; +export * from "./CatalogInfoResponseLimits.js"; +export * from "./CatalogItem.js"; +export * from "./CatalogItemFoodAndBeverageDetails.js"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreference.js"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.js"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.js"; +export * from "./CatalogItemFoodAndBeverageDetailsIngredient.js"; +export * from "./CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.js"; +export * from "./CatalogItemModifierListInfo.js"; +export * from "./CatalogItemOption.js"; +export * from "./CatalogItemOptionForItem.js"; +export * from "./CatalogItemOptionValue.js"; +export * from "./CatalogItemOptionValueForItemVariation.js"; +export * from "./CatalogItemProductType.js"; +export * from "./CatalogItemVariation.js"; +export * from "./CatalogMeasurementUnit.js"; +export * from "./CatalogModifier.js"; +export * from "./CatalogModifierList.js"; +export * from "./CatalogModifierListModifierType.js"; +export * from "./CatalogModifierListSelectionType.js"; +export * from "./CatalogModifierOverride.js"; +export * from "./CatalogObject.js"; +export * from "./CatalogObjectBatch.js"; +export * from "./CatalogObjectCategory.js"; +export * from "./CatalogObjectBase.js"; +export * from "./CatalogObjectReference.js"; +export * from "./CatalogObjectType.js"; +export * from "./CatalogPricingRule.js"; +export * from "./CatalogPricingType.js"; +export * from "./CatalogProductSet.js"; +export * from "./CatalogQuery.js"; +export * from "./CatalogQueryExact.js"; +export * from "./CatalogQueryItemVariationsForItemOptionValues.js"; +export * from "./CatalogQueryItemsForItemOptions.js"; +export * from "./CatalogQueryItemsForModifierList.js"; +export * from "./CatalogQueryItemsForTax.js"; +export * from "./CatalogQueryPrefix.js"; +export * from "./CatalogQueryRange.js"; +export * from "./CatalogQuerySet.js"; +export * from "./CatalogQuerySortedAttribute.js"; +export * from "./CatalogQueryText.js"; +export * from "./CatalogQuickAmount.js"; +export * from "./CatalogQuickAmountType.js"; +export * from "./CatalogQuickAmountsSettings.js"; +export * from "./CatalogQuickAmountsSettingsOption.js"; +export * from "./CatalogStockConversion.js"; +export * from "./CatalogSubscriptionPlan.js"; +export * from "./CatalogSubscriptionPlanVariation.js"; +export * from "./CatalogTax.js"; +export * from "./CatalogTimePeriod.js"; +export * from "./CatalogV1Id.js"; +export * from "./CatalogVersionUpdatedEvent.js"; +export * from "./CatalogVersionUpdatedEventCatalogVersion.js"; +export * from "./CatalogVersionUpdatedEventData.js"; +export * from "./CatalogVersionUpdatedEventObject.js"; +export * from "./CategoryPathToRootNode.js"; +export * from "./ChangeBillingAnchorDateResponse.js"; +export * from "./ChangeTiming.js"; +export * from "./ChargeRequestAdditionalRecipient.js"; +export * from "./Checkout.js"; +export * from "./CheckoutLocationSettings.js"; +export * from "./CheckoutLocationSettingsBranding.js"; +export * from "./CheckoutLocationSettingsBrandingButtonShape.js"; +export * from "./CheckoutLocationSettingsBrandingHeaderType.js"; +export * from "./CheckoutLocationSettingsCoupons.js"; +export * from "./CheckoutLocationSettingsPolicy.js"; +export * from "./CheckoutLocationSettingsTipping.js"; +export * from "./CheckoutMerchantSettings.js"; +export * from "./CheckoutMerchantSettingsPaymentMethods.js"; +export * from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.js"; +export * from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.js"; +export * from "./CheckoutMerchantSettingsPaymentMethodsPaymentMethod.js"; +export * from "./CheckoutOptions.js"; +export * from "./CheckoutOptionsPaymentType.js"; +export * from "./ClearpayDetails.js"; +export * from "./CloneOrderResponse.js"; +export * from "./CollectedData.js"; +export * from "./CompletePaymentResponse.js"; +export * from "./Component.js"; +export * from "./ComponentComponentType.js"; +export * from "./ConfirmationDecision.js"; +export * from "./ConfirmationOptions.js"; +export * from "./Coordinates.js"; +export * from "./Country.js"; +export * from "./CreateBookingCustomAttributeDefinitionResponse.js"; +export * from "./CreateBookingResponse.js"; +export * from "./CreateBreakTypeResponse.js"; +export * from "./CreateCardResponse.js"; +export * from "./CreateCatalogImageRequest.js"; +export * from "./CreateCatalogImageResponse.js"; +export * from "./CreateCheckoutResponse.js"; +export * from "./CreateCustomerCardResponse.js"; +export * from "./CreateCustomerCustomAttributeDefinitionResponse.js"; +export * from "./CreateCustomerGroupResponse.js"; +export * from "./CreateCustomerResponse.js"; +export * from "./CreateDeviceCodeResponse.js"; +export * from "./CreateDisputeEvidenceFileRequest.js"; +export * from "./CreateDisputeEvidenceFileResponse.js"; +export * from "./CreateDisputeEvidenceTextResponse.js"; +export * from "./CreateGiftCardActivityResponse.js"; +export * from "./CreateGiftCardResponse.js"; +export * from "./CreateInvoiceAttachmentRequestData.js"; +export * from "./CreateInvoiceAttachmentResponse.js"; +export * from "./CreateInvoiceResponse.js"; +export * from "./CreateJobResponse.js"; +export * from "./CreateLocationCustomAttributeDefinitionResponse.js"; +export * from "./CreateLocationResponse.js"; +export * from "./CreateLoyaltyAccountResponse.js"; +export * from "./CreateLoyaltyPromotionResponse.js"; +export * from "./CreateLoyaltyRewardResponse.js"; +export * from "./CreateMerchantCustomAttributeDefinitionResponse.js"; +export * from "./CreateMobileAuthorizationCodeResponse.js"; +export * from "./CreateOrderCustomAttributeDefinitionResponse.js"; +export * from "./CreateOrderRequest.js"; +export * from "./CreateOrderResponse.js"; +export * from "./CreatePaymentLinkResponse.js"; +export * from "./CreatePaymentResponse.js"; +export * from "./CreateScheduledShiftResponse.js"; +export * from "./CreateShiftResponse.js"; +export * from "./CreateSubscriptionResponse.js"; +export * from "./CreateTeamMemberRequest.js"; +export * from "./CreateTeamMemberResponse.js"; +export * from "./CreateTerminalActionResponse.js"; +export * from "./CreateTerminalCheckoutResponse.js"; +export * from "./CreateTerminalRefundResponse.js"; +export * from "./CreateTimecardResponse.js"; +export * from "./CreateVendorResponse.js"; +export * from "./CreateWebhookSubscriptionResponse.js"; +export * from "./Currency.js"; +export * from "./CustomAttribute.js"; +export * from "./CustomAttributeDefinition.js"; +export * from "./CustomAttributeDefinitionEventData.js"; +export * from "./CustomAttributeDefinitionEventDataObject.js"; +export * from "./CustomAttributeDefinitionVisibility.js"; +export * from "./CustomAttributeEventData.js"; +export * from "./CustomAttributeEventDataObject.js"; +export * from "./CustomAttributeFilter.js"; +export * from "./CustomField.js"; +export * from "./Customer.js"; +export * from "./CustomerAddressFilter.js"; +export * from "./CustomerCreatedEvent.js"; +export * from "./CustomerCreatedEventData.js"; +export * from "./CustomerCreatedEventEventContext.js"; +export * from "./CustomerCreatedEventEventContextMerge.js"; +export * from "./CustomerCreatedEventObject.js"; +export * from "./CustomerCreationSource.js"; +export * from "./CustomerCreationSourceFilter.js"; +export * from "./CustomerCustomAttributeDefinitionCreatedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionCreatedPublicEvent.js"; +export * from "./CustomerCustomAttributeDefinitionDeletedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionDeletedPublicEvent.js"; +export * from "./CustomerCustomAttributeDefinitionOwnedCreatedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionOwnedDeletedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionOwnedUpdatedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionUpdatedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionUpdatedPublicEvent.js"; +export * from "./CustomerCustomAttributeDefinitionVisibleCreatedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionVisibleDeletedEvent.js"; +export * from "./CustomerCustomAttributeDefinitionVisibleUpdatedEvent.js"; +export * from "./CustomerCustomAttributeDeletedEvent.js"; +export * from "./CustomerCustomAttributeDeletedPublicEvent.js"; +export * from "./CustomerCustomAttributeFilter.js"; +export * from "./CustomerCustomAttributeFilterValue.js"; +export * from "./CustomerCustomAttributeFilters.js"; +export * from "./CustomerCustomAttributeOwnedDeletedEvent.js"; +export * from "./CustomerCustomAttributeOwnedUpdatedEvent.js"; +export * from "./CustomerCustomAttributeUpdatedEvent.js"; +export * from "./CustomerCustomAttributeUpdatedPublicEvent.js"; +export * from "./CustomerCustomAttributeVisibleDeletedEvent.js"; +export * from "./CustomerCustomAttributeVisibleUpdatedEvent.js"; +export * from "./CustomerDeletedEvent.js"; +export * from "./CustomerDeletedEventData.js"; +export * from "./CustomerDeletedEventEventContext.js"; +export * from "./CustomerDeletedEventEventContextMerge.js"; +export * from "./CustomerDeletedEventObject.js"; +export * from "./CustomerDetails.js"; +export * from "./CustomerFilter.js"; +export * from "./CustomerGroup.js"; +export * from "./CustomerInclusionExclusion.js"; +export * from "./CustomerPreferences.js"; +export * from "./CustomerQuery.js"; +export * from "./CustomerSegment.js"; +export * from "./CustomerSort.js"; +export * from "./CustomerSortField.js"; +export * from "./CustomerTaxIds.js"; +export * from "./CustomerTextFilter.js"; +export * from "./CustomerUpdatedEvent.js"; +export * from "./CustomerUpdatedEventData.js"; +export * from "./CustomerUpdatedEventObject.js"; +export * from "./DataCollectionOptions.js"; +export * from "./DataCollectionOptionsInputType.js"; +export * from "./DateRange.js"; +export * from "./DayOfWeek.js"; +export * from "./DeleteBookingCustomAttributeDefinitionResponse.js"; +export * from "./DeleteBookingCustomAttributeResponse.js"; +export * from "./DeleteBreakTypeResponse.js"; +export * from "./DeleteCatalogObjectResponse.js"; +export * from "./DeleteCustomerCardResponse.js"; +export * from "./DeleteCustomerCustomAttributeDefinitionResponse.js"; +export * from "./DeleteCustomerCustomAttributeResponse.js"; +export * from "./DeleteCustomerGroupResponse.js"; +export * from "./DeleteCustomerResponse.js"; +export * from "./DeleteDisputeEvidenceResponse.js"; +export * from "./DeleteInvoiceAttachmentResponse.js"; +export * from "./DeleteInvoiceResponse.js"; +export * from "./DeleteLocationCustomAttributeDefinitionResponse.js"; +export * from "./DeleteLocationCustomAttributeResponse.js"; +export * from "./DeleteLoyaltyRewardResponse.js"; +export * from "./DeleteMerchantCustomAttributeDefinitionResponse.js"; +export * from "./DeleteMerchantCustomAttributeResponse.js"; +export * from "./DeleteOrderCustomAttributeDefinitionResponse.js"; +export * from "./DeleteOrderCustomAttributeResponse.js"; +export * from "./DeletePaymentLinkResponse.js"; +export * from "./DeleteShiftResponse.js"; +export * from "./DeleteSnippetResponse.js"; +export * from "./DeleteSubscriptionActionResponse.js"; +export * from "./DeleteTimecardResponse.js"; +export * from "./DeleteWebhookSubscriptionResponse.js"; +export * from "./Destination.js"; +export * from "./DestinationDetails.js"; +export * from "./DestinationDetailsCardRefundDetails.js"; +export * from "./DestinationDetailsCashRefundDetails.js"; +export * from "./DestinationDetailsExternalRefundDetails.js"; +export * from "./DestinationType.js"; +export * from "./Device.js"; +export * from "./DeviceAttributes.js"; +export * from "./DeviceAttributesDeviceType.js"; +export * from "./DeviceCheckoutOptions.js"; +export * from "./DeviceCode.js"; +export * from "./DeviceCodePairedEvent.js"; +export * from "./DeviceCodePairedEventData.js"; +export * from "./DeviceCodePairedEventObject.js"; +export * from "./DeviceCodeStatus.js"; +export * from "./DeviceComponentDetailsApplicationDetails.js"; +export * from "./DeviceComponentDetailsBatteryDetails.js"; +export * from "./DeviceComponentDetailsCardReaderDetails.js"; +export * from "./DeviceComponentDetailsEthernetDetails.js"; +export * from "./DeviceComponentDetailsExternalPower.js"; +export * from "./DeviceComponentDetailsMeasurement.js"; +export * from "./DeviceComponentDetailsWiFiDetails.js"; +export * from "./DeviceCreatedEvent.js"; +export * from "./DeviceCreatedEventData.js"; +export * from "./DeviceCreatedEventObject.js"; +export * from "./DeviceDetails.js"; +export * from "./DeviceMetadata.js"; +export * from "./DeviceStatus.js"; +export * from "./DeviceStatusCategory.js"; +export * from "./DigitalWalletDetails.js"; +export * from "./DisableCardResponse.js"; +export * from "./DisableEventsResponse.js"; +export * from "./DismissTerminalActionResponse.js"; +export * from "./DismissTerminalCheckoutResponse.js"; +export * from "./DismissTerminalRefundResponse.js"; +export * from "./Dispute.js"; +export * from "./DisputeCreatedEvent.js"; +export * from "./DisputeCreatedEventData.js"; +export * from "./DisputeCreatedEventObject.js"; +export * from "./DisputeEvidence.js"; +export * from "./DisputeEvidenceAddedEvent.js"; +export * from "./DisputeEvidenceAddedEventData.js"; +export * from "./DisputeEvidenceAddedEventObject.js"; +export * from "./DisputeEvidenceCreatedEvent.js"; +export * from "./DisputeEvidenceCreatedEventData.js"; +export * from "./DisputeEvidenceCreatedEventObject.js"; +export * from "./DisputeEvidenceDeletedEvent.js"; +export * from "./DisputeEvidenceDeletedEventData.js"; +export * from "./DisputeEvidenceDeletedEventObject.js"; +export * from "./DisputeEvidenceFile.js"; +export * from "./DisputeEvidenceRemovedEvent.js"; +export * from "./DisputeEvidenceRemovedEventData.js"; +export * from "./DisputeEvidenceRemovedEventObject.js"; +export * from "./DisputeEvidenceType.js"; +export * from "./DisputeReason.js"; +export * from "./DisputeState.js"; +export * from "./DisputeStateChangedEvent.js"; +export * from "./DisputeStateChangedEventData.js"; +export * from "./DisputeStateChangedEventObject.js"; +export * from "./DisputeStateUpdatedEvent.js"; +export * from "./DisputeStateUpdatedEventData.js"; +export * from "./DisputeStateUpdatedEventObject.js"; +export * from "./DisputedPayment.js"; +export * from "./EcomVisibility.js"; +export * from "./Employee.js"; +export * from "./EmployeeStatus.js"; +export * from "./EmployeeWage.js"; +export * from "./EnableEventsResponse.js"; +export * from "./Error_.js"; +export * from "./ErrorCategory.js"; +export * from "./ErrorCode.js"; +export * from "./Event.js"; +export * from "./EventData.js"; +export * from "./EventMetadata.js"; +export * from "./EventTypeMetadata.js"; +export * from "./ExcludeStrategy.js"; +export * from "./ExternalPaymentDetails.js"; +export * from "./FilterValue.js"; +export * from "./FloatNumberRange.js"; +export * from "./Fulfillment.js"; +export * from "./FulfillmentDeliveryDetails.js"; +export * from "./FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.js"; +export * from "./FulfillmentFulfillmentEntry.js"; +export * from "./FulfillmentFulfillmentLineItemApplication.js"; +export * from "./FulfillmentPickupDetails.js"; +export * from "./FulfillmentPickupDetailsCurbsidePickupDetails.js"; +export * from "./FulfillmentPickupDetailsScheduleType.js"; +export * from "./FulfillmentRecipient.js"; +export * from "./FulfillmentShipmentDetails.js"; +export * from "./FulfillmentState.js"; +export * from "./FulfillmentType.js"; +export * from "./GetBankAccountByV1IdResponse.js"; +export * from "./GetBankAccountResponse.js"; +export * from "./GetBreakTypeResponse.js"; +export * from "./GetDeviceCodeResponse.js"; +export * from "./GetDeviceResponse.js"; +export * from "./GetEmployeeWageResponse.js"; +export * from "./GetInvoiceResponse.js"; +export * from "./GetPaymentRefundResponse.js"; +export * from "./GetPaymentResponse.js"; +export * from "./GetPayoutResponse.js"; +export * from "./GetShiftResponse.js"; +export * from "./GetTeamMemberWageResponse.js"; +export * from "./GetTerminalActionResponse.js"; +export * from "./GetTerminalCheckoutResponse.js"; +export * from "./GetTerminalRefundResponse.js"; +export * from "./GiftCard.js"; +export * from "./GiftCardActivity.js"; +export * from "./GiftCardActivityActivate.js"; +export * from "./GiftCardActivityAdjustDecrement.js"; +export * from "./GiftCardActivityAdjustDecrementReason.js"; +export * from "./GiftCardActivityAdjustIncrement.js"; +export * from "./GiftCardActivityAdjustIncrementReason.js"; +export * from "./GiftCardActivityBlock.js"; +export * from "./GiftCardActivityBlockReason.js"; +export * from "./GiftCardActivityClearBalance.js"; +export * from "./GiftCardActivityClearBalanceReason.js"; +export * from "./GiftCardActivityCreatedEvent.js"; +export * from "./GiftCardActivityCreatedEventData.js"; +export * from "./GiftCardActivityCreatedEventObject.js"; +export * from "./GiftCardActivityDeactivate.js"; +export * from "./GiftCardActivityDeactivateReason.js"; +export * from "./GiftCardActivityImport.js"; +export * from "./GiftCardActivityImportReversal.js"; +export * from "./GiftCardActivityLoad.js"; +export * from "./GiftCardActivityRedeem.js"; +export * from "./GiftCardActivityRedeemStatus.js"; +export * from "./GiftCardActivityRefund.js"; +export * from "./GiftCardActivityTransferBalanceFrom.js"; +export * from "./GiftCardActivityTransferBalanceTo.js"; +export * from "./GiftCardActivityType.js"; +export * from "./GiftCardActivityUnblock.js"; +export * from "./GiftCardActivityUnblockReason.js"; +export * from "./GiftCardActivityUnlinkedActivityRefund.js"; +export * from "./GiftCardActivityUpdatedEvent.js"; +export * from "./GiftCardActivityUpdatedEventData.js"; +export * from "./GiftCardActivityUpdatedEventObject.js"; +export * from "./GiftCardCreatedEvent.js"; +export * from "./GiftCardCreatedEventData.js"; +export * from "./GiftCardCreatedEventObject.js"; +export * from "./GiftCardCustomerLinkedEvent.js"; +export * from "./GiftCardCustomerLinkedEventData.js"; +export * from "./GiftCardCustomerLinkedEventObject.js"; +export * from "./GiftCardCustomerUnlinkedEvent.js"; +export * from "./GiftCardCustomerUnlinkedEventData.js"; +export * from "./GiftCardCustomerUnlinkedEventObject.js"; +export * from "./GiftCardGanSource.js"; +export * from "./GiftCardStatus.js"; +export * from "./GiftCardType.js"; +export * from "./GiftCardUpdatedEvent.js"; +export * from "./GiftCardUpdatedEventData.js"; +export * from "./GiftCardUpdatedEventObject.js"; +export * from "./InventoryAdjustment.js"; +export * from "./InventoryAdjustmentGroup.js"; +export * from "./InventoryAlertType.js"; +export * from "./InventoryChange.js"; +export * from "./InventoryChangeType.js"; +export * from "./InventoryCount.js"; +export * from "./InventoryCountUpdatedEvent.js"; +export * from "./InventoryCountUpdatedEventData.js"; +export * from "./InventoryCountUpdatedEventObject.js"; +export * from "./InventoryPhysicalCount.js"; +export * from "./InventoryState.js"; +export * from "./InventoryTransfer.js"; +export * from "./Invoice.js"; +export * from "./InvoiceAcceptedPaymentMethods.js"; +export * from "./InvoiceAttachment.js"; +export * from "./InvoiceAutomaticPaymentSource.js"; +export * from "./InvoiceCanceledEvent.js"; +export * from "./InvoiceCanceledEventData.js"; +export * from "./InvoiceCanceledEventObject.js"; +export * from "./InvoiceCreatedEvent.js"; +export * from "./InvoiceCreatedEventData.js"; +export * from "./InvoiceCreatedEventObject.js"; +export * from "./InvoiceCustomField.js"; +export * from "./InvoiceCustomFieldPlacement.js"; +export * from "./InvoiceDeletedEvent.js"; +export * from "./InvoiceDeletedEventData.js"; +export * from "./InvoiceDeliveryMethod.js"; +export * from "./InvoiceFilter.js"; +export * from "./InvoicePaymentMadeEvent.js"; +export * from "./InvoicePaymentMadeEventData.js"; +export * from "./InvoicePaymentMadeEventObject.js"; +export * from "./InvoicePaymentReminder.js"; +export * from "./InvoicePaymentReminderStatus.js"; +export * from "./InvoicePaymentRequest.js"; +export * from "./InvoicePublishedEvent.js"; +export * from "./InvoicePublishedEventData.js"; +export * from "./InvoicePublishedEventObject.js"; +export * from "./InvoiceQuery.js"; +export * from "./InvoiceRecipient.js"; +export * from "./InvoiceRecipientTaxIds.js"; +export * from "./InvoiceRefundedEvent.js"; +export * from "./InvoiceRefundedEventData.js"; +export * from "./InvoiceRefundedEventObject.js"; +export * from "./InvoiceRequestMethod.js"; +export * from "./InvoiceRequestType.js"; +export * from "./InvoiceScheduledChargeFailedEvent.js"; +export * from "./InvoiceScheduledChargeFailedEventData.js"; +export * from "./InvoiceScheduledChargeFailedEventObject.js"; +export * from "./InvoiceSort.js"; +export * from "./InvoiceSortField.js"; +export * from "./InvoiceStatus.js"; +export * from "./InvoiceUpdatedEvent.js"; +export * from "./InvoiceUpdatedEventData.js"; +export * from "./InvoiceUpdatedEventObject.js"; +export * from "./ItemVariationLocationOverrides.js"; +export * from "./Job.js"; +export * from "./JobAssignment.js"; +export * from "./JobAssignmentPayType.js"; +export * from "./JobCreatedEvent.js"; +export * from "./JobCreatedEventData.js"; +export * from "./JobCreatedEventObject.js"; +export * from "./JobUpdatedEvent.js"; +export * from "./JobUpdatedEventData.js"; +export * from "./JobUpdatedEventObject.js"; +export * from "./LaborScheduledShiftCreatedEvent.js"; +export * from "./LaborScheduledShiftCreatedEventData.js"; +export * from "./LaborScheduledShiftCreatedEventObject.js"; +export * from "./LaborScheduledShiftDeletedEvent.js"; +export * from "./LaborScheduledShiftDeletedEventData.js"; +export * from "./LaborScheduledShiftPublishedEvent.js"; +export * from "./LaborScheduledShiftPublishedEventData.js"; +export * from "./LaborScheduledShiftPublishedEventObject.js"; +export * from "./LaborScheduledShiftUpdatedEvent.js"; +export * from "./LaborScheduledShiftUpdatedEventData.js"; +export * from "./LaborScheduledShiftUpdatedEventObject.js"; +export * from "./LaborShiftCreatedEvent.js"; +export * from "./LaborShiftCreatedEventData.js"; +export * from "./LaborShiftCreatedEventObject.js"; +export * from "./LaborShiftDeletedEvent.js"; +export * from "./LaborShiftDeletedEventData.js"; +export * from "./LaborShiftUpdatedEvent.js"; +export * from "./LaborShiftUpdatedEventData.js"; +export * from "./LaborShiftUpdatedEventObject.js"; +export * from "./LaborTimecardCreatedEvent.js"; +export * from "./LaborTimecardCreatedEventData.js"; +export * from "./LaborTimecardCreatedEventObject.js"; +export * from "./LaborTimecardDeletedEvent.js"; +export * from "./LaborTimecardDeletedEventData.js"; +export * from "./LaborTimecardUpdatedEvent.js"; +export * from "./LaborTimecardUpdatedEventData.js"; +export * from "./LaborTimecardUpdatedEventObject.js"; +export * from "./LinkCustomerToGiftCardResponse.js"; +export * from "./ListBankAccountsResponse.js"; +export * from "./ListBookingCustomAttributeDefinitionsResponse.js"; +export * from "./ListBookingCustomAttributesResponse.js"; +export * from "./ListBookingsResponse.js"; +export * from "./ListBreakTypesResponse.js"; +export * from "./ListCardsResponse.js"; +export * from "./ListCashDrawerShiftEventsResponse.js"; +export * from "./ListCashDrawerShiftsResponse.js"; +export * from "./ListCatalogResponse.js"; +export * from "./ListCustomerCustomAttributeDefinitionsResponse.js"; +export * from "./ListCustomerCustomAttributesResponse.js"; +export * from "./ListCustomerGroupsResponse.js"; +export * from "./ListCustomerSegmentsResponse.js"; +export * from "./ListCustomersResponse.js"; +export * from "./ListDeviceCodesResponse.js"; +export * from "./ListDevicesResponse.js"; +export * from "./ListDisputeEvidenceResponse.js"; +export * from "./ListDisputesResponse.js"; +export * from "./ListEmployeeWagesResponse.js"; +export * from "./ListEmployeesResponse.js"; +export * from "./ListEventTypesResponse.js"; +export * from "./ListGiftCardActivitiesResponse.js"; +export * from "./ListGiftCardsResponse.js"; +export * from "./ListInvoicesResponse.js"; +export * from "./ListJobsResponse.js"; +export * from "./ListLocationBookingProfilesResponse.js"; +export * from "./ListLocationCustomAttributeDefinitionsResponse.js"; +export * from "./ListLocationCustomAttributesResponse.js"; +export * from "./ListLocationsResponse.js"; +export * from "./ListLoyaltyProgramsResponse.js"; +export * from "./ListLoyaltyPromotionsResponse.js"; +export * from "./ListMerchantCustomAttributeDefinitionsResponse.js"; +export * from "./ListMerchantCustomAttributesResponse.js"; +export * from "./ListMerchantsResponse.js"; +export * from "./ListOrderCustomAttributeDefinitionsResponse.js"; +export * from "./ListOrderCustomAttributesResponse.js"; +export * from "./ListPaymentLinksResponse.js"; +export * from "./ListPaymentRefundsRequestSortField.js"; +export * from "./ListPaymentRefundsResponse.js"; +export * from "./ListPaymentsRequestSortField.js"; +export * from "./ListPaymentsResponse.js"; +export * from "./ListPayoutEntriesResponse.js"; +export * from "./ListPayoutsResponse.js"; +export * from "./ListSitesResponse.js"; +export * from "./ListSubscriptionEventsResponse.js"; +export * from "./ListTeamMemberBookingProfilesResponse.js"; +export * from "./ListTeamMemberWagesResponse.js"; +export * from "./ListTransactionsResponse.js"; +export * from "./ListWebhookEventTypesResponse.js"; +export * from "./ListWebhookSubscriptionsResponse.js"; +export * from "./ListWorkweekConfigsResponse.js"; +export * from "./Location.js"; +export * from "./LocationBookingProfile.js"; +export * from "./LocationCapability.js"; +export * from "./LocationCreatedEvent.js"; +export * from "./LocationCreatedEventData.js"; +export * from "./LocationCustomAttributeDefinitionOwnedCreatedEvent.js"; +export * from "./LocationCustomAttributeDefinitionOwnedDeletedEvent.js"; +export * from "./LocationCustomAttributeDefinitionOwnedUpdatedEvent.js"; +export * from "./LocationCustomAttributeDefinitionVisibleCreatedEvent.js"; +export * from "./LocationCustomAttributeDefinitionVisibleDeletedEvent.js"; +export * from "./LocationCustomAttributeDefinitionVisibleUpdatedEvent.js"; +export * from "./LocationCustomAttributeOwnedDeletedEvent.js"; +export * from "./LocationCustomAttributeOwnedUpdatedEvent.js"; +export * from "./LocationCustomAttributeVisibleDeletedEvent.js"; +export * from "./LocationCustomAttributeVisibleUpdatedEvent.js"; +export * from "./LocationSettingsUpdatedEvent.js"; +export * from "./LocationSettingsUpdatedEventData.js"; +export * from "./LocationSettingsUpdatedEventObject.js"; +export * from "./LocationStatus.js"; +export * from "./LocationType.js"; +export * from "./LocationUpdatedEvent.js"; +export * from "./LocationUpdatedEventData.js"; +export * from "./LoyaltyAccount.js"; +export * from "./LoyaltyAccountCreatedEvent.js"; +export * from "./LoyaltyAccountCreatedEventData.js"; +export * from "./LoyaltyAccountCreatedEventObject.js"; +export * from "./LoyaltyAccountDeletedEvent.js"; +export * from "./LoyaltyAccountDeletedEventData.js"; +export * from "./LoyaltyAccountDeletedEventObject.js"; +export * from "./LoyaltyAccountExpiringPointDeadline.js"; +export * from "./LoyaltyAccountMapping.js"; +export * from "./LoyaltyAccountMappingType.js"; +export * from "./LoyaltyAccountUpdatedEvent.js"; +export * from "./LoyaltyAccountUpdatedEventData.js"; +export * from "./LoyaltyAccountUpdatedEventObject.js"; +export * from "./LoyaltyEvent.js"; +export * from "./LoyaltyEventAccumulatePoints.js"; +export * from "./LoyaltyEventAccumulatePromotionPoints.js"; +export * from "./LoyaltyEventAdjustPoints.js"; +export * from "./LoyaltyEventCreateReward.js"; +export * from "./LoyaltyEventCreatedEvent.js"; +export * from "./LoyaltyEventCreatedEventData.js"; +export * from "./LoyaltyEventCreatedEventObject.js"; +export * from "./LoyaltyEventDateTimeFilter.js"; +export * from "./LoyaltyEventDeleteReward.js"; +export * from "./LoyaltyEventExpirePoints.js"; +export * from "./LoyaltyEventFilter.js"; +export * from "./LoyaltyEventLocationFilter.js"; +export * from "./LoyaltyEventLoyaltyAccountFilter.js"; +export * from "./LoyaltyEventOrderFilter.js"; +export * from "./LoyaltyEventOther.js"; +export * from "./LoyaltyEventQuery.js"; +export * from "./LoyaltyEventRedeemReward.js"; +export * from "./LoyaltyEventSource.js"; +export * from "./LoyaltyEventType.js"; +export * from "./LoyaltyEventTypeFilter.js"; +export * from "./LoyaltyProgram.js"; +export * from "./LoyaltyProgramAccrualRule.js"; +export * from "./LoyaltyProgramAccrualRuleCategoryData.js"; +export * from "./LoyaltyProgramAccrualRuleItemVariationData.js"; +export * from "./LoyaltyProgramAccrualRuleSpendData.js"; +export * from "./LoyaltyProgramAccrualRuleTaxMode.js"; +export * from "./LoyaltyProgramAccrualRuleType.js"; +export * from "./LoyaltyProgramAccrualRuleVisitData.js"; +export * from "./LoyaltyProgramCreatedEvent.js"; +export * from "./LoyaltyProgramCreatedEventData.js"; +export * from "./LoyaltyProgramCreatedEventObject.js"; +export * from "./LoyaltyProgramExpirationPolicy.js"; +export * from "./LoyaltyProgramRewardTier.js"; +export * from "./LoyaltyProgramStatus.js"; +export * from "./LoyaltyProgramTerminology.js"; +export * from "./LoyaltyProgramUpdatedEvent.js"; +export * from "./LoyaltyProgramUpdatedEventData.js"; +export * from "./LoyaltyProgramUpdatedEventObject.js"; +export * from "./LoyaltyPromotion.js"; +export * from "./LoyaltyPromotionAvailableTimeData.js"; +export * from "./LoyaltyPromotionCreatedEvent.js"; +export * from "./LoyaltyPromotionCreatedEventData.js"; +export * from "./LoyaltyPromotionCreatedEventObject.js"; +export * from "./LoyaltyPromotionIncentive.js"; +export * from "./LoyaltyPromotionIncentivePointsAdditionData.js"; +export * from "./LoyaltyPromotionIncentivePointsMultiplierData.js"; +export * from "./LoyaltyPromotionIncentiveType.js"; +export * from "./LoyaltyPromotionStatus.js"; +export * from "./LoyaltyPromotionTriggerLimit.js"; +export * from "./LoyaltyPromotionTriggerLimitInterval.js"; +export * from "./LoyaltyPromotionUpdatedEvent.js"; +export * from "./LoyaltyPromotionUpdatedEventData.js"; +export * from "./LoyaltyPromotionUpdatedEventObject.js"; +export * from "./LoyaltyReward.js"; +export * from "./LoyaltyRewardStatus.js"; +export * from "./MeasurementUnit.js"; +export * from "./MeasurementUnitArea.js"; +export * from "./MeasurementUnitCustom.js"; +export * from "./MeasurementUnitGeneric.js"; +export * from "./MeasurementUnitLength.js"; +export * from "./MeasurementUnitTime.js"; +export * from "./MeasurementUnitUnitType.js"; +export * from "./MeasurementUnitVolume.js"; +export * from "./MeasurementUnitWeight.js"; +export * from "./Merchant.js"; +export * from "./MerchantCustomAttributeDefinitionOwnedCreatedEvent.js"; +export * from "./MerchantCustomAttributeDefinitionOwnedDeletedEvent.js"; +export * from "./MerchantCustomAttributeDefinitionOwnedUpdatedEvent.js"; +export * from "./MerchantCustomAttributeDefinitionVisibleCreatedEvent.js"; +export * from "./MerchantCustomAttributeDefinitionVisibleDeletedEvent.js"; +export * from "./MerchantCustomAttributeDefinitionVisibleUpdatedEvent.js"; +export * from "./MerchantCustomAttributeOwnedDeletedEvent.js"; +export * from "./MerchantCustomAttributeOwnedUpdatedEvent.js"; +export * from "./MerchantCustomAttributeVisibleDeletedEvent.js"; +export * from "./MerchantCustomAttributeVisibleUpdatedEvent.js"; +export * from "./MerchantSettingsUpdatedEvent.js"; +export * from "./MerchantSettingsUpdatedEventData.js"; +export * from "./MerchantSettingsUpdatedEventObject.js"; +export * from "./MerchantStatus.js"; +export * from "./ModifierLocationOverrides.js"; +export * from "./Money.js"; +export * from "./OauthAuthorizationRevokedEvent.js"; +export * from "./OauthAuthorizationRevokedEventData.js"; +export * from "./OauthAuthorizationRevokedEventObject.js"; +export * from "./OauthAuthorizationRevokedEventRevocationObject.js"; +export * from "./OauthAuthorizationRevokedEventRevokerType.js"; +export * from "./ObtainTokenResponse.js"; +export * from "./OfflinePaymentDetails.js"; +export * from "./Order.js"; +export * from "./OrderCreated.js"; +export * from "./OrderCreatedEvent.js"; +export * from "./OrderCreatedEventData.js"; +export * from "./OrderCreatedObject.js"; +export * from "./OrderCustomAttributeDefinitionOwnedCreatedEvent.js"; +export * from "./OrderCustomAttributeDefinitionOwnedDeletedEvent.js"; +export * from "./OrderCustomAttributeDefinitionOwnedUpdatedEvent.js"; +export * from "./OrderCustomAttributeDefinitionVisibleCreatedEvent.js"; +export * from "./OrderCustomAttributeDefinitionVisibleDeletedEvent.js"; +export * from "./OrderCustomAttributeDefinitionVisibleUpdatedEvent.js"; +export * from "./OrderCustomAttributeOwnedDeletedEvent.js"; +export * from "./OrderCustomAttributeOwnedUpdatedEvent.js"; +export * from "./OrderCustomAttributeVisibleDeletedEvent.js"; +export * from "./OrderCustomAttributeVisibleUpdatedEvent.js"; +export * from "./OrderEntry.js"; +export * from "./OrderFulfillmentDeliveryDetailsScheduleType.js"; +export * from "./OrderFulfillmentFulfillmentLineItemApplication.js"; +export * from "./OrderFulfillmentPickupDetailsScheduleType.js"; +export * from "./OrderFulfillmentState.js"; +export * from "./OrderFulfillmentType.js"; +export * from "./OrderFulfillmentUpdated.js"; +export * from "./OrderFulfillmentUpdatedEvent.js"; +export * from "./OrderFulfillmentUpdatedEventData.js"; +export * from "./OrderFulfillmentUpdatedObject.js"; +export * from "./OrderFulfillmentUpdatedUpdate.js"; +export * from "./OrderLineItem.js"; +export * from "./OrderLineItemAppliedDiscount.js"; +export * from "./OrderLineItemAppliedServiceCharge.js"; +export * from "./OrderLineItemAppliedTax.js"; +export * from "./OrderLineItemDiscount.js"; +export * from "./OrderLineItemDiscountScope.js"; +export * from "./OrderLineItemDiscountType.js"; +export * from "./OrderLineItemItemType.js"; +export * from "./OrderLineItemModifier.js"; +export * from "./OrderLineItemPricingBlocklists.js"; +export * from "./OrderLineItemPricingBlocklistsBlockedDiscount.js"; +export * from "./OrderLineItemPricingBlocklistsBlockedTax.js"; +export * from "./OrderLineItemTax.js"; +export * from "./OrderLineItemTaxScope.js"; +export * from "./OrderLineItemTaxType.js"; +export * from "./OrderMoneyAmounts.js"; +export * from "./OrderPricingOptions.js"; +export * from "./OrderQuantityUnit.js"; +export * from "./OrderReturn.js"; +export * from "./OrderReturnDiscount.js"; +export * from "./OrderReturnLineItem.js"; +export * from "./OrderReturnLineItemModifier.js"; +export * from "./OrderReturnServiceCharge.js"; +export * from "./OrderReturnTax.js"; +export * from "./OrderReturnTip.js"; +export * from "./OrderReward.js"; +export * from "./OrderRoundingAdjustment.js"; +export * from "./OrderServiceCharge.js"; +export * from "./OrderServiceChargeCalculationPhase.js"; +export * from "./OrderServiceChargeScope.js"; +export * from "./OrderServiceChargeTreatmentType.js"; +export * from "./OrderServiceChargeType.js"; +export * from "./OrderSource.js"; +export * from "./OrderState.js"; +export * from "./OrderUpdated.js"; +export * from "./OrderUpdatedEvent.js"; +export * from "./OrderUpdatedEventData.js"; +export * from "./OrderUpdatedObject.js"; +export * from "./PauseSubscriptionResponse.js"; +export * from "./PayOrderResponse.js"; +export * from "./Payment.js"; +export * from "./PaymentBalanceActivityAppFeeRefundDetail.js"; +export * from "./PaymentBalanceActivityAppFeeRevenueDetail.js"; +export * from "./PaymentBalanceActivityAutomaticSavingsDetail.js"; +export * from "./PaymentBalanceActivityAutomaticSavingsReversedDetail.js"; +export * from "./PaymentBalanceActivityChargeDetail.js"; +export * from "./PaymentBalanceActivityDepositFeeDetail.js"; +export * from "./PaymentBalanceActivityDepositFeeReversedDetail.js"; +export * from "./PaymentBalanceActivityDisputeDetail.js"; +export * from "./PaymentBalanceActivityFeeDetail.js"; +export * from "./PaymentBalanceActivityFreeProcessingDetail.js"; +export * from "./PaymentBalanceActivityHoldAdjustmentDetail.js"; +export * from "./PaymentBalanceActivityOpenDisputeDetail.js"; +export * from "./PaymentBalanceActivityOtherAdjustmentDetail.js"; +export * from "./PaymentBalanceActivityOtherDetail.js"; +export * from "./PaymentBalanceActivityRefundDetail.js"; +export * from "./PaymentBalanceActivityReleaseAdjustmentDetail.js"; +export * from "./PaymentBalanceActivityReserveHoldDetail.js"; +export * from "./PaymentBalanceActivityReserveReleaseDetail.js"; +export * from "./PaymentBalanceActivitySquareCapitalPaymentDetail.js"; +export * from "./PaymentBalanceActivitySquareCapitalReversedPaymentDetail.js"; +export * from "./PaymentBalanceActivitySquarePayrollTransferDetail.js"; +export * from "./PaymentBalanceActivitySquarePayrollTransferReversedDetail.js"; +export * from "./PaymentBalanceActivityTaxOnFeeDetail.js"; +export * from "./PaymentBalanceActivityThirdPartyFeeDetail.js"; +export * from "./PaymentBalanceActivityThirdPartyFeeRefundDetail.js"; +export * from "./PaymentCreatedEvent.js"; +export * from "./PaymentCreatedEventData.js"; +export * from "./PaymentCreatedEventObject.js"; +export * from "./PaymentLink.js"; +export * from "./PaymentLinkRelatedResources.js"; +export * from "./PaymentOptions.js"; +export * from "./PaymentOptionsDelayAction.js"; +export * from "./PaymentRefund.js"; +export * from "./PaymentUpdatedEvent.js"; +export * from "./PaymentUpdatedEventData.js"; +export * from "./PaymentUpdatedEventObject.js"; +export * from "./Payout.js"; +export * from "./PayoutEntry.js"; +export * from "./PayoutFailedEvent.js"; +export * from "./PayoutFailedEventData.js"; +export * from "./PayoutFailedEventObject.js"; +export * from "./PayoutFee.js"; +export * from "./PayoutFeeType.js"; +export * from "./PayoutPaidEvent.js"; +export * from "./PayoutPaidEventData.js"; +export * from "./PayoutPaidEventObject.js"; +export * from "./PayoutSentEvent.js"; +export * from "./PayoutSentEventData.js"; +export * from "./PayoutSentEventObject.js"; +export * from "./PayoutStatus.js"; +export * from "./PayoutType.js"; +export * from "./Phase.js"; +export * from "./PhaseInput.js"; +export * from "./PrePopulatedData.js"; +export * from "./ProcessingFee.js"; +export * from "./Product.js"; +export * from "./ProductType.js"; +export * from "./PublishInvoiceResponse.js"; +export * from "./PublishScheduledShiftResponse.js"; +export * from "./QrCodeOptions.js"; +export * from "./QuickPay.js"; +export * from "./Range.js"; +export * from "./ReceiptOptions.js"; +export * from "./RedeemLoyaltyRewardResponse.js"; +export * from "./Refund.js"; +export * from "./RefundCreatedEvent.js"; +export * from "./RefundCreatedEventData.js"; +export * from "./RefundCreatedEventObject.js"; +export * from "./RefundPaymentResponse.js"; +export * from "./RefundStatus.js"; +export * from "./RefundUpdatedEvent.js"; +export * from "./RefundUpdatedEventData.js"; +export * from "./RefundUpdatedEventObject.js"; +export * from "./RegisterDomainResponse.js"; +export * from "./RegisterDomainResponseStatus.js"; +export * from "./RemoveGroupFromCustomerResponse.js"; +export * from "./ResumeSubscriptionResponse.js"; +export * from "./RetrieveBookingCustomAttributeDefinitionResponse.js"; +export * from "./RetrieveBookingCustomAttributeResponse.js"; +export * from "./GetBookingResponse.js"; +export * from "./GetBusinessBookingProfileResponse.js"; +export * from "./GetCardResponse.js"; +export * from "./GetCashDrawerShiftResponse.js"; +export * from "./GetCatalogObjectResponse.js"; +export * from "./GetCustomerCustomAttributeDefinitionResponse.js"; +export * from "./GetCustomerCustomAttributeResponse.js"; +export * from "./GetCustomerGroupResponse.js"; +export * from "./GetCustomerResponse.js"; +export * from "./GetCustomerSegmentResponse.js"; +export * from "./GetDisputeEvidenceResponse.js"; +export * from "./GetDisputeResponse.js"; +export * from "./GetEmployeeResponse.js"; +export * from "./GetGiftCardFromGanResponse.js"; +export * from "./GetGiftCardFromNonceResponse.js"; +export * from "./GetGiftCardResponse.js"; +export * from "./GetInventoryAdjustmentResponse.js"; +export * from "./GetInventoryChangesResponse.js"; +export * from "./GetInventoryCountResponse.js"; +export * from "./GetInventoryPhysicalCountResponse.js"; +export * from "./GetInventoryTransferResponse.js"; +export * from "./RetrieveJobResponse.js"; +export * from "./RetrieveLocationBookingProfileResponse.js"; +export * from "./RetrieveLocationCustomAttributeDefinitionResponse.js"; +export * from "./RetrieveLocationCustomAttributeResponse.js"; +export * from "./GetLocationResponse.js"; +export * from "./RetrieveLocationSettingsResponse.js"; +export * from "./GetLoyaltyAccountResponse.js"; +export * from "./GetLoyaltyProgramResponse.js"; +export * from "./GetLoyaltyPromotionResponse.js"; +export * from "./GetLoyaltyRewardResponse.js"; +export * from "./RetrieveMerchantCustomAttributeDefinitionResponse.js"; +export * from "./RetrieveMerchantCustomAttributeResponse.js"; +export * from "./GetMerchantResponse.js"; +export * from "./RetrieveMerchantSettingsResponse.js"; +export * from "./RetrieveOrderCustomAttributeDefinitionResponse.js"; +export * from "./RetrieveOrderCustomAttributeResponse.js"; +export * from "./GetOrderResponse.js"; +export * from "./GetPaymentLinkResponse.js"; +export * from "./RetrieveScheduledShiftResponse.js"; +export * from "./GetSnippetResponse.js"; +export * from "./GetSubscriptionResponse.js"; +export * from "./GetTeamMemberBookingProfileResponse.js"; +export * from "./GetTeamMemberResponse.js"; +export * from "./RetrieveTimecardResponse.js"; +export * from "./RetrieveTokenStatusResponse.js"; +export * from "./GetTransactionResponse.js"; +export * from "./GetVendorResponse.js"; +export * from "./GetWageSettingResponse.js"; +export * from "./GetWebhookSubscriptionResponse.js"; +export * from "./RevokeTokenResponse.js"; +export * from "./RiskEvaluation.js"; +export * from "./RiskEvaluationRiskLevel.js"; +export * from "./SaveCardOptions.js"; +export * from "./ScheduledShift.js"; +export * from "./ScheduledShiftDetails.js"; +export * from "./ScheduledShiftFilter.js"; +export * from "./ScheduledShiftFilterAssignmentStatus.js"; +export * from "./ScheduledShiftFilterScheduledShiftStatus.js"; +export * from "./ScheduledShiftNotificationAudience.js"; +export * from "./ScheduledShiftQuery.js"; +export * from "./ScheduledShiftSort.js"; +export * from "./ScheduledShiftSortField.js"; +export * from "./ScheduledShiftWorkday.js"; +export * from "./ScheduledShiftWorkdayMatcher.js"; +export * from "./SearchAvailabilityFilter.js"; +export * from "./SearchAvailabilityQuery.js"; +export * from "./SearchAvailabilityResponse.js"; +export * from "./SearchCatalogItemsRequestStockLevel.js"; +export * from "./SearchCatalogItemsResponse.js"; +export * from "./SearchCatalogObjectsResponse.js"; +export * from "./SearchCustomersResponse.js"; +export * from "./SearchEventsFilter.js"; +export * from "./SearchEventsQuery.js"; +export * from "./SearchEventsResponse.js"; +export * from "./SearchEventsSort.js"; +export * from "./SearchEventsSortField.js"; +export * from "./SearchInvoicesResponse.js"; +export * from "./SearchLoyaltyAccountsRequestLoyaltyAccountQuery.js"; +export * from "./SearchLoyaltyAccountsResponse.js"; +export * from "./SearchLoyaltyEventsResponse.js"; +export * from "./SearchLoyaltyRewardsRequestLoyaltyRewardQuery.js"; +export * from "./SearchLoyaltyRewardsResponse.js"; +export * from "./SearchOrdersCustomerFilter.js"; +export * from "./SearchOrdersDateTimeFilter.js"; +export * from "./SearchOrdersFilter.js"; +export * from "./SearchOrdersFulfillmentFilter.js"; +export * from "./SearchOrdersQuery.js"; +export * from "./SearchOrdersResponse.js"; +export * from "./SearchOrdersSort.js"; +export * from "./SearchOrdersSortField.js"; +export * from "./SearchOrdersSourceFilter.js"; +export * from "./SearchOrdersStateFilter.js"; +export * from "./SearchScheduledShiftsResponse.js"; +export * from "./SearchShiftsResponse.js"; +export * from "./SearchSubscriptionsFilter.js"; +export * from "./SearchSubscriptionsQuery.js"; +export * from "./SearchSubscriptionsResponse.js"; +export * from "./SearchTeamMembersFilter.js"; +export * from "./SearchTeamMembersQuery.js"; +export * from "./SearchTeamMembersResponse.js"; +export * from "./SearchTerminalActionsResponse.js"; +export * from "./SearchTerminalCheckoutsResponse.js"; +export * from "./SearchTerminalRefundsResponse.js"; +export * from "./SearchTimecardsResponse.js"; +export * from "./SearchVendorsRequestFilter.js"; +export * from "./SearchVendorsRequestSort.js"; +export * from "./SearchVendorsRequestSortField.js"; +export * from "./SearchVendorsResponse.js"; +export * from "./SegmentFilter.js"; +export * from "./SelectOption.js"; +export * from "./SelectOptions.js"; +export * from "./Shift.js"; +export * from "./ShiftFilter.js"; +export * from "./ShiftFilterStatus.js"; +export * from "./ShiftQuery.js"; +export * from "./ShiftSort.js"; +export * from "./ShiftSortField.js"; +export * from "./ShiftStatus.js"; +export * from "./ShiftWage.js"; +export * from "./ShiftWorkday.js"; +export * from "./ShiftWorkdayMatcher.js"; +export * from "./ShippingFee.js"; +export * from "./SignatureImage.js"; +export * from "./SignatureOptions.js"; +export * from "./Site.js"; +export * from "./Snippet.js"; +export * from "./SortOrder.js"; +export * from "./SourceApplication.js"; +export * from "./SquareAccountDetails.js"; +export * from "./StandardUnitDescription.js"; +export * from "./StandardUnitDescriptionGroup.js"; +export * from "./SubmitEvidenceResponse.js"; +export * from "./Subscription.js"; +export * from "./SubscriptionAction.js"; +export * from "./SubscriptionActionType.js"; +export * from "./SubscriptionCadence.js"; +export * from "./SubscriptionCreatedEvent.js"; +export * from "./SubscriptionCreatedEventData.js"; +export * from "./SubscriptionCreatedEventObject.js"; +export * from "./SubscriptionEvent.js"; +export * from "./SubscriptionEventInfo.js"; +export * from "./SubscriptionEventInfoCode.js"; +export * from "./SubscriptionEventSubscriptionEventType.js"; +export * from "./SubscriptionPhase.js"; +export * from "./SubscriptionPricing.js"; +export * from "./SubscriptionPricingType.js"; +export * from "./SubscriptionSource.js"; +export * from "./SubscriptionStatus.js"; +export * from "./SubscriptionTestResult.js"; +export * from "./SubscriptionUpdatedEvent.js"; +export * from "./SubscriptionUpdatedEventData.js"; +export * from "./SubscriptionUpdatedEventObject.js"; +export * from "./SwapPlanResponse.js"; +export * from "./TaxCalculationPhase.js"; +export * from "./TaxIds.js"; +export * from "./TaxInclusionType.js"; +export * from "./TeamMember.js"; +export * from "./TeamMemberAssignedLocations.js"; +export * from "./TeamMemberAssignedLocationsAssignmentType.js"; +export * from "./TeamMemberBookingProfile.js"; +export * from "./TeamMemberCreatedEvent.js"; +export * from "./TeamMemberCreatedEventData.js"; +export * from "./TeamMemberCreatedEventObject.js"; +export * from "./TeamMemberInvitationStatus.js"; +export * from "./TeamMemberStatus.js"; +export * from "./TeamMemberUpdatedEvent.js"; +export * from "./TeamMemberUpdatedEventData.js"; +export * from "./TeamMemberUpdatedEventObject.js"; +export * from "./TeamMemberWage.js"; +export * from "./TeamMemberWageSettingUpdatedEvent.js"; +export * from "./TeamMemberWageSettingUpdatedEventData.js"; +export * from "./TeamMemberWageSettingUpdatedEventObject.js"; +export * from "./Tender.js"; +export * from "./TenderBankAccountDetails.js"; +export * from "./TenderBankAccountDetailsStatus.js"; +export * from "./TenderBuyNowPayLaterDetails.js"; +export * from "./TenderBuyNowPayLaterDetailsBrand.js"; +export * from "./TenderBuyNowPayLaterDetailsStatus.js"; +export * from "./TenderCardDetails.js"; +export * from "./TenderCardDetailsEntryMethod.js"; +export * from "./TenderCardDetailsStatus.js"; +export * from "./TenderCashDetails.js"; +export * from "./TenderSquareAccountDetails.js"; +export * from "./TenderSquareAccountDetailsStatus.js"; +export * from "./TenderType.js"; +export * from "./TerminalAction.js"; +export * from "./TerminalActionActionType.js"; +export * from "./TerminalActionCreatedEvent.js"; +export * from "./TerminalActionCreatedEventData.js"; +export * from "./TerminalActionCreatedEventObject.js"; +export * from "./TerminalActionQuery.js"; +export * from "./TerminalActionQueryFilter.js"; +export * from "./TerminalActionQuerySort.js"; +export * from "./TerminalActionUpdatedEvent.js"; +export * from "./TerminalActionUpdatedEventData.js"; +export * from "./TerminalActionUpdatedEventObject.js"; +export * from "./TerminalCheckout.js"; +export * from "./TerminalCheckoutCreatedEvent.js"; +export * from "./TerminalCheckoutCreatedEventData.js"; +export * from "./TerminalCheckoutCreatedEventObject.js"; +export * from "./TerminalCheckoutQuery.js"; +export * from "./TerminalCheckoutQueryFilter.js"; +export * from "./TerminalCheckoutQuerySort.js"; +export * from "./TerminalCheckoutUpdatedEvent.js"; +export * from "./TerminalCheckoutUpdatedEventData.js"; +export * from "./TerminalCheckoutUpdatedEventObject.js"; +export * from "./TerminalRefund.js"; +export * from "./TerminalRefundCreatedEvent.js"; +export * from "./TerminalRefundCreatedEventData.js"; +export * from "./TerminalRefundCreatedEventObject.js"; +export * from "./TerminalRefundQuery.js"; +export * from "./TerminalRefundQueryFilter.js"; +export * from "./TerminalRefundQuerySort.js"; +export * from "./TerminalRefundUpdatedEvent.js"; +export * from "./TerminalRefundUpdatedEventData.js"; +export * from "./TerminalRefundUpdatedEventObject.js"; +export * from "./TestWebhookSubscriptionResponse.js"; +export * from "./TimeRange.js"; +export * from "./Timecard.js"; +export * from "./TimecardFilter.js"; +export * from "./TimecardFilterStatus.js"; +export * from "./TimecardQuery.js"; +export * from "./TimecardSort.js"; +export * from "./TimecardSortField.js"; +export * from "./TimecardStatus.js"; +export * from "./TimecardWage.js"; +export * from "./TimecardWorkday.js"; +export * from "./TimecardWorkdayMatcher.js"; +export * from "./TipSettings.js"; +export * from "./Transaction.js"; +export * from "./TransactionProduct.js"; +export * from "./TransactionType.js"; +export * from "./UnlinkCustomerFromGiftCardResponse.js"; +export * from "./UpdateBookingCustomAttributeDefinitionResponse.js"; +export * from "./UpdateBookingResponse.js"; +export * from "./UpdateBreakTypeResponse.js"; +export * from "./UpdateCatalogImageRequest.js"; +export * from "./UpdateCatalogImageResponse.js"; +export * from "./UpdateCustomerCustomAttributeDefinitionResponse.js"; +export * from "./UpdateCustomerGroupResponse.js"; +export * from "./UpdateCustomerResponse.js"; +export * from "./UpdateInvoiceResponse.js"; +export * from "./UpdateItemModifierListsResponse.js"; +export * from "./UpdateItemTaxesResponse.js"; +export * from "./UpdateJobResponse.js"; +export * from "./UpdateLocationCustomAttributeDefinitionResponse.js"; +export * from "./UpdateLocationResponse.js"; +export * from "./UpdateLocationSettingsResponse.js"; +export * from "./UpdateMerchantCustomAttributeDefinitionResponse.js"; +export * from "./UpdateMerchantSettingsResponse.js"; +export * from "./UpdateOrderCustomAttributeDefinitionResponse.js"; +export * from "./UpdateOrderResponse.js"; +export * from "./UpdatePaymentLinkResponse.js"; +export * from "./UpdatePaymentResponse.js"; +export * from "./UpdateScheduledShiftResponse.js"; +export * from "./UpdateShiftResponse.js"; +export * from "./UpdateSubscriptionResponse.js"; +export * from "./UpdateTeamMemberRequest.js"; +export * from "./UpdateTeamMemberResponse.js"; +export * from "./UpdateTimecardResponse.js"; +export * from "./UpdateVendorRequest.js"; +export * from "./UpdateVendorResponse.js"; +export * from "./UpdateWageSettingResponse.js"; +export * from "./UpdateWebhookSubscriptionResponse.js"; +export * from "./UpdateWebhookSubscriptionSignatureKeyResponse.js"; +export * from "./UpdateWorkweekConfigResponse.js"; +export * from "./UpsertBookingCustomAttributeResponse.js"; +export * from "./UpsertCatalogObjectResponse.js"; +export * from "./UpsertCustomerCustomAttributeResponse.js"; +export * from "./UpsertLocationCustomAttributeResponse.js"; +export * from "./UpsertMerchantCustomAttributeResponse.js"; +export * from "./UpsertOrderCustomAttributeResponse.js"; +export * from "./UpsertSnippetResponse.js"; +export * from "./V1Money.js"; +export * from "./V1Order.js"; +export * from "./V1OrderHistoryEntry.js"; +export * from "./V1OrderHistoryEntryAction.js"; +export * from "./V1OrderState.js"; +export * from "./V1Tender.js"; +export * from "./V1TenderCardBrand.js"; +export * from "./V1TenderEntryMethod.js"; +export * from "./V1TenderType.js"; +export * from "./V1UpdateOrderRequestAction.js"; +export * from "./Vendor.js"; +export * from "./VendorContact.js"; +export * from "./VendorCreatedEvent.js"; +export * from "./VendorCreatedEventData.js"; +export * from "./VendorCreatedEventObject.js"; +export * from "./VendorCreatedEventObjectOperation.js"; +export * from "./VendorStatus.js"; +export * from "./VendorUpdatedEvent.js"; +export * from "./VendorUpdatedEventData.js"; +export * from "./VendorUpdatedEventObject.js"; +export * from "./VendorUpdatedEventObjectOperation.js"; +export * from "./VisibilityFilter.js"; +export * from "./VoidTransactionResponse.js"; +export * from "./WageSetting.js"; +export * from "./WebhookSubscription.js"; +export * from "./Weekday.js"; +export * from "./WorkweekConfig.js"; +export * from "./CatalogObjectItem.js"; +export * from "./CatalogObjectImage.js"; +export * from "./CatalogObjectItemVariation.js"; +export * from "./CatalogObjectTax.js"; +export * from "./CatalogObjectDiscount.js"; +export * from "./CatalogObjectModifierList.js"; +export * from "./CatalogObjectModifier.js"; +export * from "./CatalogObjectPricingRule.js"; +export * from "./CatalogObjectProductSet.js"; +export * from "./CatalogObjectTimePeriod.js"; +export * from "./CatalogObjectMeasurementUnit.js"; +export * from "./CatalogObjectSubscriptionPlanVariation.js"; +export * from "./CatalogObjectItemOption.js"; +export * from "./CatalogObjectItemOptionValue.js"; +export * from "./CatalogObjectCustomAttributeDefinition.js"; +export * from "./CatalogObjectQuickAmountsSettings.js"; +export * from "./CatalogObjectSubscriptionPlan.js"; +export * from "./CatalogObjectAvailabilityPeriod.js"; +export * from "./GetLoyaltyAccountRequest.js"; +export * from "./GetLoyaltyProgramRequest.js"; +export * from "./GetLoyaltyPromotionRequest.js"; +export * from "./GetLoyaltyRewardRequest.js"; +export * from "./GetCardRequest.js"; +export * from "./GetDisputeEvidenceRequest.js"; +export * from "./GetDisputeRequest.js"; +export * from "./V1GetPaymentRequest.js"; +export * from "./V1GetSettlementRequest.js"; +export * from "./GetCustomerGroupRequest.js"; +export * from "./GetCustomerRequest.js"; +export * from "./GetCustomerSegmentRequest.js"; +export * from "./GetTransactionRequest.js"; +export * from "./GetBookingRequest.js"; +export * from "./GetBusinessBookingProfileRequest.js"; +export * from "./GetTeamMemberBookingProfileRequest.js"; +export * from "./GetSnippetRequest.js"; +export * from "./GetInventoryAdjustmentRequest.js"; +export * from "./GetInventoryPhysicalCountRequest.js"; +export * from "./GetInventoryTransferRequest.js"; +export * from "./GetVendorRequest.js"; +export * from "./GetPaymentLinkRequest.js"; +export * from "./GetGiftCardRequest.js"; +export * from "./GetOrderRequest.js"; +export * from "./GetEmployeeRequest.js"; +export * from "./GetLocationRequest.js"; +export * from "./GetMerchantRequest.js"; +export * from "./GetTeamMemberRequest.js"; +export * from "./GetWageSettingRequest.js"; +export * from "./GetWebhookSubscriptionRequest.js"; diff --git a/src/core/auth/BasicAuth.ts b/src/core/auth/BasicAuth.ts index 146df2150..1c0d88351 100644 --- a/src/core/auth/BasicAuth.ts +++ b/src/core/auth/BasicAuth.ts @@ -1,4 +1,4 @@ -import { Base64 } from "js-base64"; +import { base64Decode, base64Encode } from "../base64.js"; export interface BasicAuth { username: string; @@ -12,12 +12,12 @@ export const BasicAuth = { if (basicAuth == null) { return undefined; } - const token = Base64.encode(`${basicAuth.username}:${basicAuth.password}`); + const token = base64Encode(`${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 decoded = base64Decode(credentials); const [username, password] = decoded.split(":", 2); if (username == null || password == null) { diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts index ee293b343..59c0fe7a7 100644 --- a/src/core/auth/index.ts +++ b/src/core/auth/index.ts @@ -1,2 +1,2 @@ -export { BasicAuth } from "./BasicAuth"; -export { BearerToken } from "./BearerToken"; +export { BasicAuth } from "./BasicAuth.js"; +export { BearerToken } from "./BearerToken.js"; diff --git a/src/core/base64.ts b/src/core/base64.ts new file mode 100644 index 000000000..448a0db63 --- /dev/null +++ b/src/core/base64.ts @@ -0,0 +1,27 @@ +function base64ToBytes(base64: string): Uint8Array { + const binString = atob(base64); + return Uint8Array.from(binString, (m) => m.codePointAt(0)!); +} + +function bytesToBase64(bytes: Uint8Array): string { + const binString = String.fromCodePoint(...bytes); + return btoa(binString); +} + +export function base64Encode(input: string): string { + if (typeof Buffer !== "undefined") { + return Buffer.from(input, "utf8").toString("base64"); + } + + const bytes = new TextEncoder().encode(input); + return bytesToBase64(bytes); +} + +export function base64Decode(input: string): string { + if (typeof Buffer !== "undefined") { + return Buffer.from(input, "base64").toString("utf8"); + } + + const bytes = base64ToBytes(input); + return new TextDecoder().decode(bytes); +} diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts index 3664d09e1..dd4b94666 100644 --- a/src/core/fetcher/APIResponse.ts +++ b/src/core/fetcher/APIResponse.ts @@ -1,12 +1,23 @@ +import { RawResponse } from "./RawResponse.js"; + +/** + * The response of an API call. + * It is a successful response or a failed response. + */ export type APIResponse = SuccessfulResponse | FailedResponse; export interface SuccessfulResponse { ok: true; body: T; + /** + * @deprecated Use `rawResponse` instead + */ headers?: Record; + rawResponse: RawResponse; } export interface FailedResponse { ok: false; error: T; + rawResponse: RawResponse; } diff --git a/src/core/fetcher/BinaryResponse.ts b/src/core/fetcher/BinaryResponse.ts new file mode 100644 index 000000000..614cb59b1 --- /dev/null +++ b/src/core/fetcher/BinaryResponse.ts @@ -0,0 +1,36 @@ +import { ResponseWithBody } from "./ResponseWithBody.js"; + +export type BinaryResponse = { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ + bodyUsed: boolean; + /** + * Returns a ReadableStream of the response body. + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) + */ + stream: () => ReadableStream; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ + arrayBuffer: () => Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ + blob: () => Promise; + /** + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) + * Some versions of the Fetch API may not support this method. + */ + bytes?(): Promise; +}; + +export function getBinaryResponse(response: ResponseWithBody): BinaryResponse { + const binaryResponse: BinaryResponse = { + get bodyUsed() { + return response.bodyUsed; + }, + stream: () => response.body, + arrayBuffer: response.arrayBuffer.bind(response), + blob: response.blob.bind(response), + }; + if ("bytes" in response && typeof response.bytes === "function") { + binaryResponse.bytes = response.bytes.bind(response); + } + + return binaryResponse; +} diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index f3ee18ee8..dd9a40fe8 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,11 +1,14 @@ -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"; +import { toJson } from "../json.js"; +import { APIResponse } from "./APIResponse.js"; +import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; +import { Supplier } from "./Supplier.js"; +import { createRequestUrl } from "./createRequestUrl.js"; +import { getErrorResponseBody } from "./getErrorResponseBody.js"; +import { getFetchFn } from "./getFetchFn.js"; +import { getRequestBody } from "./getRequestBody.js"; +import { getResponseBody } from "./getResponseBody.js"; +import { makeRequest } from "./makeRequest.js"; +import { requestWithRetries } from "./requestWithRetries.js"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -14,7 +17,7 @@ export declare namespace Fetcher { url: string; method: string; contentType?: string; - headers?: Record; + headers?: Record | undefined>; queryParameters?: Record; body?: unknown; timeoutMs?: number; @@ -22,7 +25,7 @@ export declare namespace Fetcher { withCredentials?: boolean; abortSignal?: AbortSignal; requestType?: "json" | "file" | "bytes"; - responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer"; + responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response"; duplex?: "half"; } @@ -50,20 +53,31 @@ export declare namespace Fetcher { } } -export async function fetcherImpl(args: Fetcher.Args): Promise> { - const headers: Record = {}; +async function getHeaders(args: Fetcher.Args): Promise> { + const newHeaders: Record = {}; if (args.body !== undefined && args.contentType != null) { - headers["Content-Type"] = args.contentType; + newHeaders["Content-Type"] = args.contentType; + } + + if (args.headers == null) { + return newHeaders; } - if (args.headers != null) { - for (const [key, value] of Object.entries(args.headers)) { - if (value != null) { - headers[key] = value; - } + for (const [key, value] of Object.entries(args.headers)) { + const result = await Supplier.get(value); + if (typeof result === "string") { + newHeaders[key] = result; + continue; } + if (result == null) { + continue; + } + newHeaders[key] = `${result}`; } + return newHeaders; +} +export async function fetcherImpl(args: Fetcher.Args): Promise> { const url = createRequestUrl(args.url, args.queryParameters); const requestBody: BodyInit | undefined = await getRequestBody({ body: args.body, @@ -78,7 +92,7 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise= 200 && response.status < 400) { return { ok: true, - body: responseBody as R, + body: (await getResponseBody(response, args.responseType)) as R, headers: response.headers, + rawResponse: toRawResponse(response), }; } else { return { @@ -101,8 +115,9 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise; + + constructor(init?: HeadersInit) { + this.headers = new Map(); + + if (init) { + if (init instanceof Headers) { + init.forEach((value, key) => this.append(key, value)); + } else if (Array.isArray(init)) { + for (const [key, value] of init) { + if (typeof key === "string" && typeof value === "string") { + this.append(key, value); + } else { + throw new TypeError("Each header entry must be a [string, string] tuple"); + } + } + } else { + for (const [key, value] of Object.entries(init)) { + if (typeof value === "string") { + this.append(key, value); + } else { + throw new TypeError("Header values must be strings"); + } + } + } + } + } + + append(name: string, value: string): void { + const key = name.toLowerCase(); + const existing = this.headers.get(key) || []; + this.headers.set(key, [...existing, value]); + } + + delete(name: string): void { + const key = name.toLowerCase(); + this.headers.delete(key); + } + + get(name: string): string | null { + const key = name.toLowerCase(); + const values = this.headers.get(key); + return values ? values.join(", ") : null; + } + + has(name: string): boolean { + const key = name.toLowerCase(); + return this.headers.has(key); + } + + set(name: string, value: string): void { + const key = name.toLowerCase(); + this.headers.set(key, [value]); + } + + forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: unknown): void { + const boundCallback = thisArg ? callbackfn.bind(thisArg) : callbackfn; + this.headers.forEach((values, key) => boundCallback(values.join(", "), key, this)); + } + + getSetCookie(): string[] { + return this.headers.get("set-cookie") || []; + } + + *entries(): HeadersIterator<[string, string]> { + for (const [key, values] of this.headers.entries()) { + yield [key, values.join(", ")]; + } + } + + *keys(): HeadersIterator { + yield* this.headers.keys(); + } + + *values(): HeadersIterator { + for (const values of this.headers.values()) { + yield values.join(", "); + } + } + + [Symbol.iterator](): HeadersIterator<[string, string]> { + return this.entries(); + } + }; +} + +export { Headers }; diff --git a/src/core/fetcher/HttpResponsePromise.ts b/src/core/fetcher/HttpResponsePromise.ts new file mode 100644 index 000000000..026d88f19 --- /dev/null +++ b/src/core/fetcher/HttpResponsePromise.ts @@ -0,0 +1,116 @@ +import { WithRawResponse } from "./RawResponse.js"; + +/** + * A promise that returns the parsed response and lets you retrieve the raw response too. + */ +export class HttpResponsePromise extends Promise { + private innerPromise: Promise>; + private unwrappedPromise: Promise | undefined; + + private constructor(promise: Promise>) { + // Initialize with a no-op to avoid premature parsing + super((resolve) => { + resolve(undefined as unknown as T); + }); + this.innerPromise = promise; + } + + /** + * Creates an `HttpResponsePromise` from a function that returns a promise. + * + * @param fn - A function that returns a promise resolving to a `WithRawResponse` object. + * @param args - Arguments to pass to the function. + * @returns An `HttpResponsePromise` instance. + */ + public static fromFunction Promise>, T>( + fn: F, + ...args: Parameters + ): HttpResponsePromise { + return new HttpResponsePromise(fn(...args)); + } + + /** + * Creates a function that returns an `HttpResponsePromise` from a function that returns a promise. + * + * @param fn - A function that returns a promise resolving to a `WithRawResponse` object. + * @returns A function that returns an `HttpResponsePromise` instance. + */ + public static interceptFunction< + F extends (...args: never[]) => Promise>, + T = Awaited>["data"], + >(fn: F): (...args: Parameters) => HttpResponsePromise { + return (...args: Parameters): HttpResponsePromise => { + return HttpResponsePromise.fromPromise(fn(...args)); + }; + } + + /** + * Creates an `HttpResponsePromise` from an existing promise. + * + * @param promise - A promise resolving to a `WithRawResponse` object. + * @returns An `HttpResponsePromise` instance. + */ + public static fromPromise(promise: Promise>): HttpResponsePromise { + return new HttpResponsePromise(promise); + } + + /** + * Creates an `HttpResponsePromise` from an executor function. + * + * @param executor - A function that takes resolve and reject callbacks to create a promise. + * @returns An `HttpResponsePromise` instance. + */ + public static fromExecutor( + executor: (resolve: (value: WithRawResponse) => void, reject: (reason?: unknown) => void) => void, + ): HttpResponsePromise { + const promise = new Promise>(executor); + return new HttpResponsePromise(promise); + } + + /** + * Creates an `HttpResponsePromise` from a resolved result. + * + * @param result - A `WithRawResponse` object to resolve immediately. + * @returns An `HttpResponsePromise` instance. + */ + public static fromResult(result: WithRawResponse): HttpResponsePromise { + const promise = Promise.resolve(result); + return new HttpResponsePromise(promise); + } + + private unwrap(): Promise { + if (!this.unwrappedPromise) { + this.unwrappedPromise = this.innerPromise.then(({ data }) => data); + } + return this.unwrappedPromise; + } + + /** @inheritdoc */ + public override then( + onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null, + ): Promise { + return this.unwrap().then(onfulfilled, onrejected); + } + + /** @inheritdoc */ + public override catch( + onrejected?: ((reason: unknown) => TResult | PromiseLike) | null, + ): Promise { + return this.unwrap().catch(onrejected); + } + + /** @inheritdoc */ + public override finally(onfinally?: (() => void) | null): Promise { + return this.unwrap().finally(onfinally); + } + + /** + * Retrieves the data and raw response. + * + * @returns A promise resolving to a `WithRawResponse` object. + */ + public async withRawResponse(): Promise> { + return await this.innerPromise; + } +} diff --git a/src/core/fetcher/RawResponse.ts b/src/core/fetcher/RawResponse.ts new file mode 100644 index 000000000..37fb44e2a --- /dev/null +++ b/src/core/fetcher/RawResponse.ts @@ -0,0 +1,61 @@ +import { Headers } from "./Headers.js"; + +/** + * The raw response from the fetch call excluding the body. + */ +export type RawResponse = Omit< + { + [K in keyof Response as Response[K] extends Function ? never : K]: Response[K]; // strips out functions + }, + "ok" | "body" | "bodyUsed" +>; // strips out body and bodyUsed + +/** + * A raw response indicating that the request was aborted. + */ +export const abortRawResponse: RawResponse = { + headers: new Headers(), + redirected: false, + status: 499, + statusText: "Client Closed Request", + type: "error", + url: "", +} as const; + +/** + * A raw response indicating an unknown error. + */ +export const unknownRawResponse: RawResponse = { + headers: new Headers(), + redirected: false, + status: 0, + statusText: "Unknown Error", + type: "error", + url: "", +} as const; + +/** + * Converts a `RawResponse` object into a `RawResponse` by extracting its properties, + * excluding the `body` and `bodyUsed` fields. + * + * @param response - The `RawResponse` object to convert. + * @returns A `RawResponse` object containing the extracted properties of the input response. + */ +export function toRawResponse(response: Response): RawResponse { + return { + headers: response.headers, + redirected: response.redirected, + status: response.status, + statusText: response.statusText, + type: response.type, + url: response.url, + }; +} + +/** + * Creates a `RawResponse` from a standard `Response` object. + */ +export interface WithRawResponse { + readonly data: T; + readonly rawResponse: RawResponse; +} diff --git a/src/core/fetcher/ResponseWithBody.ts b/src/core/fetcher/ResponseWithBody.ts new file mode 100644 index 000000000..445d40f87 --- /dev/null +++ b/src/core/fetcher/ResponseWithBody.ts @@ -0,0 +1,7 @@ +export type ResponseWithBody = Response & { + body: ReadableStream; +}; + +export function isResponseWithBody(response: Response): response is ResponseWithBody { + return (response as ResponseWithBody).body != null; +} diff --git a/src/core/fetcher/createRequestUrl.ts b/src/core/fetcher/createRequestUrl.ts index f1157ce72..88e13265e 100644 --- a/src/core/fetcher/createRequestUrl.ts +++ b/src/core/fetcher/createRequestUrl.ts @@ -1,10 +1,6 @@ -import qs from "qs"; +import { toQueryString } from "../url/qs.js"; -export function createRequestUrl( - baseUrl: string, - queryParameters?: Record, -): string { - return Object.keys(queryParameters ?? {}).length > 0 - ? `${baseUrl}?${qs.stringify(queryParameters, { arrayFormat: "repeat" })}` - : baseUrl; +export function createRequestUrl(baseUrl: string, queryParameters?: Record): string { + const queryString = toQueryString(queryParameters, { arrayFormat: "repeat" }); + return queryString ? `${baseUrl}?${queryString}` : baseUrl; } diff --git a/src/core/fetcher/getErrorResponseBody.ts b/src/core/fetcher/getErrorResponseBody.ts new file mode 100644 index 000000000..450424bd6 --- /dev/null +++ b/src/core/fetcher/getErrorResponseBody.ts @@ -0,0 +1,32 @@ +import { fromJson } from "../json.js"; +import { getResponseBody } from "./getResponseBody.js"; + +export async function getErrorResponseBody(response: Response): Promise { + let contentType = response.headers.get("Content-Type")?.toLowerCase(); + if (contentType == null || contentType.length === 0) { + return getResponseBody(response); + } + + if (contentType.indexOf(";") !== -1) { + contentType = contentType.split(";")[0]?.trim() ?? ""; + } + switch (contentType) { + case "application/hal+json": + case "application/json": + case "application/ld+json": + case "application/problem+json": + case "application/vnd.api+json": + case "text/json": + const text = await response.text(); + return text.length > 0 ? fromJson(text) : undefined; + default: + if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) { + const text = await response.text(); + return text.length > 0 ? fromJson(text) : undefined; + } + + // Fallback to plain text if content type is not recognized + // Even if no body is present, the response will be an empty string + return await response.text(); + } +} diff --git a/src/core/fetcher/getFetchFn.ts b/src/core/fetcher/getFetchFn.ts index 9fd9bfc42..9f845b956 100644 --- a/src/core/fetcher/getFetchFn.ts +++ b/src/core/fetcher/getFetchFn.ts @@ -1,25 +1,3 @@ -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; +export async function getFetchFn(): Promise { + return fetch; } diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts index fce5589c5..e38457c54 100644 --- a/src/core/fetcher/getRequestBody.ts +++ b/src/core/fetcher/getRequestBody.ts @@ -1,4 +1,4 @@ -import { toJson } from "../json"; +import { toJson } from "../json.js"; export declare namespace GetRequestBody { interface Args { diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts index d046e6ea2..7ca8b3d2d 100644 --- a/src/core/fetcher/getResponseBody.ts +++ b/src/core/fetcher/getResponseBody.ts @@ -1,34 +1,43 @@ -import { chooseStreamWrapper } from "./stream-wrappers/chooseStreamWrapper"; +import { getBinaryResponse } from "./BinaryResponse.js"; +import { isResponseWithBody } from "./ResponseWithBody.js"; +import { fromJson } from "../json.js"; 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; + if (!isResponseWithBody(response)) { + return undefined; + } + switch (responseType) { + case "binary-response": + return getBinaryResponse(response); + case "blob": + return await response.blob(); + case "arrayBuffer": + return await response.arrayBuffer(); + case "sse": + return response.body; + case "streaming": + return response.body; + + case "text": + return await response.text(); + } + + // if responseType is "json" or not specified, try to parse as JSON + const text = await response.text(); + if (text.length > 0) { + try { + let responseBody = fromJson(text); + return responseBody; + } catch (err) { + return { + ok: false, + error: { + reason: "non-json", + statusCode: response.status, + rawBody: text, + }, + }; } } + return undefined; } diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts index 2d658ca48..49e13932e 100644 --- a/src/core/fetcher/index.ts +++ b/src/core/fetcher/index.ts @@ -1,5 +1,9 @@ -export type { APIResponse } from "./APIResponse"; -export { fetcher } from "./Fetcher"; -export type { Fetcher, FetchFunction } from "./Fetcher"; -export { getHeader } from "./getHeader"; -export { Supplier } from "./Supplier"; +export type { APIResponse } from "./APIResponse.js"; +export { fetcher } from "./Fetcher.js"; +export type { Fetcher, FetchFunction } from "./Fetcher.js"; +export { getHeader } from "./getHeader.js"; +export { Supplier } from "./Supplier.js"; +export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; +export type { RawResponse, WithRawResponse } from "./RawResponse.js"; +export { HttpResponsePromise } from "./HttpResponsePromise.js"; +export { BinaryResponse } from "./BinaryResponse.js"; diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts index 1af42bb9f..1a5ffd3c0 100644 --- a/src/core/fetcher/makeRequest.ts +++ b/src/core/fetcher/makeRequest.ts @@ -1,4 +1,4 @@ -import { anySignal, getTimeoutSignal } from "./signals"; +import { anySignal, getTimeoutSignal } from "./signals.js"; export const makeRequest = async ( fetchFn: (url: string, init: RequestInit) => Promise, diff --git a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts deleted file mode 100644 index 6f1a82e96..000000000 --- a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +++ /dev/null @@ -1,257 +0,0 @@ -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 deleted file mode 100644 index 23c01a1a7..000000000 --- a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +++ /dev/null @@ -1,107 +0,0 @@ -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 deleted file mode 100644 index 091e2a7f3..000000000 --- a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +++ /dev/null @@ -1,243 +0,0 @@ -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 deleted file mode 100644 index 8c7492fc8..000000000 --- a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +++ /dev/null @@ -1,34 +0,0 @@ -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/file.ts b/src/core/file.ts new file mode 100644 index 000000000..57e7539db --- /dev/null +++ b/src/core/file.ts @@ -0,0 +1,11 @@ +export type FileLike = + | ArrayBuffer + | Uint8Array + | import("buffer").Buffer + | import("buffer").Blob + | import("buffer").File + | import("stream").Readable + | import("stream/web").ReadableStream + | globalThis.Blob + | globalThis.File + | ReadableStream; diff --git a/src/core/form-data-utils/FormDataWrapper.ts b/src/core/form-data-utils/FormDataWrapper.ts index ad0d90dc1..fa1ca9b95 100644 --- a/src/core/form-data-utils/FormDataWrapper.ts +++ b/src/core/form-data-utils/FormDataWrapper.ts @@ -1,177 +1,176 @@ -import { RUNTIME } from "../runtime"; +import { toJson } from "../../core/json.js"; +import { RUNTIME } from "../runtime/index.js"; -export type MaybePromise = Promise | T; +type NamedValue = { + name: string; +} & unknown; -interface FormDataRequest { - body: Body; - headers: Record; - duplex?: "half"; -} +type PathedValue = { + path: string | { toString(): string }; +} & unknown; + +type StreamLike = { + read?: () => unknown; + pipe?: (dest: unknown) => unknown; +} & unknown; -function isNamedValue(value: unknown): value is { name: string } { +function isNamedValue(value: unknown): value is NamedValue { return typeof value === "object" && value != null && "name" in value; } -export interface CrossPlatformFormData { - setup(): Promise; +function isPathedValue(value: unknown): value is PathedValue { + return typeof value === "object" && value != null && "path" in value; +} - append(key: string, value: unknown): void; +function isStreamLike(value: unknown): value is StreamLike { + return typeof value === "object" && value != null && ("read" in value || "pipe" in value); +} - appendFile(key: string, value: unknown, fileName?: string): Promise; +function isReadableStream(value: unknown): value is ReadableStream { + return typeof value === "object" && value != null && "getReader" in value; +} - getRequest(): MaybePromise>; +function isBuffer(value: unknown): value is Buffer { + return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value); } -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; +function isArrayBufferView(value: unknown): value is ArrayBufferView { + return ArrayBuffer.isView(value); } -export type Node18FormDataFd = - | { - append(name: string, value: unknown, fileName?: string): void; - } - | undefined; +interface FormDataRequest { + body: Body; + headers: Record; + duplex?: "half"; +} -/** - * Form Data Implementation for Node.js 18+ - */ -export class Node18FormData implements CrossPlatformFormData { - private fd: Node18FormDataFd; +function getLastPathSegment(pathStr: string): string { + const lastForwardSlash = pathStr.lastIndexOf("/"); + const lastBackSlash = pathStr.lastIndexOf("\\"); + const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash); + return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr; +} - public async setup() { - this.fd = new (await import("formdata-node")).FormData(); - } +async function streamToBuffer(stream: unknown): Promise { + if (RUNTIME.type === "node") { + const { Readable } = await import("stream"); - public append(key: string, value: any): void { - this.fd?.append(key, value); + if (stream instanceof Readable) { + const chunks: Buffer[] = []; + for await (const chunk of stream) { + chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)); + } + return Buffer.concat(chunks); + } } - public async appendFile(key: string, value: unknown, fileName?: string): Promise { - if (fileName == null && isNamedValue(value)) { - fileName = value.name; + if (isReadableStream(stream)) { + const reader = stream.getReader(); + const chunks: Uint8Array[] = []; + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + chunks.push(value); + } + } finally { + reader.releaseLock(); } - 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; - }, - }); + const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0); + const result = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks) { + result.set(chunk, offset); + offset += chunk.length; } - } - 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", - }; + return Buffer.from(result); } + + throw new Error( + "Unsupported stream type: " + typeof stream + ". Expected Node.js Readable stream or Web ReadableStream.", + ); } -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; +export async function newFormData(): Promise { + return new FormDataWrapper(); +} + +export class FormDataWrapper { + private fd: FormData = new FormData(); public async setup(): Promise { - this.fd = new (await import("form-data")).default(); + // noop } - public append(key: string, value: any): void { - this.fd?.append(key, value); + public append(key: string, value: unknown): void { + this.fd.append(key, String(value)); } - public async appendFile(key: string, value: unknown, fileName?: string): Promise { - if (fileName == null && isNamedValue(value)) { - fileName = value.name; + private getFileName(value: unknown, filename?: string): string | undefined { + if (filename != null) { + return filename; + } + if (isNamedValue(value)) { + return value.name; + } + if (isPathedValue(value) && value.path) { + return getLastPathSegment(value.path.toString()); + } + return undefined; + } + + private async convertToBlob(value: unknown): Promise { + if (isStreamLike(value) || isReadableStream(value)) { + const buffer = await streamToBuffer(value); + return new Blob([buffer]); } - let bufferedValue; if (value instanceof Blob) { - bufferedValue = Buffer.from(await (value as any).arrayBuffer()); - } else { - bufferedValue = value; + return value; } - if (fileName == null) { - this.fd?.append(key, bufferedValue); - } else { - this.fd?.append(key, bufferedValue, { filename: fileName }); + if (isBuffer(value)) { + return new Blob([value]); } - } - public getRequest(): FormDataRequest { - return { - body: this.fd, - headers: this.fd ? this.fd.getHeaders() : {}, - }; - } -} + if (value instanceof ArrayBuffer) { + return new Blob([value]); + } + + if (isArrayBufferView(value)) { + return new Blob([value]); + } -export type WebFormDataFd = { append(name: string, value: string | Blob, fileName?: string): void } | undefined; + if (typeof value === "string") { + return new Blob([value]); + } -/** - * Form Data Implementation for Web - */ -export class WebFormData implements CrossPlatformFormData { - protected fd: WebFormDataFd; + if (typeof value === "object" && value !== null) { + return new Blob([toJson(value)], { type: "application/json" }); + } - public async setup(): Promise { - this.fd = new FormData(); + return new Blob([String(value)]); } - public append(key: string, value: any): void { - this.fd?.append(key, value); - } + public async appendFile(key: string, value: unknown, fileName?: string): Promise { + fileName = this.getFileName(value, fileName); + const blob = await this.convertToBlob(value); - public async appendFile(key: string, value: any, fileName?: string): Promise { - if (fileName == null && isNamedValue(value)) { - fileName = value.name; + if (fileName) { + this.fd.append(key, blob, fileName); + } else { + this.fd.append(key, blob); } - this.fd?.append(key, new Blob([value]), fileName); } - public getRequest(): FormDataRequest { + public getRequest(): FormDataRequest { return { body: this.fd, headers: {}, + duplex: "half" as const, }; } } diff --git a/src/core/form-data-utils/encodeAsFormParameter.ts b/src/core/form-data-utils/encodeAsFormParameter.ts new file mode 100644 index 000000000..cfc67413a --- /dev/null +++ b/src/core/form-data-utils/encodeAsFormParameter.ts @@ -0,0 +1,12 @@ +import { toQueryString } from "../url/qs.js"; + +export function encodeAsFormParameter(value: unknown): Record { + const stringified = toQueryString(value, { encode: false }); + + const keyValuePairs = stringified.split("&").map((pair) => { + const [key, value] = pair.split("="); + return [key, value] as const; + }); + + return Object.fromEntries(keyValuePairs); +} diff --git a/src/core/form-data-utils/index.ts b/src/core/form-data-utils/index.ts index f210ac408..1188f80cb 100644 --- a/src/core/form-data-utils/index.ts +++ b/src/core/form-data-utils/index.ts @@ -1 +1,2 @@ -export * from "./FormDataWrapper"; +export { encodeAsFormParameter } from "./encodeAsFormParameter.js"; +export * from "./FormDataWrapper.js"; diff --git a/src/core/headers.ts b/src/core/headers.ts new file mode 100644 index 000000000..561314d2c --- /dev/null +++ b/src/core/headers.ts @@ -0,0 +1,35 @@ +import * as core from "./index.js"; + +export function mergeHeaders( + ...headersArray: (Record | undefined> | undefined)[] +): Record> { + const result: Record> = {}; + + for (const [key, value] of headersArray + .filter((headers) => headers != null) + .flatMap((headers) => Object.entries(headers))) { + if (value != null) { + result[key] = value; + } else if (key in result) { + delete result[key]; + } + } + + return result; +} + +export function mergeOnlyDefinedHeaders( + ...headersArray: (Record | undefined> | undefined)[] +): Record> { + const result: Record> = {}; + + for (const [key, value] of headersArray + .filter((headers) => headers != null) + .flatMap((headers) => Object.entries(headers))) { + if (value != null) { + result[key] = value; + } + } + + return result; +} diff --git a/src/core/json.ts b/src/core/json.ts index ddc9d2dc6..cca884d32 100644 --- a/src/core/json.ts +++ b/src/core/json.ts @@ -18,7 +18,10 @@ export const toJson = ( replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number, ): string => { - if (!data) { + if (typeof data === "bigint") { + return data.toString(); + } + if (typeof data !== "object") { return JSON.stringify(data, replacer, space); } diff --git a/src/core/pagination/Page.ts b/src/core/pagination/Page.ts index 07c6796ee..307989ef8 100644 --- a/src/core/pagination/Page.ts +++ b/src/core/pagination/Page.ts @@ -1,3 +1,5 @@ +import { HttpResponsePromise, RawResponse } from "../fetcher/index.js"; + /** * A page of results from a paginated API. * @@ -5,24 +7,28 @@ */ export class Page implements AsyncIterable { public data: T[]; + public rawResponse: RawResponse; private response: unknown; private _hasNextPage: (response: unknown) => boolean; private getItems: (response: unknown) => T[]; - private loadNextPage: (response: unknown) => Promise; + private loadNextPage: (response: unknown) => HttpResponsePromise; constructor({ response, + rawResponse, hasNextPage, getItems, loadPage, }: { response: unknown; + rawResponse: RawResponse; hasNextPage: (response: unknown) => boolean; getItems: (response: unknown) => T[]; - loadPage: (response: unknown) => Promise; + loadPage: (response: unknown) => HttpResponsePromise; }) { this.response = response; + this.rawResponse = rawResponse; this.data = getItems(response); this._hasNextPage = hasNextPage; this.getItems = getItems; @@ -34,7 +40,9 @@ export class Page implements AsyncIterable { * @returns this */ public async getNextPage(): Promise { - this.response = await this.loadNextPage(this.response); + const { data, rawResponse } = await this.loadNextPage(this.response).withRawResponse(); + this.response = data; + this.rawResponse = rawResponse; this.data = this.getItems(this.response); return this; } diff --git a/src/core/pagination/Pageable.ts b/src/core/pagination/Pageable.ts index befce6359..faec86424 100644 --- a/src/core/pagination/Pageable.ts +++ b/src/core/pagination/Pageable.ts @@ -1,8 +1,10 @@ -import { Page } from "./Page"; +import { RawResponse } from "../fetcher/index.js"; +import { Page } from "./Page.js"; export declare namespace Pageable { interface Args { response: Response; + rawResponse: RawResponse; hasNextPage: (response: Response) => boolean; getItems: (response: Response) => Item[]; loadPage: (response: Response) => Promise; diff --git a/src/core/pagination/index.ts b/src/core/pagination/index.ts index 2ceb26844..b0cd68fa0 100644 --- a/src/core/pagination/index.ts +++ b/src/core/pagination/index.ts @@ -1,2 +1,2 @@ -export { Page } from "./Page"; -export { Pageable } from "./Pageable"; +export { Page } from "./Page.js"; +export { Pageable } from "./Pageable.js"; diff --git a/src/core/runtime/index.ts b/src/core/runtime/index.ts index 5c76dbb13..cfab23f9a 100644 --- a/src/core/runtime/index.ts +++ b/src/core/runtime/index.ts @@ -1 +1 @@ -export { RUNTIME } from "./runtime"; +export { RUNTIME } from "./runtime.js"; diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index a97501751..08fd2563f 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -11,6 +11,9 @@ interface BunGlobal { declare const Deno: DenoGlobal | undefined; declare const Bun: BunGlobal | undefined; declare const EdgeRuntime: string | undefined; +declare const self: typeof globalThis.self & { + importScripts?: unknown; +}; /** * A constant that indicates which environment and version the SDK is running in. @@ -62,7 +65,6 @@ function evaluateRuntime(): Runtime { */ const isWebWorker = typeof self === "object" && - // @ts-ignore typeof self?.importScripts === "function" && (self.constructor?.name === "DedicatedWorkerGlobalScope" || self.constructor?.name === "ServiceWorkerGlobalScope" || diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts deleted file mode 100644 index 921a15466..000000000 --- a/src/core/schemas/Schema.ts +++ /dev/null @@ -1,101 +0,0 @@ -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 deleted file mode 100644 index e69bb791e..000000000 --- a/src/core/schemas/builders/bigint/bigint.ts +++ /dev/null @@ -1,55 +0,0 @@ -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 deleted file mode 100644 index e5843043f..000000000 --- a/src/core/schemas/builders/bigint/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { bigint } from "./bigint"; diff --git a/src/core/schemas/builders/date/date.ts b/src/core/schemas/builders/date/date.ts deleted file mode 100644 index b70f24b04..000000000 --- a/src/core/schemas/builders/date/date.ts +++ /dev/null @@ -1,65 +0,0 @@ -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 deleted file mode 100644 index 187b29040..000000000 --- a/src/core/schemas/builders/date/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { date } from "./date"; diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts deleted file mode 100644 index 69aced6be..000000000 --- a/src/core/schemas/builders/enum/enum.ts +++ /dev/null @@ -1,43 +0,0 @@ -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 deleted file mode 100644 index fe6faed93..000000000 --- a/src/core/schemas/builders/enum/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { enum_ } from "./enum"; diff --git a/src/core/schemas/builders/index.ts b/src/core/schemas/builders/index.ts deleted file mode 100644 index 65211f925..000000000 --- a/src/core/schemas/builders/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index 77420fb03..000000000 --- a/src/core/schemas/builders/lazy/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 2962bdfe0..000000000 --- a/src/core/schemas/builders/lazy/lazy.ts +++ /dev/null @@ -1,32 +0,0 @@ -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 deleted file mode 100644 index d8ee6ec5d..000000000 --- a/src/core/schemas/builders/lazy/lazyObject.ts +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index 25f4bcc17..000000000 --- a/src/core/schemas/builders/list/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { list } from "./list"; diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts deleted file mode 100644 index a6167a5be..000000000 --- a/src/core/schemas/builders/list/list.ts +++ /dev/null @@ -1,73 +0,0 @@ -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 deleted file mode 100644 index 5c004133d..000000000 --- a/src/core/schemas/builders/literals/booleanLiteral.ts +++ /dev/null @@ -1,29 +0,0 @@ -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 deleted file mode 100644 index d2bf08fc6..000000000 --- a/src/core/schemas/builders/literals/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 334bbdc46..000000000 --- a/src/core/schemas/builders/literals/stringLiteral.ts +++ /dev/null @@ -1,29 +0,0 @@ -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 deleted file mode 100644 index 8885586e2..000000000 --- a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts +++ /dev/null @@ -1,79 +0,0 @@ -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 deleted file mode 100644 index c342e72cf..000000000 --- a/src/core/schemas/builders/object-like/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 75b369872..000000000 --- a/src/core/schemas/builders/object-like/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index e3f4388db..000000000 --- a/src/core/schemas/builders/object/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index 05fbca8a1..000000000 --- a/src/core/schemas/builders/object/object.ts +++ /dev/null @@ -1,366 +0,0 @@ -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 deleted file mode 100644 index ce4d3edca..000000000 --- a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index fa9a9be84..000000000 --- a/src/core/schemas/builders/object/property.ts +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index b4f49c884..000000000 --- a/src/core/schemas/builders/object/types.ts +++ /dev/null @@ -1,58 +0,0 @@ -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 deleted file mode 100644 index fcaeb0425..000000000 --- a/src/core/schemas/builders/primitives/any.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 2b5598810..000000000 --- a/src/core/schemas/builders/primitives/boolean.ts +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 788f9416b..000000000 --- a/src/core/schemas/builders/primitives/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 3d6be6ff7..000000000 --- a/src/core/schemas/builders/primitives/number.ts +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index e09aceeca..000000000 --- a/src/core/schemas/builders/primitives/string.ts +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 4d5249571..000000000 --- a/src/core/schemas/builders/primitives/unknown.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 82e25c5c2..000000000 --- a/src/core/schemas/builders/record/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index eb3e9a999..000000000 --- a/src/core/schemas/builders/record/record.ts +++ /dev/null @@ -1,129 +0,0 @@ -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 deleted file mode 100644 index fec431d43..000000000 --- a/src/core/schemas/builders/record/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100644 index 2b89ca0e7..000000000 --- a/src/core/schemas/builders/schema-utils/JsonError.ts +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index d056eb45c..000000000 --- a/src/core/schemas/builders/schema-utils/ParseError.ts +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index d5e7a955d..000000000 --- a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts +++ /dev/null @@ -1,181 +0,0 @@ -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 deleted file mode 100644 index aa04e051d..000000000 --- a/src/core/schemas/builders/schema-utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 4160f0a26..000000000 --- a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index f3310e8bd..000000000 --- a/src/core/schemas/builders/set/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { set } from "./set"; diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts deleted file mode 100644 index e9e6bb7e5..000000000 --- a/src/core/schemas/builders/set/set.ts +++ /dev/null @@ -1,43 +0,0 @@ -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 deleted file mode 100644 index 75b71cb35..000000000 --- a/src/core/schemas/builders/undiscriminated-union/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 4f0888aaf..000000000 --- a/src/core/schemas/builders/undiscriminated-union/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index a5cf01fa5..000000000 --- a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +++ /dev/null @@ -1,60 +0,0 @@ -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 deleted file mode 100644 index 73cd62ade..000000000 --- a/src/core/schemas/builders/union/discriminant.ts +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index 85fc008a2..000000000 --- a/src/core/schemas/builders/union/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index 7ac9d16d6..000000000 --- a/src/core/schemas/builders/union/types.ts +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index afdd5a1f5..000000000 --- a/src/core/schemas/builders/union/union.ts +++ /dev/null @@ -1,170 +0,0 @@ -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 deleted file mode 100644 index 5429d8b43..000000000 --- a/src/core/schemas/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 9cd354b34..000000000 --- a/src/core/schemas/utils/MaybePromise.ts +++ /dev/null @@ -1 +0,0 @@ -export type MaybePromise = T | Promise; diff --git a/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts deleted file mode 100644 index 59f9e6588..000000000 --- a/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index 4db71be4a..000000000 --- a/src/core/schemas/utils/createIdentitySchemaCreator.ts +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 2d5c93d65..000000000 --- a/src/core/schemas/utils/entries.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 70527d100..000000000 --- a/src/core/schemas/utils/filterObject.ts +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index 1a5c31027..000000000 --- a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index db82a722c..000000000 --- a/src/core/schemas/utils/isPlainObject.ts +++ /dev/null @@ -1,17 +0,0 @@ -// 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 deleted file mode 100644 index 2e0930e2d..000000000 --- a/src/core/schemas/utils/keys.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 950d5f9c5..000000000 --- a/src/core/schemas/utils/maybeSkipValidation.ts +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index f58d6f3d3..000000000 --- a/src/core/schemas/utils/partition.ts +++ /dev/null @@ -1,12 +0,0 @@ -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/url/index.ts b/src/core/url/index.ts new file mode 100644 index 000000000..ed5aa0ff0 --- /dev/null +++ b/src/core/url/index.ts @@ -0,0 +1,2 @@ +export { join } from "./join.js"; +export { toQueryString } from "./qs.js"; diff --git a/src/core/url/join.ts b/src/core/url/join.ts new file mode 100644 index 000000000..1dda77923 --- /dev/null +++ b/src/core/url/join.ts @@ -0,0 +1,55 @@ +export function join(base: string, ...segments: string[]): string { + if (!base) { + return ""; + } + + if (base.includes("://")) { + let url: URL; + try { + url = new URL(base); + } catch { + // Fallback to path joining if URL is malformed + return joinPath(base, ...segments); + } + + for (const segment of segments) { + const cleanSegment = trimSlashes(segment); + if (cleanSegment) { + url.pathname = joinPathSegments(url.pathname, cleanSegment); + } + } + + return url.toString(); + } + + return joinPath(base, ...segments); +} + +function joinPath(base: string, ...segments: string[]): string { + let result = base; + + for (const segment of segments) { + const cleanSegment = trimSlashes(segment); + if (cleanSegment) { + result = joinPathSegments(result, cleanSegment); + } + } + + return result; +} + +function joinPathSegments(left: string, right: string): string { + if (left.endsWith("/")) { + return left + right; + } + return left + "/" + right; +} + +function trimSlashes(str: string): string { + if (!str) return str; + + let start = str.startsWith("/") ? 1 : 0; + let end = str.endsWith("/") ? str.length - 1 : str.length; + + return str.slice(start, end); +} diff --git a/src/core/url/qs.ts b/src/core/url/qs.ts new file mode 100644 index 000000000..13e89be9d --- /dev/null +++ b/src/core/url/qs.ts @@ -0,0 +1,74 @@ +interface QueryStringOptions { + arrayFormat?: "indices" | "repeat"; + encode?: boolean; +} + +const defaultQsOptions: Required = { + arrayFormat: "indices", + encode: true, +} as const; + +function encodeValue(value: unknown, shouldEncode: boolean): string { + if (value === undefined) { + return ""; + } + if (value === null) { + return ""; + } + const stringValue = String(value); + return shouldEncode ? encodeURIComponent(stringValue) : stringValue; +} + +function stringifyObject(obj: Record, prefix = "", options: Required): string[] { + const parts: string[] = []; + + for (const [key, value] of Object.entries(obj)) { + const fullKey = prefix ? `${prefix}[${key}]` : key; + + if (value === undefined) { + continue; + } + + if (Array.isArray(value)) { + if (value.length === 0) { + continue; + } + for (let i = 0; i < value.length; i++) { + const item = value[i]; + if (item === undefined) { + continue; + } + if (typeof item === "object" && !Array.isArray(item) && item !== null) { + const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey; + parts.push(...stringifyObject(item as Record, arrayKey, options)); + } else { + const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey; + const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey; + parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`); + } + } + } else if (typeof value === "object" && value !== null) { + if (Object.keys(value as Record).length === 0) { + continue; + } + parts.push(...stringifyObject(value as Record, fullKey, options)); + } else { + const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey; + parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`); + } + } + + return parts; +} + +export function toQueryString(obj: unknown, options?: QueryStringOptions): string { + if (obj == null || typeof obj !== "object") { + return ""; + } + + const parts = stringifyObject(obj as Record, "", { + ...defaultQsOptions, + ...options, + }); + return parts.join("&"); +} diff --git a/src/core/utils/index.ts b/src/core/utils/index.ts index b168f599a..11ff8f251 100644 --- a/src/core/utils/index.ts +++ b/src/core/utils/index.ts @@ -1 +1 @@ -export { setObjectProperty } from "./setObjectProperty"; +export { setObjectProperty } from "./setObjectProperty.js"; diff --git a/src/errors/index.ts b/src/errors/index.ts index 93f3e69f7..b8db01bbc 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -1,2 +1,2 @@ -export { SquareError } from "./SquareError"; -export { SquareTimeoutError } from "./SquareTimeoutError"; +export { SquareError } from "./SquareError.js"; +export { SquareTimeoutError } from "./SquareTimeoutError.js"; diff --git a/src/serialization/index.ts b/src/serialization/index.ts deleted file mode 100644 index 3ce0a3e38..000000000 --- a/src/serialization/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types"; -export * from "./resources"; diff --git a/src/serialization/resources/applePay/client/index.ts b/src/serialization/resources/applePay/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/applePay/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/applePay/client/requests/RegisterDomainRequest.ts b/src/serialization/resources/applePay/client/requests/RegisterDomainRequest.ts deleted file mode 100644 index 97287234c..000000000 --- a/src/serialization/resources/applePay/client/requests/RegisterDomainRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 6896539da..000000000 --- a/src/serialization/resources/applePay/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { RegisterDomainRequest } from "./RegisterDomainRequest"; diff --git a/src/serialization/resources/applePay/index.ts b/src/serialization/resources/applePay/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/applePay/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/bookings/client/index.ts b/src/serialization/resources/bookings/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/bookings/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts b/src/serialization/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts deleted file mode 100644 index e6488498f..000000000 --- a/src/serialization/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 539faef24..000000000 --- a/src/serialization/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f56a21f2b..000000000 --- a/src/serialization/resources/bookings/client/requests/CancelBookingRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 922b63ca0..000000000 --- a/src/serialization/resources/bookings/client/requests/CreateBookingRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6b06472e8..000000000 --- a/src/serialization/resources/bookings/client/requests/SearchAvailabilityRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2aa348a18..000000000 --- a/src/serialization/resources/bookings/client/requests/UpdateBookingRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1aaa5675b..000000000 --- a/src/serialization/resources/bookings/client/requests/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/bookings/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index a52133bc1..000000000 --- a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 03dbdbd47..000000000 --- a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d490fe8a8..000000000 --- a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/bookings/resources/customAttributeDefinitions/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/bookings/resources/customAttributes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 5e7d7c93b..000000000 --- a/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0c2323579..000000000 --- a/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 178e21f1e..000000000 --- a/src/serialization/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e0e5f9d3d..000000000 --- a/src/serialization/resources/bookings/resources/customAttributes/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/bookings/resources/customAttributes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/bookings/resources/index.ts b/src/serialization/resources/bookings/resources/index.ts deleted file mode 100644 index 96153bc82..000000000 --- a/src/serialization/resources/bookings/resources/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/cards/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/cards/client/requests/CreateCardRequest.ts b/src/serialization/resources/cards/client/requests/CreateCardRequest.ts deleted file mode 100644 index 73ff67ad7..000000000 --- a/src/serialization/resources/cards/client/requests/CreateCardRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 76287dee2..000000000 --- a/src/serialization/resources/cards/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateCardRequest } from "./CreateCardRequest"; diff --git a/src/serialization/resources/cards/index.ts b/src/serialization/resources/cards/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/cards/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/catalog/client/index.ts b/src/serialization/resources/catalog/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/catalog/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts b/src/serialization/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts deleted file mode 100644 index 4f103bc79..000000000 --- a/src/serialization/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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())), -}); - -export declare namespace BatchDeleteCatalogObjectsRequest { - export interface Raw { - object_ids: string[]; - } -} diff --git a/src/serialization/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts b/src/serialization/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts deleted file mode 100644 index f926078f4..000000000 --- a/src/serialization/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 406212100..000000000 --- a/src/serialization/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cee9e8946..000000000 --- a/src/serialization/resources/catalog/client/requests/SearchCatalogItemsRequest.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 12c4e5e08..000000000 --- a/src/serialization/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 21947e2ce..000000000 --- a/src/serialization/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c73ede6bf..000000000 --- a/src/serialization/resources/catalog/client/requests/UpdateItemTaxesRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b6dd6da9f..000000000 --- a/src/serialization/resources/catalog/client/requests/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/catalog/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./client"; -export * from "./resources"; diff --git a/src/serialization/resources/catalog/resources/index.ts b/src/serialization/resources/catalog/resources/index.ts deleted file mode 100644 index 5aa921606..000000000 --- a/src/serialization/resources/catalog/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/catalog/resources/object/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 23e780a0c..000000000 --- a/src/serialization/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 346a52b67..000000000 --- a/src/serialization/resources/catalog/resources/object/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UpsertCatalogObjectRequest } from "./UpsertCatalogObjectRequest"; diff --git a/src/serialization/resources/catalog/resources/object/index.ts b/src/serialization/resources/catalog/resources/object/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/catalog/resources/object/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/checkout/client/index.ts b/src/serialization/resources/checkout/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/checkout/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts b/src/serialization/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts deleted file mode 100644 index f6714b1b2..000000000 --- a/src/serialization/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 669eefeb1..000000000 --- a/src/serialization/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1b1b417cc..000000000 --- a/src/serialization/resources/checkout/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { UpdateLocationSettingsRequest } from "./UpdateLocationSettingsRequest"; -export { UpdateMerchantSettingsRequest } from "./UpdateMerchantSettingsRequest"; diff --git a/src/serialization/resources/checkout/index.ts b/src/serialization/resources/checkout/index.ts deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/checkout/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./client"; -export * from "./resources"; diff --git a/src/serialization/resources/checkout/resources/index.ts b/src/serialization/resources/checkout/resources/index.ts deleted file mode 100644 index 5f3efa0d0..000000000 --- a/src/serialization/resources/checkout/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/checkout/resources/paymentLinks/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index be573a9cd..000000000 --- a/src/serialization/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6e19fa86d..000000000 --- a/src/serialization/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7e82ca744..000000000 --- a/src/serialization/resources/checkout/resources/paymentLinks/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/checkout/resources/paymentLinks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/customers/client/index.ts b/src/serialization/resources/customers/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/customers/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/customers/client/requests/BulkCreateCustomersRequest.ts b/src/serialization/resources/customers/client/requests/BulkCreateCustomersRequest.ts deleted file mode 100644 index d42b1ff21..000000000 --- a/src/serialization/resources/customers/client/requests/BulkCreateCustomersRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8894849f1..000000000 --- a/src/serialization/resources/customers/client/requests/BulkDeleteCustomersRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d37cd7f6d..000000000 --- a/src/serialization/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 510ce5a1b..000000000 --- a/src/serialization/resources/customers/client/requests/BulkUpdateCustomersRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 95935b7f1..000000000 --- a/src/serialization/resources/customers/client/requests/CreateCustomerRequest.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 349ab95d6..000000000 --- a/src/serialization/resources/customers/client/requests/SearchCustomersRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bbf9cb37f..000000000 --- a/src/serialization/resources/customers/client/requests/UpdateCustomerRequest.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 636aa1ff9..000000000 --- a/src/serialization/resources/customers/client/requests/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/customers/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/customers/resources/cards/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 0ea65fbb0..000000000 --- a/src/serialization/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9c9512545..000000000 --- a/src/serialization/resources/customers/resources/cards/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateCustomerCardRequest } from "./CreateCustomerCardRequest"; diff --git a/src/serialization/resources/customers/resources/cards/index.ts b/src/serialization/resources/customers/resources/cards/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/customers/resources/cards/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 23170882a..000000000 --- a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 43afb4dfe..000000000 --- a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f68b95d9b..000000000 --- a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3e6e7c1f4..000000000 --- a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/customers/resources/customAttributeDefinitions/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/customers/resources/customAttributes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index b7fb5cecf..000000000 --- a/src/serialization/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 49d14a9fc..000000000 --- a/src/serialization/resources/customers/resources/customAttributes/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UpsertCustomerCustomAttributeRequest } from "./UpsertCustomerCustomAttributeRequest"; diff --git a/src/serialization/resources/customers/resources/customAttributes/index.ts b/src/serialization/resources/customers/resources/customAttributes/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/customers/resources/customAttributes/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/customers/resources/groups/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 489367bda..000000000 --- a/src/serialization/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 763aaf1cc..000000000 --- a/src/serialization/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 539dd5e06..000000000 --- a/src/serialization/resources/customers/resources/groups/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/customers/resources/groups/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/customers/resources/index.ts b/src/serialization/resources/customers/resources/index.ts deleted file mode 100644 index 033a7b15f..000000000 --- a/src/serialization/resources/customers/resources/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 3e5335fe4..000000000 --- a/src/serialization/resources/devices/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/devices/resources/codes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index de9feaac0..000000000 --- a/src/serialization/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 56752258f..000000000 --- a/src/serialization/resources/devices/resources/codes/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateDeviceCodeRequest } from "./CreateDeviceCodeRequest"; diff --git a/src/serialization/resources/devices/resources/codes/index.ts b/src/serialization/resources/devices/resources/codes/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/devices/resources/codes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/devices/resources/index.ts b/src/serialization/resources/devices/resources/index.ts deleted file mode 100644 index b75af3b53..000000000 --- a/src/serialization/resources/devices/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/disputes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts b/src/serialization/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts deleted file mode 100644 index bcb89e5ab..000000000 --- a/src/serialization/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 519f5bba0..000000000 --- a/src/serialization/resources/disputes/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateDisputeEvidenceTextRequest } from "./CreateDisputeEvidenceTextRequest"; diff --git a/src/serialization/resources/disputes/index.ts b/src/serialization/resources/disputes/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/disputes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/events/client/index.ts b/src/serialization/resources/events/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/events/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/events/client/requests/SearchEventsRequest.ts b/src/serialization/resources/events/client/requests/SearchEventsRequest.ts deleted file mode 100644 index 9b03e2afd..000000000 --- a/src/serialization/resources/events/client/requests/SearchEventsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c01d7b10c..000000000 --- a/src/serialization/resources/events/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { SearchEventsRequest } from "./SearchEventsRequest"; diff --git a/src/serialization/resources/events/index.ts b/src/serialization/resources/events/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/events/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/giftCards/client/index.ts b/src/serialization/resources/giftCards/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/giftCards/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/giftCards/client/requests/CreateGiftCardRequest.ts b/src/serialization/resources/giftCards/client/requests/CreateGiftCardRequest.ts deleted file mode 100644 index dfbbc7aa6..000000000 --- a/src/serialization/resources/giftCards/client/requests/CreateGiftCardRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 809c07825..000000000 --- a/src/serialization/resources/giftCards/client/requests/GetGiftCardFromGanRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7bb8cfb6b..000000000 --- a/src/serialization/resources/giftCards/client/requests/GetGiftCardFromNonceRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e04b837c1..000000000 --- a/src/serialization/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bd9fba99e..000000000 --- a/src/serialization/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 05bfa3ca0..000000000 --- a/src/serialization/resources/giftCards/client/requests/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/giftCards/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/giftCards/resources/activities/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 9b8efe404..000000000 --- a/src/serialization/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6983d1fde..000000000 --- a/src/serialization/resources/giftCards/resources/activities/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateGiftCardActivityRequest } from "./CreateGiftCardActivityRequest"; diff --git a/src/serialization/resources/giftCards/resources/activities/index.ts b/src/serialization/resources/giftCards/resources/activities/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/giftCards/resources/activities/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/giftCards/resources/index.ts b/src/serialization/resources/giftCards/resources/index.ts deleted file mode 100644 index b1095905e..000000000 --- a/src/serialization/resources/giftCards/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * as activities from "./activities"; -export * from "./activities/client/requests"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts deleted file mode 100644 index 4ac63f244..000000000 --- a/src/serialization/resources/index.ts +++ /dev/null @@ -1,52 +0,0 @@ -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 labor from "./labor"; -export * from "./labor/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 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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/invoices/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/invoices/client/requests/CancelInvoiceRequest.ts b/src/serialization/resources/invoices/client/requests/CancelInvoiceRequest.ts deleted file mode 100644 index 6500b6ab0..000000000 --- a/src/serialization/resources/invoices/client/requests/CancelInvoiceRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 42bcf7e22..000000000 --- a/src/serialization/resources/invoices/client/requests/CreateInvoiceRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 28315e6e4..000000000 --- a/src/serialization/resources/invoices/client/requests/PublishInvoiceRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e4dee2e6b..000000000 --- a/src/serialization/resources/invoices/client/requests/SearchInvoicesRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 750087321..000000000 --- a/src/serialization/resources/invoices/client/requests/UpdateInvoiceRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ecb9f5b77..000000000 --- a/src/serialization/resources/invoices/client/requests/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/invoices/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/labor/client/index.ts b/src/serialization/resources/labor/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/labor/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/labor/client/requests/BulkPublishScheduledShiftsRequest.ts b/src/serialization/resources/labor/client/requests/BulkPublishScheduledShiftsRequest.ts deleted file mode 100644 index 2236c24ee..000000000 --- a/src/serialization/resources/labor/client/requests/BulkPublishScheduledShiftsRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { BulkPublishScheduledShiftsData } from "../../../../types/BulkPublishScheduledShiftsData"; -import { ScheduledShiftNotificationAudience } from "../../../../types/ScheduledShiftNotificationAudience"; - -export const BulkPublishScheduledShiftsRequest: core.serialization.Schema< - serializers.BulkPublishScheduledShiftsRequest.Raw, - Square.BulkPublishScheduledShiftsRequest -> = core.serialization.object({ - scheduledShifts: core.serialization.property( - "scheduled_shifts", - core.serialization.record(core.serialization.string(), BulkPublishScheduledShiftsData), - ), - scheduledShiftNotificationAudience: core.serialization.property( - "scheduled_shift_notification_audience", - ScheduledShiftNotificationAudience.optional(), - ), -}); - -export declare namespace BulkPublishScheduledShiftsRequest { - export interface Raw { - scheduled_shifts: Record; - scheduled_shift_notification_audience?: ScheduledShiftNotificationAudience.Raw | null; - } -} diff --git a/src/serialization/resources/labor/client/requests/CreateScheduledShiftRequest.ts b/src/serialization/resources/labor/client/requests/CreateScheduledShiftRequest.ts deleted file mode 100644 index ad6f00fd1..000000000 --- a/src/serialization/resources/labor/client/requests/CreateScheduledShiftRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { ScheduledShift } from "../../../../types/ScheduledShift"; - -export const CreateScheduledShiftRequest: core.serialization.Schema< - serializers.CreateScheduledShiftRequest.Raw, - Square.CreateScheduledShiftRequest -> = core.serialization.object({ - idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), - scheduledShift: core.serialization.property("scheduled_shift", ScheduledShift), -}); - -export declare namespace CreateScheduledShiftRequest { - export interface Raw { - idempotency_key?: string | null; - scheduled_shift: ScheduledShift.Raw; - } -} diff --git a/src/serialization/resources/labor/client/requests/CreateTimecardRequest.ts b/src/serialization/resources/labor/client/requests/CreateTimecardRequest.ts deleted file mode 100644 index 847411fd1..000000000 --- a/src/serialization/resources/labor/client/requests/CreateTimecardRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { Timecard } from "../../../../types/Timecard"; - -export const CreateTimecardRequest: core.serialization.Schema< - serializers.CreateTimecardRequest.Raw, - Square.CreateTimecardRequest -> = core.serialization.object({ - idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), - timecard: Timecard, -}); - -export declare namespace CreateTimecardRequest { - export interface Raw { - idempotency_key?: string | null; - timecard: Timecard.Raw; - } -} diff --git a/src/serialization/resources/labor/client/requests/PublishScheduledShiftRequest.ts b/src/serialization/resources/labor/client/requests/PublishScheduledShiftRequest.ts deleted file mode 100644 index e2582095f..000000000 --- a/src/serialization/resources/labor/client/requests/PublishScheduledShiftRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { ScheduledShiftNotificationAudience } from "../../../../types/ScheduledShiftNotificationAudience"; - -export const PublishScheduledShiftRequest: core.serialization.Schema< - serializers.PublishScheduledShiftRequest.Raw, - Omit -> = core.serialization.object({ - idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), - version: core.serialization.number().optional(), - scheduledShiftNotificationAudience: core.serialization.property( - "scheduled_shift_notification_audience", - ScheduledShiftNotificationAudience.optional(), - ), -}); - -export declare namespace PublishScheduledShiftRequest { - export interface Raw { - idempotency_key: string; - version?: number | null; - scheduled_shift_notification_audience?: ScheduledShiftNotificationAudience.Raw | null; - } -} diff --git a/src/serialization/resources/labor/client/requests/SearchScheduledShiftsRequest.ts b/src/serialization/resources/labor/client/requests/SearchScheduledShiftsRequest.ts deleted file mode 100644 index dc15134fc..000000000 --- a/src/serialization/resources/labor/client/requests/SearchScheduledShiftsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { ScheduledShiftQuery } from "../../../../types/ScheduledShiftQuery"; - -export const SearchScheduledShiftsRequest: core.serialization.Schema< - serializers.SearchScheduledShiftsRequest.Raw, - Square.SearchScheduledShiftsRequest -> = core.serialization.object({ - query: ScheduledShiftQuery.optional(), - limit: core.serialization.number().optional(), - cursor: core.serialization.string().optional(), -}); - -export declare namespace SearchScheduledShiftsRequest { - export interface Raw { - query?: ScheduledShiftQuery.Raw | null; - limit?: number | null; - cursor?: string | null; - } -} diff --git a/src/serialization/resources/labor/client/requests/SearchTimecardsRequest.ts b/src/serialization/resources/labor/client/requests/SearchTimecardsRequest.ts deleted file mode 100644 index afdc5165d..000000000 --- a/src/serialization/resources/labor/client/requests/SearchTimecardsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { TimecardQuery } from "../../../../types/TimecardQuery"; - -export const SearchTimecardsRequest: core.serialization.Schema< - serializers.SearchTimecardsRequest.Raw, - Square.SearchTimecardsRequest -> = core.serialization.object({ - query: TimecardQuery.optional(), - limit: core.serialization.number().optional(), - cursor: core.serialization.string().optional(), -}); - -export declare namespace SearchTimecardsRequest { - export interface Raw { - query?: TimecardQuery.Raw | null; - limit?: number | null; - cursor?: string | null; - } -} diff --git a/src/serialization/resources/labor/client/requests/UpdateScheduledShiftRequest.ts b/src/serialization/resources/labor/client/requests/UpdateScheduledShiftRequest.ts deleted file mode 100644 index 7805fc348..000000000 --- a/src/serialization/resources/labor/client/requests/UpdateScheduledShiftRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { ScheduledShift } from "../../../../types/ScheduledShift"; - -export const UpdateScheduledShiftRequest: core.serialization.Schema< - serializers.UpdateScheduledShiftRequest.Raw, - Omit -> = core.serialization.object({ - scheduledShift: core.serialization.property("scheduled_shift", ScheduledShift), -}); - -export declare namespace UpdateScheduledShiftRequest { - export interface Raw { - scheduled_shift: ScheduledShift.Raw; - } -} diff --git a/src/serialization/resources/labor/client/requests/UpdateTimecardRequest.ts b/src/serialization/resources/labor/client/requests/UpdateTimecardRequest.ts deleted file mode 100644 index c7adb43f5..000000000 --- a/src/serialization/resources/labor/client/requests/UpdateTimecardRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index"; -import * as Square from "../../../../../api/index"; -import * as core from "../../../../../core"; -import { Timecard } from "../../../../types/Timecard"; - -export const UpdateTimecardRequest: core.serialization.Schema< - serializers.UpdateTimecardRequest.Raw, - Omit -> = core.serialization.object({ - timecard: Timecard, -}); - -export declare namespace UpdateTimecardRequest { - export interface Raw { - timecard: Timecard.Raw; - } -} diff --git a/src/serialization/resources/labor/client/requests/index.ts b/src/serialization/resources/labor/client/requests/index.ts deleted file mode 100644 index 86f313e34..000000000 --- a/src/serialization/resources/labor/client/requests/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { CreateScheduledShiftRequest } from "./CreateScheduledShiftRequest"; -export { BulkPublishScheduledShiftsRequest } from "./BulkPublishScheduledShiftsRequest"; -export { SearchScheduledShiftsRequest } from "./SearchScheduledShiftsRequest"; -export { UpdateScheduledShiftRequest } from "./UpdateScheduledShiftRequest"; -export { PublishScheduledShiftRequest } from "./PublishScheduledShiftRequest"; -export { CreateTimecardRequest } from "./CreateTimecardRequest"; -export { SearchTimecardsRequest } from "./SearchTimecardsRequest"; -export { UpdateTimecardRequest } from "./UpdateTimecardRequest"; diff --git a/src/serialization/resources/labor/index.ts b/src/serialization/resources/labor/index.ts deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/labor/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./client"; -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/labor/resources/breakTypes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 61d162374..000000000 --- a/src/serialization/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4fbe34a90..000000000 --- a/src/serialization/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a7266d971..000000000 --- a/src/serialization/resources/labor/resources/breakTypes/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/labor/resources/breakTypes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/labor/resources/index.ts b/src/serialization/resources/labor/resources/index.ts deleted file mode 100644 index d79b4c040..000000000 --- a/src/serialization/resources/labor/resources/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/labor/resources/shifts/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 60eda2e1c..000000000 --- a/src/serialization/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 867f740ed..000000000 --- a/src/serialization/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 42026820b..000000000 --- a/src/serialization/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1745caefa..000000000 --- a/src/serialization/resources/labor/resources/shifts/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/labor/resources/shifts/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/labor/resources/workweekConfigs/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 605b45209..000000000 --- a/src/serialization/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 80294bc4a..000000000 --- a/src/serialization/resources/labor/resources/workweekConfigs/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UpdateWorkweekConfigRequest } from "./UpdateWorkweekConfigRequest"; diff --git a/src/serialization/resources/labor/resources/workweekConfigs/index.ts b/src/serialization/resources/labor/resources/workweekConfigs/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/labor/resources/workweekConfigs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/locations/client/index.ts b/src/serialization/resources/locations/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/locations/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/locations/client/requests/CreateCheckoutRequest.ts b/src/serialization/resources/locations/client/requests/CreateCheckoutRequest.ts deleted file mode 100644 index b72bce12d..000000000 --- a/src/serialization/resources/locations/client/requests/CreateCheckoutRequest.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8f2206ff5..000000000 --- a/src/serialization/resources/locations/client/requests/CreateLocationRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 994c21745..000000000 --- a/src/serialization/resources/locations/client/requests/UpdateLocationRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7527b14b5..000000000 --- a/src/serialization/resources/locations/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/locations/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 00faaf3fb..000000000 --- a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8b6169e08..000000000 --- a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 16cc477e6..000000000 --- a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/locations/resources/customAttributeDefinitions/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/locations/resources/customAttributes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index bf41571ed..000000000 --- a/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 57f14749a..000000000 --- a/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c20535527..000000000 --- a/src/serialization/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9eb87414b..000000000 --- a/src/serialization/resources/locations/resources/customAttributes/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/locations/resources/customAttributes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/locations/resources/index.ts b/src/serialization/resources/locations/resources/index.ts deleted file mode 100644 index 96153bc82..000000000 --- a/src/serialization/resources/locations/resources/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/loyalty/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts b/src/serialization/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts deleted file mode 100644 index 4a9cb5831..000000000 --- a/src/serialization/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a7380530e..000000000 --- a/src/serialization/resources/loyalty/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { SearchLoyaltyEventsRequest } from "./SearchLoyaltyEventsRequest"; diff --git a/src/serialization/resources/loyalty/index.ts b/src/serialization/resources/loyalty/index.ts deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/loyalty/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/loyalty/resources/accounts/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 82798bad6..000000000 --- a/src/serialization/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index dd917764d..000000000 --- a/src/serialization/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ed4e98e0a..000000000 --- a/src/serialization/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 45d7d4b8b..000000000 --- a/src/serialization/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 03227b225..000000000 --- a/src/serialization/resources/loyalty/resources/accounts/client/requests/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/loyalty/resources/accounts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/loyalty/resources/index.ts b/src/serialization/resources/loyalty/resources/index.ts deleted file mode 100644 index 98cded2c5..000000000 --- a/src/serialization/resources/loyalty/resources/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/loyalty/resources/programs/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 5f95c2425..000000000 --- a/src/serialization/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d3ccef282..000000000 --- a/src/serialization/resources/loyalty/resources/programs/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CalculateLoyaltyPointsRequest } from "./CalculateLoyaltyPointsRequest"; diff --git a/src/serialization/resources/loyalty/resources/programs/index.ts b/src/serialization/resources/loyalty/resources/programs/index.ts deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/loyalty/resources/programs/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 0da7d5f94..000000000 --- a/src/serialization/resources/loyalty/resources/programs/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 06a38c038..000000000 --- a/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/CreateLoyaltyPromotionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8fcc50de0..000000000 --- a/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/loyalty/resources/programs/resources/promotions/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/loyalty/resources/rewards/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 488fc35d8..000000000 --- a/src/serialization/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4531f813d..000000000 --- a/src/serialization/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d29fbf38d..000000000 --- a/src/serialization/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 73d200ec3..000000000 --- a/src/serialization/resources/loyalty/resources/rewards/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/loyalty/resources/rewards/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/merchants/index.ts b/src/serialization/resources/merchants/index.ts deleted file mode 100644 index 3e5335fe4..000000000 --- a/src/serialization/resources/merchants/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 77146cbdd..000000000 --- a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 786d2c616..000000000 --- a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index eb7d4afd2..000000000 --- a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/merchants/resources/customAttributeDefinitions/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/merchants/resources/customAttributes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index c78a982c9..000000000 --- a/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 68b2a4675..000000000 --- a/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fd3d3f1f9..000000000 --- a/src/serialization/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 425cecf89..000000000 --- a/src/serialization/resources/merchants/resources/customAttributes/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/merchants/resources/customAttributes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/merchants/resources/index.ts b/src/serialization/resources/merchants/resources/index.ts deleted file mode 100644 index 96153bc82..000000000 --- a/src/serialization/resources/merchants/resources/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/mobile/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts b/src/serialization/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts deleted file mode 100644 index 0d33f8179..000000000 --- a/src/serialization/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bea839634..000000000 --- a/src/serialization/resources/mobile/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateMobileAuthorizationCodeRequest } from "./CreateMobileAuthorizationCodeRequest"; diff --git a/src/serialization/resources/mobile/index.ts b/src/serialization/resources/mobile/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/mobile/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/oAuth/client/index.ts b/src/serialization/resources/oAuth/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/oAuth/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/oAuth/client/requests/ObtainTokenRequest.ts b/src/serialization/resources/oAuth/client/requests/ObtainTokenRequest.ts deleted file mode 100644 index cbde8c0d5..000000000 --- a/src/serialization/resources/oAuth/client/requests/ObtainTokenRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a1546b6fe..000000000 --- a/src/serialization/resources/oAuth/client/requests/RevokeTokenRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3adbffa40..000000000 --- a/src/serialization/resources/oAuth/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { RevokeTokenRequest } from "./RevokeTokenRequest"; -export { ObtainTokenRequest } from "./ObtainTokenRequest"; diff --git a/src/serialization/resources/oAuth/index.ts b/src/serialization/resources/oAuth/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/oAuth/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/orders/client/index.ts b/src/serialization/resources/orders/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/orders/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/orders/client/requests/BatchGetOrdersRequest.ts b/src/serialization/resources/orders/client/requests/BatchGetOrdersRequest.ts deleted file mode 100644 index 9231fb858..000000000 --- a/src/serialization/resources/orders/client/requests/BatchGetOrdersRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f45aa627c..000000000 --- a/src/serialization/resources/orders/client/requests/CalculateOrderRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 859bd99e2..000000000 --- a/src/serialization/resources/orders/client/requests/CloneOrderRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bf220bf26..000000000 --- a/src/serialization/resources/orders/client/requests/PayOrderRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index fd836c0ad..000000000 --- a/src/serialization/resources/orders/client/requests/SearchOrdersRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e67aa8934..000000000 --- a/src/serialization/resources/orders/client/requests/UpdateOrderRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cad486739..000000000 --- a/src/serialization/resources/orders/client/requests/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/orders/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index d41721b2f..000000000 --- a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1f23cef83..000000000 --- a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ac4d01a44..000000000 --- a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/orders/resources/customAttributeDefinitions/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/orders/resources/customAttributes/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 16ed1b7f3..000000000 --- a/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2999133ec..000000000 --- a/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cd5451bfd..000000000 --- a/src/serialization/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 61f2eb98d..000000000 --- a/src/serialization/resources/orders/resources/customAttributes/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/orders/resources/customAttributes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/orders/resources/index.ts b/src/serialization/resources/orders/resources/index.ts deleted file mode 100644 index 96153bc82..000000000 --- a/src/serialization/resources/orders/resources/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/payments/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts b/src/serialization/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts deleted file mode 100644 index 0efa29d7c..000000000 --- a/src/serialization/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7c78bc1f1..000000000 --- a/src/serialization/resources/payments/client/requests/CompletePaymentRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 35c740983..000000000 --- a/src/serialization/resources/payments/client/requests/CreatePaymentRequest.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 12d129e2f..000000000 --- a/src/serialization/resources/payments/client/requests/UpdatePaymentRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4332ec649..000000000 --- a/src/serialization/resources/payments/client/requests/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/payments/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/refunds/client/index.ts b/src/serialization/resources/refunds/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/refunds/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/refunds/client/requests/RefundPaymentRequest.ts b/src/serialization/resources/refunds/client/requests/RefundPaymentRequest.ts deleted file mode 100644 index 7f36428a0..000000000 --- a/src/serialization/resources/refunds/client/requests/RefundPaymentRequest.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 772a6ab0a..000000000 --- a/src/serialization/resources/refunds/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { RefundPaymentRequest } from "./RefundPaymentRequest"; diff --git a/src/serialization/resources/refunds/index.ts b/src/serialization/resources/refunds/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/refunds/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/snippets/client/index.ts b/src/serialization/resources/snippets/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/snippets/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/snippets/client/requests/UpsertSnippetRequest.ts b/src/serialization/resources/snippets/client/requests/UpsertSnippetRequest.ts deleted file mode 100644 index 4e637b87f..000000000 --- a/src/serialization/resources/snippets/client/requests/UpsertSnippetRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3eddae789..000000000 --- a/src/serialization/resources/snippets/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UpsertSnippetRequest } from "./UpsertSnippetRequest"; diff --git a/src/serialization/resources/snippets/index.ts b/src/serialization/resources/snippets/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/snippets/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/subscriptions/client/index.ts b/src/serialization/resources/subscriptions/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/subscriptions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts b/src/serialization/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts deleted file mode 100644 index aa87601d5..000000000 --- a/src/serialization/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 53291970d..000000000 --- a/src/serialization/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f622c8ea4..000000000 --- a/src/serialization/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 384d35024..000000000 --- a/src/serialization/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 47f788ac0..000000000 --- a/src/serialization/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6bc67aa04..000000000 --- a/src/serialization/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 20b4035e0..000000000 --- a/src/serialization/resources/subscriptions/client/requests/SwapPlanRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ec6826f50..000000000 --- a/src/serialization/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b48070509..000000000 --- a/src/serialization/resources/subscriptions/client/requests/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/subscriptions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/team/client/index.ts b/src/serialization/resources/team/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/team/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/team/client/requests/CreateJobRequest.ts b/src/serialization/resources/team/client/requests/CreateJobRequest.ts deleted file mode 100644 index 7ab21c8a9..000000000 --- a/src/serialization/resources/team/client/requests/CreateJobRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a4b0ff74a..000000000 --- a/src/serialization/resources/team/client/requests/UpdateJobRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4324977f5..000000000 --- a/src/serialization/resources/team/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { CreateJobRequest } from "./CreateJobRequest"; -export { UpdateJobRequest } from "./UpdateJobRequest"; diff --git a/src/serialization/resources/team/index.ts b/src/serialization/resources/team/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/team/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/teamMembers/client/index.ts b/src/serialization/resources/teamMembers/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/teamMembers/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts b/src/serialization/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts deleted file mode 100644 index 2484c48dd..000000000 --- a/src/serialization/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 69b652a7c..000000000 --- a/src/serialization/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 46826c908..000000000 --- a/src/serialization/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 041bfcfee..000000000 --- a/src/serialization/resources/teamMembers/client/requests/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 33a87f100..000000000 --- a/src/serialization/resources/teamMembers/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./client"; -export * from "./resources"; diff --git a/src/serialization/resources/teamMembers/resources/index.ts b/src/serialization/resources/teamMembers/resources/index.ts deleted file mode 100644 index 921a5bbe9..000000000 --- a/src/serialization/resources/teamMembers/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/teamMembers/resources/wageSetting/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index e09c0ea2b..000000000 --- a/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 354c3b260..000000000 --- a/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UpdateWageSettingRequest } from "./UpdateWageSettingRequest"; diff --git a/src/serialization/resources/teamMembers/resources/wageSetting/index.ts b/src/serialization/resources/teamMembers/resources/wageSetting/index.ts deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/teamMembers/resources/wageSetting/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/terminal/index.ts b/src/serialization/resources/terminal/index.ts deleted file mode 100644 index 3e5335fe4..000000000 --- a/src/serialization/resources/terminal/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/terminal/resources/actions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 1dbf1be21..000000000 --- a/src/serialization/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0c5fc148c..000000000 --- a/src/serialization/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f1d809969..000000000 --- a/src/serialization/resources/terminal/resources/actions/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/terminal/resources/actions/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/terminal/resources/checkouts/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 467299dbc..000000000 --- a/src/serialization/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0ba1d4581..000000000 --- a/src/serialization/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 74d954969..000000000 --- a/src/serialization/resources/terminal/resources/checkouts/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/terminal/resources/checkouts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/terminal/resources/index.ts b/src/serialization/resources/terminal/resources/index.ts deleted file mode 100644 index 0a902a361..000000000 --- a/src/serialization/resources/terminal/resources/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/terminal/resources/refunds/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index a871e1058..000000000 --- a/src/serialization/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c2d5fff3e..000000000 --- a/src/serialization/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8f47a8d64..000000000 --- a/src/serialization/resources/terminal/resources/refunds/client/requests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/terminal/resources/refunds/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/v1Transactions/client/index.ts b/src/serialization/resources/v1Transactions/client/index.ts deleted file mode 100644 index 989c4b62f..000000000 --- a/src/serialization/resources/v1Transactions/client/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index bb759291f..000000000 --- a/src/serialization/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 083f766e2..000000000 --- a/src/serialization/resources/v1Transactions/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { V1UpdateOrderRequest } from "./V1UpdateOrderRequest"; diff --git a/src/serialization/resources/v1Transactions/client/v1ListOrders.ts b/src/serialization/resources/v1Transactions/client/v1ListOrders.ts deleted file mode 100644 index 76b301b14..000000000 --- a/src/serialization/resources/v1Transactions/client/v1ListOrders.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/v1Transactions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/vendors/client/index.ts b/src/serialization/resources/vendors/client/index.ts deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/vendors/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests"; diff --git a/src/serialization/resources/vendors/client/requests/BatchCreateVendorsRequest.ts b/src/serialization/resources/vendors/client/requests/BatchCreateVendorsRequest.ts deleted file mode 100644 index 35197e5df..000000000 --- a/src/serialization/resources/vendors/client/requests/BatchCreateVendorsRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fc7005729..000000000 --- a/src/serialization/resources/vendors/client/requests/BatchGetVendorsRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d9cdd6c78..000000000 --- a/src/serialization/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 64c531673..000000000 --- a/src/serialization/resources/vendors/client/requests/CreateVendorRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1a22317b8..000000000 --- a/src/serialization/resources/vendors/client/requests/SearchVendorsRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5a9b83969..000000000 --- a/src/serialization/resources/vendors/client/requests/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/vendors/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/resources/webhooks/index.ts b/src/serialization/resources/webhooks/index.ts deleted file mode 100644 index 3e5335fe4..000000000 --- a/src/serialization/resources/webhooks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./resources"; diff --git a/src/serialization/resources/webhooks/resources/index.ts b/src/serialization/resources/webhooks/resources/index.ts deleted file mode 100644 index 491a8c689..000000000 --- a/src/serialization/resources/webhooks/resources/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 415726b7f..000000000 --- a/src/serialization/resources/webhooks/resources/subscriptions/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 67ed058de..000000000 --- a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 97000bd74..000000000 --- a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 495a62319..000000000 --- a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b03a6f88b..000000000 --- a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 849f59f16..000000000 --- a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 5ec76921e..000000000 --- a/src/serialization/resources/webhooks/resources/subscriptions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./client"; diff --git a/src/serialization/types/AcceptDisputeResponse.ts b/src/serialization/types/AcceptDisputeResponse.ts deleted file mode 100644 index 2806b9f11..000000000 --- a/src/serialization/types/AcceptDisputeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1281bce45..000000000 --- a/src/serialization/types/AcceptedPaymentMethods.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a0b7b9f5d..000000000 --- a/src/serialization/types/AccumulateLoyaltyPointsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b69297e11..000000000 --- a/src/serialization/types/AchDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c61108372..000000000 --- a/src/serialization/types/ActionCancelReason.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 325c27675..000000000 --- a/src/serialization/types/ActivityType.ts +++ /dev/null @@ -1,131 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 1d8d5e99c..000000000 --- a/src/serialization/types/AddGroupToCustomerResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 672bb2df2..000000000 --- a/src/serialization/types/AdditionalRecipient.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 33ed78cdc..000000000 --- a/src/serialization/types/Address.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4c01a8c9e..000000000 --- a/src/serialization/types/AdjustLoyaltyPointsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8f2aa497d..000000000 --- a/src/serialization/types/AfterpayDetails.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 08386104f..000000000 --- a/src/serialization/types/ApplicationDetails.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 71b065b1f..000000000 --- a/src/serialization/types/ApplicationDetailsExternalSquareProduct.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9f5c07979..000000000 --- a/src/serialization/types/ApplicationType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a159933b8..000000000 --- a/src/serialization/types/AppointmentSegment.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 691716411..000000000 --- a/src/serialization/types/ArchivedState.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 367bb8fc3..000000000 --- a/src/serialization/types/Availability.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2a4f89132..000000000 --- a/src/serialization/types/BankAccount.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * This file was auto-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/BankAccountCreatedEvent.ts b/src/serialization/types/BankAccountCreatedEvent.ts deleted file mode 100644 index f7b60414b..000000000 --- a/src/serialization/types/BankAccountCreatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccountCreatedEventData } from "./BankAccountCreatedEventData"; - -export const BankAccountCreatedEvent: core.serialization.ObjectSchema< - serializers.BankAccountCreatedEvent.Raw, - Square.BankAccountCreatedEvent -> = 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: BankAccountCreatedEventData.optional(), -}); - -export declare namespace BankAccountCreatedEvent { - 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?: BankAccountCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountCreatedEventData.ts b/src/serialization/types/BankAccountCreatedEventData.ts deleted file mode 100644 index 4039ba596..000000000 --- a/src/serialization/types/BankAccountCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccountCreatedEventObject } from "./BankAccountCreatedEventObject"; - -export const BankAccountCreatedEventData: core.serialization.ObjectSchema< - serializers.BankAccountCreatedEventData.Raw, - Square.BankAccountCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: BankAccountCreatedEventObject.optional(), -}); - -export declare namespace BankAccountCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: BankAccountCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountCreatedEventObject.ts b/src/serialization/types/BankAccountCreatedEventObject.ts deleted file mode 100644 index f37db6a8a..000000000 --- a/src/serialization/types/BankAccountCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccount } from "./BankAccount"; - -export const BankAccountCreatedEventObject: core.serialization.ObjectSchema< - serializers.BankAccountCreatedEventObject.Raw, - Square.BankAccountCreatedEventObject -> = core.serialization.object({ - bankAccount: core.serialization.property("bank_account", BankAccount.optional()), -}); - -export declare namespace BankAccountCreatedEventObject { - export interface Raw { - bank_account?: BankAccount.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountDisabledEvent.ts b/src/serialization/types/BankAccountDisabledEvent.ts deleted file mode 100644 index 816ccc1b4..000000000 --- a/src/serialization/types/BankAccountDisabledEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccountDisabledEventData } from "./BankAccountDisabledEventData"; - -export const BankAccountDisabledEvent: core.serialization.ObjectSchema< - serializers.BankAccountDisabledEvent.Raw, - Square.BankAccountDisabledEvent -> = 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: BankAccountDisabledEventData.optional(), -}); - -export declare namespace BankAccountDisabledEvent { - 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?: BankAccountDisabledEventData.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountDisabledEventData.ts b/src/serialization/types/BankAccountDisabledEventData.ts deleted file mode 100644 index 713331f7c..000000000 --- a/src/serialization/types/BankAccountDisabledEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccountDisabledEventObject } from "./BankAccountDisabledEventObject"; - -export const BankAccountDisabledEventData: core.serialization.ObjectSchema< - serializers.BankAccountDisabledEventData.Raw, - Square.BankAccountDisabledEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: BankAccountDisabledEventObject.optional(), -}); - -export declare namespace BankAccountDisabledEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: BankAccountDisabledEventObject.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountDisabledEventObject.ts b/src/serialization/types/BankAccountDisabledEventObject.ts deleted file mode 100644 index 4ae222e30..000000000 --- a/src/serialization/types/BankAccountDisabledEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccount } from "./BankAccount"; - -export const BankAccountDisabledEventObject: core.serialization.ObjectSchema< - serializers.BankAccountDisabledEventObject.Raw, - Square.BankAccountDisabledEventObject -> = core.serialization.object({ - bankAccount: core.serialization.property("bank_account", BankAccount.optional()), -}); - -export declare namespace BankAccountDisabledEventObject { - export interface Raw { - bank_account?: BankAccount.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountPaymentDetails.ts b/src/serialization/types/BankAccountPaymentDetails.ts deleted file mode 100644 index 7a5bfea80..000000000 --- a/src/serialization/types/BankAccountPaymentDetails.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index df4c18d94..000000000 --- a/src/serialization/types/BankAccountStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7d7183052..000000000 --- a/src/serialization/types/BankAccountType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/BankAccountVerifiedEvent.ts b/src/serialization/types/BankAccountVerifiedEvent.ts deleted file mode 100644 index 59d4dd820..000000000 --- a/src/serialization/types/BankAccountVerifiedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccountVerifiedEventData } from "./BankAccountVerifiedEventData"; - -export const BankAccountVerifiedEvent: core.serialization.ObjectSchema< - serializers.BankAccountVerifiedEvent.Raw, - Square.BankAccountVerifiedEvent -> = 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: BankAccountVerifiedEventData.optional(), -}); - -export declare namespace BankAccountVerifiedEvent { - 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?: BankAccountVerifiedEventData.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountVerifiedEventData.ts b/src/serialization/types/BankAccountVerifiedEventData.ts deleted file mode 100644 index 5da93bb5e..000000000 --- a/src/serialization/types/BankAccountVerifiedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccountVerifiedEventObject } from "./BankAccountVerifiedEventObject"; - -export const BankAccountVerifiedEventData: core.serialization.ObjectSchema< - serializers.BankAccountVerifiedEventData.Raw, - Square.BankAccountVerifiedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: BankAccountVerifiedEventObject.optional(), -}); - -export declare namespace BankAccountVerifiedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: BankAccountVerifiedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/BankAccountVerifiedEventObject.ts b/src/serialization/types/BankAccountVerifiedEventObject.ts deleted file mode 100644 index f9a9214d7..000000000 --- a/src/serialization/types/BankAccountVerifiedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BankAccount } from "./BankAccount"; - -export const BankAccountVerifiedEventObject: core.serialization.ObjectSchema< - serializers.BankAccountVerifiedEventObject.Raw, - Square.BankAccountVerifiedEventObject -> = core.serialization.object({ - bankAccount: core.serialization.property("bank_account", BankAccount.optional()), -}); - -export declare namespace BankAccountVerifiedEventObject { - export interface Raw { - bank_account?: BankAccount.Raw | null; - } -} diff --git a/src/serialization/types/BatchChangeInventoryRequest.ts b/src/serialization/types/BatchChangeInventoryRequest.ts deleted file mode 100644 index e32418d37..000000000 --- a/src/serialization/types/BatchChangeInventoryRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 277e85771..000000000 --- a/src/serialization/types/BatchChangeInventoryResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9edb71dac..000000000 --- a/src/serialization/types/BatchCreateTeamMembersResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b23bfbbb0..000000000 --- a/src/serialization/types/BatchCreateVendorsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 53c0cdcdd..000000000 --- a/src/serialization/types/BatchDeleteCatalogObjectsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index de6f66a25..000000000 --- a/src/serialization/types/BatchGetCatalogObjectsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1a100da5a..000000000 --- a/src/serialization/types/BatchGetInventoryChangesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index eb8312bf6..000000000 --- a/src/serialization/types/BatchGetInventoryCountsRequest.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 030eab0a5..000000000 --- a/src/serialization/types/BatchGetInventoryCountsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3eb249da1..000000000 --- a/src/serialization/types/BatchGetOrdersResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9ece6ca65..000000000 --- a/src/serialization/types/BatchGetVendorsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9183e6d0d..000000000 --- a/src/serialization/types/BatchRetrieveInventoryChangesRequest.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index faa2d592f..000000000 --- a/src/serialization/types/BatchUpdateTeamMembersResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 88d932f61..000000000 --- a/src/serialization/types/BatchUpdateVendorsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 685418862..000000000 --- a/src/serialization/types/BatchUpsertCatalogObjectsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 888ed197a..000000000 --- a/src/serialization/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 62941923e..000000000 --- a/src/serialization/types/BatchUpsertCustomerCustomAttributesResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5f3a3fb24..000000000 --- a/src/serialization/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 91ef5f029..000000000 --- a/src/serialization/types/Booking.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b056aab33..000000000 --- a/src/serialization/types/BookingBookingSource.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/BookingCreatedEvent.ts b/src/serialization/types/BookingCreatedEvent.ts deleted file mode 100644 index 0b4853f56..000000000 --- a/src/serialization/types/BookingCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BookingCreatedEventData } from "./BookingCreatedEventData"; - -export const BookingCreatedEvent: core.serialization.ObjectSchema< - serializers.BookingCreatedEvent.Raw, - Square.BookingCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: BookingCreatedEventData.optional(), -}); - -export declare namespace BookingCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: BookingCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCreatedEventData.ts b/src/serialization/types/BookingCreatedEventData.ts deleted file mode 100644 index 2634c25da..000000000 --- a/src/serialization/types/BookingCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BookingCreatedEventObject } from "./BookingCreatedEventObject"; - -export const BookingCreatedEventData: core.serialization.ObjectSchema< - serializers.BookingCreatedEventData.Raw, - Square.BookingCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: BookingCreatedEventObject.optional(), -}); - -export declare namespace BookingCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: BookingCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/BookingCreatedEventObject.ts b/src/serialization/types/BookingCreatedEventObject.ts deleted file mode 100644 index 24f223757..000000000 --- a/src/serialization/types/BookingCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const BookingCreatedEventObject: core.serialization.ObjectSchema< - serializers.BookingCreatedEventObject.Raw, - Square.BookingCreatedEventObject -> = core.serialization.object({ - booking: Booking.optional(), -}); - -export declare namespace BookingCreatedEventObject { - export interface Raw { - booking?: Booking.Raw | null; - } -} diff --git a/src/serialization/types/BookingCreatorDetails.ts b/src/serialization/types/BookingCreatorDetails.ts deleted file mode 100644 index cd64d6781..000000000 --- a/src/serialization/types/BookingCreatorDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a7b1a513a..000000000 --- a/src/serialization/types/BookingCreatorDetailsCreatorType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/BookingCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/serialization/types/BookingCustomAttributeDefinitionOwnedCreatedEvent.ts deleted file mode 100644 index 32240578b..000000000 --- a/src/serialization/types/BookingCustomAttributeDefinitionOwnedCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const BookingCustomAttributeDefinitionOwnedCreatedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeDefinitionOwnedCreatedEvent.Raw, - Square.BookingCustomAttributeDefinitionOwnedCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace BookingCustomAttributeDefinitionOwnedCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/serialization/types/BookingCustomAttributeDefinitionOwnedDeletedEvent.ts deleted file mode 100644 index 33b42ada4..000000000 --- a/src/serialization/types/BookingCustomAttributeDefinitionOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const BookingCustomAttributeDefinitionOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeDefinitionOwnedDeletedEvent.Raw, - Square.BookingCustomAttributeDefinitionOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace BookingCustomAttributeDefinitionOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/serialization/types/BookingCustomAttributeDefinitionOwnedUpdatedEvent.ts deleted file mode 100644 index 42143c6fb..000000000 --- a/src/serialization/types/BookingCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const BookingCustomAttributeDefinitionOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeDefinitionOwnedUpdatedEvent.Raw, - Square.BookingCustomAttributeDefinitionOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace BookingCustomAttributeDefinitionOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/serialization/types/BookingCustomAttributeDefinitionVisibleCreatedEvent.ts deleted file mode 100644 index 92130d330..000000000 --- a/src/serialization/types/BookingCustomAttributeDefinitionVisibleCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const BookingCustomAttributeDefinitionVisibleCreatedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeDefinitionVisibleCreatedEvent.Raw, - Square.BookingCustomAttributeDefinitionVisibleCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace BookingCustomAttributeDefinitionVisibleCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/serialization/types/BookingCustomAttributeDefinitionVisibleDeletedEvent.ts deleted file mode 100644 index 97f7b7586..000000000 --- a/src/serialization/types/BookingCustomAttributeDefinitionVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const BookingCustomAttributeDefinitionVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeDefinitionVisibleDeletedEvent.Raw, - Square.BookingCustomAttributeDefinitionVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace BookingCustomAttributeDefinitionVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/serialization/types/BookingCustomAttributeDefinitionVisibleUpdatedEvent.ts deleted file mode 100644 index dcdef9d35..000000000 --- a/src/serialization/types/BookingCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const BookingCustomAttributeDefinitionVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeDefinitionVisibleUpdatedEvent.Raw, - Square.BookingCustomAttributeDefinitionVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace BookingCustomAttributeDefinitionVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeDeleteRequest.ts b/src/serialization/types/BookingCustomAttributeDeleteRequest.ts deleted file mode 100644 index 0700eb5e3..000000000 --- a/src/serialization/types/BookingCustomAttributeDeleteRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c0703fe23..000000000 --- a/src/serialization/types/BookingCustomAttributeDeleteResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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/BookingCustomAttributeOwnedDeletedEvent.ts b/src/serialization/types/BookingCustomAttributeOwnedDeletedEvent.ts deleted file mode 100644 index c3aa6d573..000000000 --- a/src/serialization/types/BookingCustomAttributeOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const BookingCustomAttributeOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeOwnedDeletedEvent.Raw, - Square.BookingCustomAttributeOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace BookingCustomAttributeOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeOwnedUpdatedEvent.ts b/src/serialization/types/BookingCustomAttributeOwnedUpdatedEvent.ts deleted file mode 100644 index 4d98023a8..000000000 --- a/src/serialization/types/BookingCustomAttributeOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const BookingCustomAttributeOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeOwnedUpdatedEvent.Raw, - Square.BookingCustomAttributeOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace BookingCustomAttributeOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeUpsertRequest.ts b/src/serialization/types/BookingCustomAttributeUpsertRequest.ts deleted file mode 100644 index 4a794c637..000000000 --- a/src/serialization/types/BookingCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7d26a7ecd..000000000 --- a/src/serialization/types/BookingCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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/BookingCustomAttributeVisibleDeletedEvent.ts b/src/serialization/types/BookingCustomAttributeVisibleDeletedEvent.ts deleted file mode 100644 index 586fef885..000000000 --- a/src/serialization/types/BookingCustomAttributeVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const BookingCustomAttributeVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeVisibleDeletedEvent.Raw, - Square.BookingCustomAttributeVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace BookingCustomAttributeVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingCustomAttributeVisibleUpdatedEvent.ts b/src/serialization/types/BookingCustomAttributeVisibleUpdatedEvent.ts deleted file mode 100644 index 5cd434ad0..000000000 --- a/src/serialization/types/BookingCustomAttributeVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const BookingCustomAttributeVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.BookingCustomAttributeVisibleUpdatedEvent.Raw, - Square.BookingCustomAttributeVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace BookingCustomAttributeVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingStatus.ts b/src/serialization/types/BookingStatus.ts deleted file mode 100644 index 23f9f5841..000000000 --- a/src/serialization/types/BookingStatus.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated 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/BookingUpdatedEvent.ts b/src/serialization/types/BookingUpdatedEvent.ts deleted file mode 100644 index 5b7414856..000000000 --- a/src/serialization/types/BookingUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BookingUpdatedEventData } from "./BookingUpdatedEventData"; - -export const BookingUpdatedEvent: core.serialization.ObjectSchema< - serializers.BookingUpdatedEvent.Raw, - Square.BookingUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: BookingUpdatedEventData.optional(), -}); - -export declare namespace BookingUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: BookingUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/BookingUpdatedEventData.ts b/src/serialization/types/BookingUpdatedEventData.ts deleted file mode 100644 index 1e4adbe2e..000000000 --- a/src/serialization/types/BookingUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { BookingUpdatedEventObject } from "./BookingUpdatedEventObject"; - -export const BookingUpdatedEventData: core.serialization.ObjectSchema< - serializers.BookingUpdatedEventData.Raw, - Square.BookingUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: BookingUpdatedEventObject.optional(), -}); - -export declare namespace BookingUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: BookingUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/BookingUpdatedEventObject.ts b/src/serialization/types/BookingUpdatedEventObject.ts deleted file mode 100644 index 5dcf7f4cc..000000000 --- a/src/serialization/types/BookingUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const BookingUpdatedEventObject: core.serialization.ObjectSchema< - serializers.BookingUpdatedEventObject.Raw, - Square.BookingUpdatedEventObject -> = core.serialization.object({ - booking: Booking.optional(), -}); - -export declare namespace BookingUpdatedEventObject { - export interface Raw { - booking?: Booking.Raw | null; - } -} diff --git a/src/serialization/types/Break.ts b/src/serialization/types/Break.ts deleted file mode 100644 index 3490d3e2d..000000000 --- a/src/serialization/types/Break.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 391ff6e5d..000000000 --- a/src/serialization/types/BreakType.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8cf11f262..000000000 --- a/src/serialization/types/BulkCreateCustomerData.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 54f9631e5..000000000 --- a/src/serialization/types/BulkCreateCustomersResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 194589a54..000000000 --- a/src/serialization/types/BulkDeleteBookingCustomAttributesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a14b5cdbc..000000000 --- a/src/serialization/types/BulkDeleteCustomersResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8ec39ae53..000000000 --- a/src/serialization/types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8e7a81dff..000000000 --- a/src/serialization/types/BulkDeleteLocationCustomAttributesResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 22d88c11a..000000000 --- a/src/serialization/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2ccbd2d85..000000000 --- a/src/serialization/types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c03b88e57..000000000 --- a/src/serialization/types/BulkDeleteMerchantCustomAttributesResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f6923054b..000000000 --- a/src/serialization/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c7d3eea93..000000000 --- a/src/serialization/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 09cb65491..000000000 --- a/src/serialization/types/BulkDeleteOrderCustomAttributesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/BulkPublishScheduledShiftsData.ts b/src/serialization/types/BulkPublishScheduledShiftsData.ts deleted file mode 100644 index 4d241bb60..000000000 --- a/src/serialization/types/BulkPublishScheduledShiftsData.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const BulkPublishScheduledShiftsData: core.serialization.ObjectSchema< - serializers.BulkPublishScheduledShiftsData.Raw, - Square.BulkPublishScheduledShiftsData -> = core.serialization.object({ - version: core.serialization.number().optional(), -}); - -export declare namespace BulkPublishScheduledShiftsData { - export interface Raw { - version?: number | null; - } -} diff --git a/src/serialization/types/BulkPublishScheduledShiftsResponse.ts b/src/serialization/types/BulkPublishScheduledShiftsResponse.ts deleted file mode 100644 index 4b47bd202..000000000 --- a/src/serialization/types/BulkPublishScheduledShiftsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PublishScheduledShiftResponse } from "./PublishScheduledShiftResponse"; -import { Error_ } from "./Error_"; - -export const BulkPublishScheduledShiftsResponse: core.serialization.ObjectSchema< - serializers.BulkPublishScheduledShiftsResponse.Raw, - Square.BulkPublishScheduledShiftsResponse -> = core.serialization.object({ - responses: core.serialization.record(core.serialization.string(), PublishScheduledShiftResponse).optional(), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace BulkPublishScheduledShiftsResponse { - export interface Raw { - responses?: Record | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/BulkRetrieveBookingsResponse.ts b/src/serialization/types/BulkRetrieveBookingsResponse.ts deleted file mode 100644 index 002ff6a60..000000000 --- a/src/serialization/types/BulkRetrieveBookingsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1a7485668..000000000 --- a/src/serialization/types/BulkRetrieveCustomersResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8853ea123..000000000 --- a/src/serialization/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7381468f1..000000000 --- a/src/serialization/types/BulkSwapPlanResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d496cc57a..000000000 --- a/src/serialization/types/BulkUpdateCustomerData.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 07cb6cb3e..000000000 --- a/src/serialization/types/BulkUpdateCustomersResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d155e7850..000000000 --- a/src/serialization/types/BulkUpsertBookingCustomAttributesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b4c2f7b5c..000000000 --- a/src/serialization/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 85a6fbbed..000000000 --- a/src/serialization/types/BulkUpsertLocationCustomAttributesResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2742b461c..000000000 --- a/src/serialization/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1a0307bc8..000000000 --- a/src/serialization/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 14fdbfe1d..000000000 --- a/src/serialization/types/BulkUpsertMerchantCustomAttributesResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 479912102..000000000 --- a/src/serialization/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 01fb99457..000000000 --- a/src/serialization/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 814fb79fa..000000000 --- a/src/serialization/types/BulkUpsertOrderCustomAttributesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bcb5b8250..000000000 --- a/src/serialization/types/BusinessAppointmentSettings.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b0eaf681a..000000000 --- a/src/serialization/types/BusinessAppointmentSettingsAlignmentTime.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bcb0aa343..000000000 --- a/src/serialization/types/BusinessAppointmentSettingsBookingLocationType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 018750741..000000000 --- a/src/serialization/types/BusinessAppointmentSettingsCancellationPolicy.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8441815be..000000000 --- a/src/serialization/types/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4176f585b..000000000 --- a/src/serialization/types/BusinessBookingProfile.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 26f3122b0..000000000 --- a/src/serialization/types/BusinessBookingProfileBookingPolicy.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e4b5e2f3c..000000000 --- a/src/serialization/types/BusinessBookingProfileCustomerTimezoneChoice.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 56f2933eb..000000000 --- a/src/serialization/types/BusinessHours.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 40b8a7c3f..000000000 --- a/src/serialization/types/BusinessHoursPeriod.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 85ad8fef6..000000000 --- a/src/serialization/types/BuyNowPayLaterDetails.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f55b9a1e9..000000000 --- a/src/serialization/types/CalculateLoyaltyPointsResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 71bf0952f..000000000 --- a/src/serialization/types/CalculateOrderResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7a455c8f3..000000000 --- a/src/serialization/types/CancelBookingResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e85152eca..000000000 --- a/src/serialization/types/CancelInvoiceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fe7840e2a..000000000 --- a/src/serialization/types/CancelLoyaltyPromotionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 993515cc7..000000000 --- a/src/serialization/types/CancelPaymentByIdempotencyKeyResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ba792ef0a..000000000 --- a/src/serialization/types/CancelPaymentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bb2577e84..000000000 --- a/src/serialization/types/CancelSubscriptionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e3b133ea0..000000000 --- a/src/serialization/types/CancelTerminalActionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b596aea2b..000000000 --- a/src/serialization/types/CancelTerminalCheckoutResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 744ed00a3..000000000 --- a/src/serialization/types/CancelTerminalRefundResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 548384cf9..000000000 --- a/src/serialization/types/CaptureTransactionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 655f7e139..000000000 --- a/src/serialization/types/Card.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file was auto-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"; -import { CardIssuerAlert } from "./CardIssuerAlert"; - -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()), - issuerAlert: core.serialization.property("issuer_alert", CardIssuerAlert.optional()), - issuerAlertAt: core.serialization.property("issuer_alert_at", core.serialization.string().optional()), - hsaFsa: core.serialization.property("hsa_fsa", core.serialization.boolean().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; - issuer_alert?: CardIssuerAlert.Raw | null; - issuer_alert_at?: string | null; - hsa_fsa?: boolean | null; - } -} diff --git a/src/serialization/types/CardAutomaticallyUpdatedEvent.ts b/src/serialization/types/CardAutomaticallyUpdatedEvent.ts deleted file mode 100644 index c99f5340c..000000000 --- a/src/serialization/types/CardAutomaticallyUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardAutomaticallyUpdatedEventData } from "./CardAutomaticallyUpdatedEventData"; - -export const CardAutomaticallyUpdatedEvent: core.serialization.ObjectSchema< - serializers.CardAutomaticallyUpdatedEvent.Raw, - Square.CardAutomaticallyUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CardAutomaticallyUpdatedEventData.optional(), -}); - -export declare namespace CardAutomaticallyUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CardAutomaticallyUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/CardAutomaticallyUpdatedEventData.ts b/src/serialization/types/CardAutomaticallyUpdatedEventData.ts deleted file mode 100644 index c785306c8..000000000 --- a/src/serialization/types/CardAutomaticallyUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardAutomaticallyUpdatedEventObject } from "./CardAutomaticallyUpdatedEventObject"; - -export const CardAutomaticallyUpdatedEventData: core.serialization.ObjectSchema< - serializers.CardAutomaticallyUpdatedEventData.Raw, - Square.CardAutomaticallyUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CardAutomaticallyUpdatedEventObject.optional(), -}); - -export declare namespace CardAutomaticallyUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CardAutomaticallyUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CardAutomaticallyUpdatedEventObject.ts b/src/serialization/types/CardAutomaticallyUpdatedEventObject.ts deleted file mode 100644 index c326dd874..000000000 --- a/src/serialization/types/CardAutomaticallyUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 CardAutomaticallyUpdatedEventObject: core.serialization.ObjectSchema< - serializers.CardAutomaticallyUpdatedEventObject.Raw, - Square.CardAutomaticallyUpdatedEventObject -> = core.serialization.object({ - card: Card.optional(), -}); - -export declare namespace CardAutomaticallyUpdatedEventObject { - export interface Raw { - card?: Card.Raw | null; - } -} diff --git a/src/serialization/types/CardBrand.ts b/src/serialization/types/CardBrand.ts deleted file mode 100644 index c42e88c83..000000000 --- a/src/serialization/types/CardBrand.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 61e447c20..000000000 --- a/src/serialization/types/CardCoBrand.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/CardCreatedEvent.ts b/src/serialization/types/CardCreatedEvent.ts deleted file mode 100644 index b028b724b..000000000 --- a/src/serialization/types/CardCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardCreatedEventData } from "./CardCreatedEventData"; - -export const CardCreatedEvent: core.serialization.ObjectSchema< - serializers.CardCreatedEvent.Raw, - Square.CardCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CardCreatedEventData.optional(), -}); - -export declare namespace CardCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CardCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/CardCreatedEventData.ts b/src/serialization/types/CardCreatedEventData.ts deleted file mode 100644 index 862a2f3be..000000000 --- a/src/serialization/types/CardCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardCreatedEventObject } from "./CardCreatedEventObject"; - -export const CardCreatedEventData: core.serialization.ObjectSchema< - serializers.CardCreatedEventData.Raw, - Square.CardCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CardCreatedEventObject.optional(), -}); - -export declare namespace CardCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CardCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CardCreatedEventObject.ts b/src/serialization/types/CardCreatedEventObject.ts deleted file mode 100644 index 3899a5f66..000000000 --- a/src/serialization/types/CardCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 CardCreatedEventObject: core.serialization.ObjectSchema< - serializers.CardCreatedEventObject.Raw, - Square.CardCreatedEventObject -> = core.serialization.object({ - card: Card.optional(), -}); - -export declare namespace CardCreatedEventObject { - export interface Raw { - card?: Card.Raw | null; - } -} diff --git a/src/serialization/types/CardDisabledEvent.ts b/src/serialization/types/CardDisabledEvent.ts deleted file mode 100644 index 5db7cd7b1..000000000 --- a/src/serialization/types/CardDisabledEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardDisabledEventData } from "./CardDisabledEventData"; - -export const CardDisabledEvent: core.serialization.ObjectSchema< - serializers.CardDisabledEvent.Raw, - Square.CardDisabledEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CardDisabledEventData.optional(), -}); - -export declare namespace CardDisabledEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CardDisabledEventData.Raw | null; - } -} diff --git a/src/serialization/types/CardDisabledEventData.ts b/src/serialization/types/CardDisabledEventData.ts deleted file mode 100644 index ef3a1e42b..000000000 --- a/src/serialization/types/CardDisabledEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardDisabledEventObject } from "./CardDisabledEventObject"; - -export const CardDisabledEventData: core.serialization.ObjectSchema< - serializers.CardDisabledEventData.Raw, - Square.CardDisabledEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CardDisabledEventObject.optional(), -}); - -export declare namespace CardDisabledEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CardDisabledEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CardDisabledEventObject.ts b/src/serialization/types/CardDisabledEventObject.ts deleted file mode 100644 index 9e3b79fa9..000000000 --- a/src/serialization/types/CardDisabledEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 CardDisabledEventObject: core.serialization.ObjectSchema< - serializers.CardDisabledEventObject.Raw, - Square.CardDisabledEventObject -> = core.serialization.object({ - card: Card.optional(), -}); - -export declare namespace CardDisabledEventObject { - export interface Raw { - card?: Card.Raw | null; - } -} diff --git a/src/serialization/types/CardForgottenEvent.ts b/src/serialization/types/CardForgottenEvent.ts deleted file mode 100644 index f13d157f2..000000000 --- a/src/serialization/types/CardForgottenEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardForgottenEventData } from "./CardForgottenEventData"; - -export const CardForgottenEvent: core.serialization.ObjectSchema< - serializers.CardForgottenEvent.Raw, - Square.CardForgottenEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CardForgottenEventData.optional(), -}); - -export declare namespace CardForgottenEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CardForgottenEventData.Raw | null; - } -} diff --git a/src/serialization/types/CardForgottenEventCard.ts b/src/serialization/types/CardForgottenEventCard.ts deleted file mode 100644 index 4e246906e..000000000 --- a/src/serialization/types/CardForgottenEventCard.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const CardForgottenEventCard: core.serialization.ObjectSchema< - serializers.CardForgottenEventCard.Raw, - Square.CardForgottenEventCard -> = core.serialization.object({ - id: core.serialization.string().optional(), - customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), - enabled: core.serialization.boolean().optionalNullable(), - referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), - version: core.serialization.bigint().optional(), - merchantId: core.serialization.property("merchant_id", core.serialization.string().optionalNullable()), -}); - -export declare namespace CardForgottenEventCard { - export interface Raw { - id?: string | null; - customer_id?: (string | null) | null; - enabled?: (boolean | null) | null; - reference_id?: (string | null) | null; - version?: (bigint | number) | null; - merchant_id?: (string | null) | null; - } -} diff --git a/src/serialization/types/CardForgottenEventData.ts b/src/serialization/types/CardForgottenEventData.ts deleted file mode 100644 index fd8adc9f8..000000000 --- a/src/serialization/types/CardForgottenEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardForgottenEventObject } from "./CardForgottenEventObject"; - -export const CardForgottenEventData: core.serialization.ObjectSchema< - serializers.CardForgottenEventData.Raw, - Square.CardForgottenEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CardForgottenEventObject.optional(), -}); - -export declare namespace CardForgottenEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CardForgottenEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CardForgottenEventObject.ts b/src/serialization/types/CardForgottenEventObject.ts deleted file mode 100644 index fc22e5208..000000000 --- a/src/serialization/types/CardForgottenEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardForgottenEventCard } from "./CardForgottenEventCard"; - -export const CardForgottenEventObject: core.serialization.ObjectSchema< - serializers.CardForgottenEventObject.Raw, - Square.CardForgottenEventObject -> = core.serialization.object({ - card: CardForgottenEventCard.optional(), -}); - -export declare namespace CardForgottenEventObject { - export interface Raw { - card?: CardForgottenEventCard.Raw | null; - } -} diff --git a/src/serialization/types/CardIssuerAlert.ts b/src/serialization/types/CardIssuerAlert.ts deleted file mode 100644 index 2eb7755cd..000000000 --- a/src/serialization/types/CardIssuerAlert.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const CardIssuerAlert: core.serialization.Schema = - core.serialization.stringLiteral("ISSUER_ALERT_CARD_CLOSED"); - -export declare namespace CardIssuerAlert { - export type Raw = "ISSUER_ALERT_CARD_CLOSED"; -} diff --git a/src/serialization/types/CardPaymentDetails.ts b/src/serialization/types/CardPaymentDetails.ts deleted file mode 100644 index a7be16b2c..000000000 --- a/src/serialization/types/CardPaymentDetails.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8c3915d0c..000000000 --- a/src/serialization/types/CardPaymentTimeline.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5a5e94558..000000000 --- a/src/serialization/types/CardPrepaidType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c3f72ee5a..000000000 --- a/src/serialization/types/CardType.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated 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/CardUpdatedEvent.ts b/src/serialization/types/CardUpdatedEvent.ts deleted file mode 100644 index e5cd408bf..000000000 --- a/src/serialization/types/CardUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardUpdatedEventData } from "./CardUpdatedEventData"; - -export const CardUpdatedEvent: core.serialization.ObjectSchema< - serializers.CardUpdatedEvent.Raw, - Square.CardUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CardUpdatedEventData.optional(), -}); - -export declare namespace CardUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CardUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/CardUpdatedEventData.ts b/src/serialization/types/CardUpdatedEventData.ts deleted file mode 100644 index 3cd16e1cb..000000000 --- a/src/serialization/types/CardUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CardUpdatedEventObject } from "./CardUpdatedEventObject"; - -export const CardUpdatedEventData: core.serialization.ObjectSchema< - serializers.CardUpdatedEventData.Raw, - Square.CardUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CardUpdatedEventObject.optional(), -}); - -export declare namespace CardUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CardUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CardUpdatedEventObject.ts b/src/serialization/types/CardUpdatedEventObject.ts deleted file mode 100644 index 4609f9e56..000000000 --- a/src/serialization/types/CardUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 CardUpdatedEventObject: core.serialization.ObjectSchema< - serializers.CardUpdatedEventObject.Raw, - Square.CardUpdatedEventObject -> = core.serialization.object({ - card: Card.optional(), -}); - -export declare namespace CardUpdatedEventObject { - export interface Raw { - card?: Card.Raw | null; - } -} diff --git a/src/serialization/types/CashAppDetails.ts b/src/serialization/types/CashAppDetails.ts deleted file mode 100644 index 0697dd1c6..000000000 --- a/src/serialization/types/CashAppDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a55a13035..000000000 --- a/src/serialization/types/CashDrawerDevice.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 79983e9a0..000000000 --- a/src/serialization/types/CashDrawerEventType.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b39d3ca00..000000000 --- a/src/serialization/types/CashDrawerShift.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 985d7ba91..000000000 --- a/src/serialization/types/CashDrawerShiftEvent.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b12dcc804..000000000 --- a/src/serialization/types/CashDrawerShiftState.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e9d476cac..000000000 --- a/src/serialization/types/CashDrawerShiftSummary.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 022fc849c..000000000 --- a/src/serialization/types/CashPaymentDetails.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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/CatalogAvailabilityPeriod.ts b/src/serialization/types/CatalogAvailabilityPeriod.ts deleted file mode 100644 index c775afe16..000000000 --- a/src/serialization/types/CatalogAvailabilityPeriod.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 CatalogAvailabilityPeriod: core.serialization.ObjectSchema< - serializers.CatalogAvailabilityPeriod.Raw, - Square.CatalogAvailabilityPeriod -> = core.serialization.object({ - startLocalTime: core.serialization.property("start_local_time", core.serialization.string().optionalNullable()), - endLocalTime: core.serialization.property("end_local_time", core.serialization.string().optionalNullable()), - dayOfWeek: core.serialization.property("day_of_week", DayOfWeek.optional()), -}); - -export declare namespace CatalogAvailabilityPeriod { - export interface Raw { - start_local_time?: (string | null) | null; - end_local_time?: (string | null) | null; - day_of_week?: DayOfWeek.Raw | null; - } -} diff --git a/src/serialization/types/CatalogCategory.ts b/src/serialization/types/CatalogCategory.ts deleted file mode 100644 index 98df942d4..000000000 --- a/src/serialization/types/CatalogCategory.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 46d0a9ab3..000000000 --- a/src/serialization/types/CatalogCategoryType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 02345011a..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinition.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 97622631e..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinitionAppVisibility.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9b15f9a9c..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinitionNumberConfig.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c6a22512b..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfig.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d2d9d82f5..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index fc326e897..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinitionSellerVisibility.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ed84b6f74..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinitionStringConfig.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5a2a0a6be..000000000 --- a/src/serialization/types/CatalogCustomAttributeDefinitionType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d9830affe..000000000 --- a/src/serialization/types/CatalogCustomAttributeValue.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9a6802976..000000000 --- a/src/serialization/types/CatalogDiscount.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f53e989e0..000000000 --- a/src/serialization/types/CatalogDiscountModifyTaxBasis.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 76db66523..000000000 --- a/src/serialization/types/CatalogDiscountType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 196225162..000000000 --- a/src/serialization/types/CatalogEcomSeoData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7ca9c3e72..000000000 --- a/src/serialization/types/CatalogIdMapping.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8eaa56d15..000000000 --- a/src/serialization/types/CatalogImage.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4c2786890..000000000 --- a/src/serialization/types/CatalogInfoResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 34db48aa2..000000000 --- a/src/serialization/types/CatalogInfoResponseLimits.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0b061d922..000000000 --- a/src/serialization/types/CatalogItem.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * This file was auto-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(), - ), - ecomUri: core.serialization.property("ecom_uri", core.serialization.string().optionalNullable()), - ecomImageUris: core.serialization.property( - "ecom_image_uris", - core.serialization.list(core.serialization.string()).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(), - ), - isAlcoholic: core.serialization.property("is_alcoholic", core.serialization.boolean().optionalNullable()), - }); - -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; - ecom_uri?: (string | null) | null; - ecom_image_uris?: (string[] | 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; - is_alcoholic?: (boolean | null) | null; - } -} diff --git a/src/serialization/types/CatalogItemFoodAndBeverageDetails.ts b/src/serialization/types/CatalogItemFoodAndBeverageDetails.ts deleted file mode 100644 index 776ed1b02..000000000 --- a/src/serialization/types/CatalogItemFoodAndBeverageDetails.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 19e9da00e..000000000 --- a/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 67261ced3..000000000 --- a/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7e33670ab..000000000 --- a/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 04d48767d..000000000 --- a/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredient.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4a7c678e0..000000000 --- a/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 142c5805a..000000000 --- a/src/serialization/types/CatalogItemModifierListInfo.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * This file was auto-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(), - allowQuantities: core.serialization.property("allow_quantities", core.serialization.unknown().optional()), - isConversational: core.serialization.property("is_conversational", core.serialization.unknown().optional()), - hiddenFromCustomerOverride: core.serialization.property( - "hidden_from_customer_override", - core.serialization.unknown().optional(), - ), -}); - -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; - allow_quantities?: unknown | null; - is_conversational?: unknown | null; - hidden_from_customer_override?: unknown | null; - } -} diff --git a/src/serialization/types/CatalogItemOption.ts b/src/serialization/types/CatalogItemOption.ts deleted file mode 100644 index 57a18615f..000000000 --- a/src/serialization/types/CatalogItemOption.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 844285eb1..000000000 --- a/src/serialization/types/CatalogItemOptionForItem.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 50dfac084..000000000 --- a/src/serialization/types/CatalogItemOptionValue.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a4350351e..000000000 --- a/src/serialization/types/CatalogItemOptionValueForItemVariation.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 41da19f71..000000000 --- a/src/serialization/types/CatalogItemProductType.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b89079ec8..000000000 --- a/src/serialization/types/CatalogItemVariation.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1047c2a3d..000000000 --- a/src/serialization/types/CatalogMeasurementUnit.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 23c52923e..000000000 --- a/src/serialization/types/CatalogModifier.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-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()), - onByDefault: core.serialization.property("on_by_default", core.serialization.boolean().optionalNullable()), - 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()), - hiddenOnline: core.serialization.property("hidden_online", core.serialization.boolean().optionalNullable()), - }); - -export declare namespace CatalogModifier { - export interface Raw { - name?: (string | null) | null; - price_money?: Money.Raw | null; - on_by_default?: (boolean | null) | null; - ordinal?: (number | null) | null; - modifier_list_id?: (string | null) | null; - location_overrides?: (ModifierLocationOverrides.Raw[] | null) | null; - image_id?: (string | null) | null; - hidden_online?: (boolean | null) | null; - } -} diff --git a/src/serialization/types/CatalogModifierList.ts b/src/serialization/types/CatalogModifierList.ts deleted file mode 100644 index dc9c7fa5b..000000000 --- a/src/serialization/types/CatalogModifierList.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * This file was auto-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(), - ), - allowQuantities: core.serialization.property("allow_quantities", core.serialization.boolean().optionalNullable()), - isConversational: core.serialization.property("is_conversational", core.serialization.boolean().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()), - minSelectedModifiers: core.serialization.property( - "min_selected_modifiers", - core.serialization.bigint().optionalNullable(), - ), - maxSelectedModifiers: core.serialization.property( - "max_selected_modifiers", - core.serialization.bigint().optionalNullable(), - ), - hiddenFromCustomer: core.serialization.property( - "hidden_from_customer", - core.serialization.boolean().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; - allow_quantities?: (boolean | null) | null; - is_conversational?: (boolean | null) | null; - modifier_type?: CatalogModifierListModifierType.Raw | null; - max_length?: (number | null) | null; - text_required?: (boolean | null) | null; - internal_name?: (string | null) | null; - min_selected_modifiers?: ((bigint | number) | null) | null; - max_selected_modifiers?: ((bigint | number) | null) | null; - hidden_from_customer?: (boolean | null) | null; - } -} diff --git a/src/serialization/types/CatalogModifierListModifierType.ts b/src/serialization/types/CatalogModifierListModifierType.ts deleted file mode 100644 index 969fa2606..000000000 --- a/src/serialization/types/CatalogModifierListModifierType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 87a0c1fc5..000000000 --- a/src/serialization/types/CatalogModifierListSelectionType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 32e7128f8..000000000 --- a/src/serialization/types/CatalogModifierOverride.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated 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()), - hiddenOnlineOverride: core.serialization.property( - "hidden_online_override", - core.serialization.unknown().optional(), - ), - onByDefaultOverride: core.serialization.property("on_by_default_override", core.serialization.unknown().optional()), -}); - -export declare namespace CatalogModifierOverride { - export interface Raw { - modifier_id: string; - on_by_default?: (boolean | null) | null; - hidden_online_override?: unknown | null; - on_by_default_override?: unknown | null; - } -} diff --git a/src/serialization/types/CatalogObject.ts b/src/serialization/types/CatalogObject.ts deleted file mode 100644 index 6348fba13..000000000 --- a/src/serialization/types/CatalogObject.ts +++ /dev/null @@ -1,148 +0,0 @@ -/** - * This file was auto-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 { CatalogObjectPricingRule } from "./CatalogObjectPricingRule"; -import { CatalogObjectProductSet } from "./CatalogObjectProductSet"; -import { CatalogObjectTimePeriod } from "./CatalogObjectTimePeriod"; -import { CatalogObjectMeasurementUnit } from "./CatalogObjectMeasurementUnit"; -import { CatalogObjectSubscriptionPlanVariation } from "./CatalogObjectSubscriptionPlanVariation"; -import { CatalogObjectItemOptionValue } from "./CatalogObjectItemOptionValue"; -import { CatalogObjectCustomAttributeDefinition } from "./CatalogObjectCustomAttributeDefinition"; -import { CatalogObjectQuickAmountsSettings } from "./CatalogObjectQuickAmountsSettings"; -import { CatalogObjectAvailabilityPeriod } from "./CatalogObjectAvailabilityPeriod"; - -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, - PRICING_RULE: CatalogObjectPricingRule, - PRODUCT_SET: CatalogObjectProductSet, - TIME_PERIOD: CatalogObjectTimePeriod, - MEASUREMENT_UNIT: CatalogObjectMeasurementUnit, - SUBSCRIPTION_PLAN_VARIATION: CatalogObjectSubscriptionPlanVariation, - ITEM_OPTION: core.serialization.lazyObject(() => serializers.CatalogObjectItemOption), - ITEM_OPTION_VAL: CatalogObjectItemOptionValue, - CUSTOM_ATTRIBUTE_DEFINITION: CatalogObjectCustomAttributeDefinition, - QUICK_AMOUNTS_SETTINGS: CatalogObjectQuickAmountsSettings, - SUBSCRIPTION_PLAN: core.serialization.lazyObject(() => serializers.CatalogObjectSubscriptionPlan), - AVAILABILITY_PERIOD: CatalogObjectAvailabilityPeriod, - }) - .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.PricingRule - | CatalogObject.ProductSet - | CatalogObject.TimePeriod - | CatalogObject.MeasurementUnit - | CatalogObject.SubscriptionPlanVariation - | CatalogObject.ItemOption - | CatalogObject.ItemOptionVal - | CatalogObject.CustomAttributeDefinition - | CatalogObject.QuickAmountsSettings - | CatalogObject.SubscriptionPlan - | CatalogObject.AvailabilityPeriod; - - 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 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 SubscriptionPlanVariation extends CatalogObjectSubscriptionPlanVariation.Raw { - type: "SUBSCRIPTION_PLAN_VARIATION"; - } - - 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 SubscriptionPlan extends serializers.CatalogObjectSubscriptionPlan.Raw { - type: "SUBSCRIPTION_PLAN"; - } - - export interface AvailabilityPeriod extends CatalogObjectAvailabilityPeriod.Raw { - type: "AVAILABILITY_PERIOD"; - } -} diff --git a/src/serialization/types/CatalogObjectAvailabilityPeriod.ts b/src/serialization/types/CatalogObjectAvailabilityPeriod.ts deleted file mode 100644 index cd9824124..000000000 --- a/src/serialization/types/CatalogObjectAvailabilityPeriod.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CatalogAvailabilityPeriod } from "./CatalogAvailabilityPeriod"; -import { CatalogObjectBase } from "./CatalogObjectBase"; - -export const CatalogObjectAvailabilityPeriod: core.serialization.ObjectSchema< - serializers.CatalogObjectAvailabilityPeriod.Raw, - Square.CatalogObjectAvailabilityPeriod -> = core.serialization - .object({ - availabilityPeriodData: core.serialization.property( - "availability_period_data", - CatalogAvailabilityPeriod.optional(), - ), - }) - .extend(CatalogObjectBase); - -export declare namespace CatalogObjectAvailabilityPeriod { - export interface Raw extends CatalogObjectBase.Raw { - availability_period_data?: CatalogAvailabilityPeriod.Raw | null; - } -} diff --git a/src/serialization/types/CatalogObjectBase.ts b/src/serialization/types/CatalogObjectBase.ts deleted file mode 100644 index 05fba814b..000000000 --- a/src/serialization/types/CatalogObjectBase.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 74f6e1640..000000000 --- a/src/serialization/types/CatalogObjectBatch.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f23ff7cb7..000000000 --- a/src/serialization/types/CatalogObjectCategory.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file was auto-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/CatalogObjectCustomAttributeDefinition.ts b/src/serialization/types/CatalogObjectCustomAttributeDefinition.ts deleted file mode 100644 index d2857d7e0..000000000 --- a/src/serialization/types/CatalogObjectCustomAttributeDefinition.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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/CatalogObjectDiscount.ts b/src/serialization/types/CatalogObjectDiscount.ts deleted file mode 100644 index 8fa372b7f..000000000 --- a/src/serialization/types/CatalogObjectDiscount.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8fed46189..000000000 --- a/src/serialization/types/CatalogObjectImage.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b7b91e20f..000000000 --- a/src/serialization/types/CatalogObjectItem.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fa36313a8..000000000 --- a/src/serialization/types/CatalogObjectItemOption.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7326bfd59..000000000 --- a/src/serialization/types/CatalogObjectItemOptionValue.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 88d8f4c80..000000000 --- a/src/serialization/types/CatalogObjectItemVariation.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 753f727e8..000000000 --- a/src/serialization/types/CatalogObjectMeasurementUnit.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c2e146e43..000000000 --- a/src/serialization/types/CatalogObjectModifier.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0e98634e9..000000000 --- a/src/serialization/types/CatalogObjectModifierList.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 442c3483c..000000000 --- a/src/serialization/types/CatalogObjectPricingRule.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 862eda0e1..000000000 --- a/src/serialization/types/CatalogObjectProductSet.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 34ca8497d..000000000 --- a/src/serialization/types/CatalogObjectQuickAmountsSettings.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c7e20761c..000000000 --- a/src/serialization/types/CatalogObjectReference.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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/CatalogObjectSubscriptionPlan.ts b/src/serialization/types/CatalogObjectSubscriptionPlan.ts deleted file mode 100644 index ac4fffc44..000000000 --- a/src/serialization/types/CatalogObjectSubscriptionPlan.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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/CatalogObjectSubscriptionPlanVariation.ts b/src/serialization/types/CatalogObjectSubscriptionPlanVariation.ts deleted file mode 100644 index e21dca783..000000000 --- a/src/serialization/types/CatalogObjectSubscriptionPlanVariation.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CatalogSubscriptionPlanVariation } from "./CatalogSubscriptionPlanVariation"; -import { CatalogObjectBase } from "./CatalogObjectBase"; - -export const CatalogObjectSubscriptionPlanVariation: core.serialization.ObjectSchema< - serializers.CatalogObjectSubscriptionPlanVariation.Raw, - Square.CatalogObjectSubscriptionPlanVariation -> = core.serialization - .object({ - subscriptionPlanVariationData: core.serialization.property( - "subscription_plan_variation_data", - CatalogSubscriptionPlanVariation.optional(), - ), - }) - .extend(CatalogObjectBase); - -export declare namespace CatalogObjectSubscriptionPlanVariation { - export interface Raw extends CatalogObjectBase.Raw { - subscription_plan_variation_data?: CatalogSubscriptionPlanVariation.Raw | null; - } -} diff --git a/src/serialization/types/CatalogObjectTax.ts b/src/serialization/types/CatalogObjectTax.ts deleted file mode 100644 index 890d0cb15..000000000 --- a/src/serialization/types/CatalogObjectTax.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/CatalogObjectTimePeriod.ts b/src/serialization/types/CatalogObjectTimePeriod.ts deleted file mode 100644 index b199b9374..000000000 --- a/src/serialization/types/CatalogObjectTimePeriod.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 178202e9d..000000000 --- a/src/serialization/types/CatalogObjectType.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 083f32b61..000000000 --- a/src/serialization/types/CatalogPricingRule.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3a4a30619..000000000 --- a/src/serialization/types/CatalogPricingType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f8c98f1db..000000000 --- a/src/serialization/types/CatalogProductSet.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 120ca5426..000000000 --- a/src/serialization/types/CatalogQuery.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6e990610c..000000000 --- a/src/serialization/types/CatalogQueryExact.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9c2698c6d..000000000 --- a/src/serialization/types/CatalogQueryItemVariationsForItemOptionValues.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 820bc6bcd..000000000 --- a/src/serialization/types/CatalogQueryItemsForItemOptions.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bdf2752f9..000000000 --- a/src/serialization/types/CatalogQueryItemsForModifierList.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index de63f3cd6..000000000 --- a/src/serialization/types/CatalogQueryItemsForTax.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d3bb0198f..000000000 --- a/src/serialization/types/CatalogQueryPrefix.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0a62d5286..000000000 --- a/src/serialization/types/CatalogQueryRange.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0c42e01f7..000000000 --- a/src/serialization/types/CatalogQuerySet.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5ff24ef07..000000000 --- a/src/serialization/types/CatalogQuerySortedAttribute.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b94fc9a29..000000000 --- a/src/serialization/types/CatalogQueryText.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3ff6828ca..000000000 --- a/src/serialization/types/CatalogQuickAmount.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 10cbf99ae..000000000 --- a/src/serialization/types/CatalogQuickAmountType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index efe43eff6..000000000 --- a/src/serialization/types/CatalogQuickAmountsSettings.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index dc5cd9051..000000000 --- a/src/serialization/types/CatalogQuickAmountsSettingsOption.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 365449418..000000000 --- a/src/serialization/types/CatalogStockConversion.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 189e4b302..000000000 --- a/src/serialization/types/CatalogSubscriptionPlan.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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/CatalogSubscriptionPlanVariation.ts b/src/serialization/types/CatalogSubscriptionPlanVariation.ts deleted file mode 100644 index 0a5fb2298..000000000 --- a/src/serialization/types/CatalogSubscriptionPlanVariation.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 CatalogSubscriptionPlanVariation: core.serialization.ObjectSchema< - serializers.CatalogSubscriptionPlanVariation.Raw, - Square.CatalogSubscriptionPlanVariation -> = core.serialization.object({ - name: core.serialization.string(), - phases: core.serialization.list(SubscriptionPhase), - subscriptionPlanId: core.serialization.property( - "subscription_plan_id", - core.serialization.string().optionalNullable(), - ), - monthlyBillingAnchorDate: core.serialization.property( - "monthly_billing_anchor_date", - core.serialization.bigint().optionalNullable(), - ), - canProrate: core.serialization.property("can_prorate", core.serialization.boolean().optionalNullable()), - successorPlanVariationId: core.serialization.property( - "successor_plan_variation_id", - core.serialization.string().optionalNullable(), - ), -}); - -export declare namespace CatalogSubscriptionPlanVariation { - export interface Raw { - name: string; - phases: SubscriptionPhase.Raw[]; - subscription_plan_id?: (string | null) | null; - monthly_billing_anchor_date?: ((bigint | number) | null) | null; - can_prorate?: (boolean | null) | null; - successor_plan_variation_id?: (string | null) | null; - } -} diff --git a/src/serialization/types/CatalogTax.ts b/src/serialization/types/CatalogTax.ts deleted file mode 100644 index be8da258b..000000000 --- a/src/serialization/types/CatalogTax.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index de733eb0b..000000000 --- a/src/serialization/types/CatalogTimePeriod.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a7231e4a0..000000000 --- a/src/serialization/types/CatalogV1Id.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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/CatalogVersionUpdatedEvent.ts b/src/serialization/types/CatalogVersionUpdatedEvent.ts deleted file mode 100644 index bf46f373e..000000000 --- a/src/serialization/types/CatalogVersionUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CatalogVersionUpdatedEventData } from "./CatalogVersionUpdatedEventData"; - -export const CatalogVersionUpdatedEvent: core.serialization.ObjectSchema< - serializers.CatalogVersionUpdatedEvent.Raw, - Square.CatalogVersionUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CatalogVersionUpdatedEventData.optional(), -}); - -export declare namespace CatalogVersionUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CatalogVersionUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/CatalogVersionUpdatedEventCatalogVersion.ts b/src/serialization/types/CatalogVersionUpdatedEventCatalogVersion.ts deleted file mode 100644 index 15e95fe91..000000000 --- a/src/serialization/types/CatalogVersionUpdatedEventCatalogVersion.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const CatalogVersionUpdatedEventCatalogVersion: core.serialization.ObjectSchema< - serializers.CatalogVersionUpdatedEventCatalogVersion.Raw, - Square.CatalogVersionUpdatedEventCatalogVersion -> = core.serialization.object({ - updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), -}); - -export declare namespace CatalogVersionUpdatedEventCatalogVersion { - export interface Raw { - updated_at?: string | null; - } -} diff --git a/src/serialization/types/CatalogVersionUpdatedEventData.ts b/src/serialization/types/CatalogVersionUpdatedEventData.ts deleted file mode 100644 index 99612b052..000000000 --- a/src/serialization/types/CatalogVersionUpdatedEventData.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CatalogVersionUpdatedEventObject } from "./CatalogVersionUpdatedEventObject"; - -export const CatalogVersionUpdatedEventData: core.serialization.ObjectSchema< - serializers.CatalogVersionUpdatedEventData.Raw, - Square.CatalogVersionUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - object: CatalogVersionUpdatedEventObject.optional(), -}); - -export declare namespace CatalogVersionUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - object?: CatalogVersionUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CatalogVersionUpdatedEventObject.ts b/src/serialization/types/CatalogVersionUpdatedEventObject.ts deleted file mode 100644 index 1e1dd79c1..000000000 --- a/src/serialization/types/CatalogVersionUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CatalogVersionUpdatedEventCatalogVersion } from "./CatalogVersionUpdatedEventCatalogVersion"; - -export const CatalogVersionUpdatedEventObject: core.serialization.ObjectSchema< - serializers.CatalogVersionUpdatedEventObject.Raw, - Square.CatalogVersionUpdatedEventObject -> = core.serialization.object({ - catalogVersion: core.serialization.property("catalog_version", CatalogVersionUpdatedEventCatalogVersion.optional()), -}); - -export declare namespace CatalogVersionUpdatedEventObject { - export interface Raw { - catalog_version?: CatalogVersionUpdatedEventCatalogVersion.Raw | null; - } -} diff --git a/src/serialization/types/CategoryPathToRootNode.ts b/src/serialization/types/CategoryPathToRootNode.ts deleted file mode 100644 index 47488d412..000000000 --- a/src/serialization/types/CategoryPathToRootNode.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 34d7cf67d..000000000 --- a/src/serialization/types/ChangeBillingAnchorDateResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 490df3d08..000000000 --- a/src/serialization/types/ChangeTiming.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7da0d9bbe..000000000 --- a/src/serialization/types/ChargeRequestAdditionalRecipient.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index af318ff29..000000000 --- a/src/serialization/types/Checkout.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bb052e38c..000000000 --- a/src/serialization/types/CheckoutLocationSettings.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ba7ef2c3a..000000000 --- a/src/serialization/types/CheckoutLocationSettingsBranding.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 12fc1d393..000000000 --- a/src/serialization/types/CheckoutLocationSettingsBrandingButtonShape.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 128e41c01..000000000 --- a/src/serialization/types/CheckoutLocationSettingsBrandingHeaderType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0ac82a98c..000000000 --- a/src/serialization/types/CheckoutLocationSettingsCoupons.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bb78effc0..000000000 --- a/src/serialization/types/CheckoutLocationSettingsPolicy.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8e2f23e2f..000000000 --- a/src/serialization/types/CheckoutLocationSettingsTipping.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6ada600bc..000000000 --- a/src/serialization/types/CheckoutMerchantSettings.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5d7bae106..000000000 --- a/src/serialization/types/CheckoutMerchantSettingsPaymentMethods.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e0c6a8e8a..000000000 --- a/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index febca0fef..000000000 --- a/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5710316d2..000000000 --- a/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsPaymentMethod.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 24fb21f67..000000000 --- a/src/serialization/types/CheckoutOptions.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b37865522..000000000 --- a/src/serialization/types/CheckoutOptionsPaymentType.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5c3ee717a..000000000 --- a/src/serialization/types/ClearpayDetails.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8a38ee214..000000000 --- a/src/serialization/types/CloneOrderResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 57ed61460..000000000 --- a/src/serialization/types/CollectedData.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ad790d62a..000000000 --- a/src/serialization/types/CompletePaymentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 18d3c09e9..000000000 --- a/src/serialization/types/Component.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fab0e16b3..000000000 --- a/src/serialization/types/ComponentComponentType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d857306bd..000000000 --- a/src/serialization/types/ConfirmationDecision.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 285a1f77f..000000000 --- a/src/serialization/types/ConfirmationOptions.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index aeb171690..000000000 --- a/src/serialization/types/Coordinates.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 6b53709cc..000000000 --- a/src/serialization/types/Country.ts +++ /dev/null @@ -1,514 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 39c595962..000000000 --- a/src/serialization/types/CreateBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6bf71e49a..000000000 --- a/src/serialization/types/CreateBookingResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8abe550a8..000000000 --- a/src/serialization/types/CreateBreakTypeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 374cd9d34..000000000 --- a/src/serialization/types/CreateCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 861ed5f4a..000000000 --- a/src/serialization/types/CreateCatalogImageRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9dd799d61..000000000 --- a/src/serialization/types/CreateCatalogImageResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9eb703880..000000000 --- a/src/serialization/types/CreateCheckoutResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8449b3850..000000000 --- a/src/serialization/types/CreateCustomerCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2b97ef4b6..000000000 --- a/src/serialization/types/CreateCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 40cf55199..000000000 --- a/src/serialization/types/CreateCustomerGroupResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6d01d42c7..000000000 --- a/src/serialization/types/CreateCustomerResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ce85dd674..000000000 --- a/src/serialization/types/CreateDeviceCodeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1d3fca2bf..000000000 --- a/src/serialization/types/CreateDisputeEvidenceFileRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 38f77d069..000000000 --- a/src/serialization/types/CreateDisputeEvidenceFileResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9e278727c..000000000 --- a/src/serialization/types/CreateDisputeEvidenceTextResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index dd25beb58..000000000 --- a/src/serialization/types/CreateGiftCardActivityResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 441867d59..000000000 --- a/src/serialization/types/CreateGiftCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/CreateInvoiceAttachmentRequestData.ts b/src/serialization/types/CreateInvoiceAttachmentRequestData.ts deleted file mode 100644 index 56bd40f1e..000000000 --- a/src/serialization/types/CreateInvoiceAttachmentRequestData.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const CreateInvoiceAttachmentRequestData: core.serialization.ObjectSchema< - serializers.CreateInvoiceAttachmentRequestData.Raw, - Square.CreateInvoiceAttachmentRequestData -> = core.serialization.object({ - idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), - description: core.serialization.string().optional(), -}); - -export declare namespace CreateInvoiceAttachmentRequestData { - export interface Raw { - idempotency_key?: string | null; - description?: string | null; - } -} diff --git a/src/serialization/types/CreateInvoiceAttachmentResponse.ts b/src/serialization/types/CreateInvoiceAttachmentResponse.ts deleted file mode 100644 index b5f7e474d..000000000 --- a/src/serialization/types/CreateInvoiceAttachmentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 30246acab..000000000 --- a/src/serialization/types/CreateInvoiceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8d8376f63..000000000 --- a/src/serialization/types/CreateJobResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ff829065c..000000000 --- a/src/serialization/types/CreateLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d4a35dbc3..000000000 --- a/src/serialization/types/CreateLocationResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 719616e98..000000000 --- a/src/serialization/types/CreateLoyaltyAccountResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3bb2dea21..000000000 --- a/src/serialization/types/CreateLoyaltyPromotionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fd4404dbd..000000000 --- a/src/serialization/types/CreateLoyaltyRewardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6fa86f3f4..000000000 --- a/src/serialization/types/CreateMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9e00f3fab..000000000 --- a/src/serialization/types/CreateMobileAuthorizationCodeResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0c269b0d2..000000000 --- a/src/serialization/types/CreateOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 97b072a82..000000000 --- a/src/serialization/types/CreateOrderRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3cdc089b7..000000000 --- a/src/serialization/types/CreateOrderResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e56b6d267..000000000 --- a/src/serialization/types/CreatePaymentLinkResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5ab32549a..000000000 --- a/src/serialization/types/CreatePaymentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/CreateScheduledShiftResponse.ts b/src/serialization/types/CreateScheduledShiftResponse.ts deleted file mode 100644 index 6fa3bebf9..000000000 --- a/src/serialization/types/CreateScheduledShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; -import { Error_ } from "./Error_"; - -export const CreateScheduledShiftResponse: core.serialization.ObjectSchema< - serializers.CreateScheduledShiftResponse.Raw, - Square.CreateScheduledShiftResponse -> = core.serialization.object({ - scheduledShift: core.serialization.property("scheduled_shift", ScheduledShift.optional()), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace CreateScheduledShiftResponse { - export interface Raw { - scheduled_shift?: ScheduledShift.Raw | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/CreateShiftResponse.ts b/src/serialization/types/CreateShiftResponse.ts deleted file mode 100644 index 367047732..000000000 --- a/src/serialization/types/CreateShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 925fff48a..000000000 --- a/src/serialization/types/CreateSubscriptionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2dfc3ea28..000000000 --- a/src/serialization/types/CreateTeamMemberRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 817631b00..000000000 --- a/src/serialization/types/CreateTeamMemberResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 10002c68c..000000000 --- a/src/serialization/types/CreateTerminalActionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7c30fb814..000000000 --- a/src/serialization/types/CreateTerminalCheckoutResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 028548ff9..000000000 --- a/src/serialization/types/CreateTerminalRefundResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/CreateTimecardResponse.ts b/src/serialization/types/CreateTimecardResponse.ts deleted file mode 100644 index 6b9d87ec4..000000000 --- a/src/serialization/types/CreateTimecardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Timecard } from "./Timecard"; -import { Error_ } from "./Error_"; - -export const CreateTimecardResponse: core.serialization.ObjectSchema< - serializers.CreateTimecardResponse.Raw, - Square.CreateTimecardResponse -> = core.serialization.object({ - timecard: Timecard.optional(), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace CreateTimecardResponse { - export interface Raw { - timecard?: Timecard.Raw | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/CreateVendorResponse.ts b/src/serialization/types/CreateVendorResponse.ts deleted file mode 100644 index eb5ee83a0..000000000 --- a/src/serialization/types/CreateVendorResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3d7ae7166..000000000 --- a/src/serialization/types/CreateWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4842418f9..000000000 --- a/src/serialization/types/Currency.ts +++ /dev/null @@ -1,380 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7456f606c..000000000 --- a/src/serialization/types/CustomAttribute.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c8b70be86..000000000 --- a/src/serialization/types/CustomAttributeDefinition.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-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/CustomAttributeDefinitionEventData.ts b/src/serialization/types/CustomAttributeDefinitionEventData.ts deleted file mode 100644 index c18b9bfa7..000000000 --- a/src/serialization/types/CustomAttributeDefinitionEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventDataObject } from "./CustomAttributeDefinitionEventDataObject"; - -export const CustomAttributeDefinitionEventData: core.serialization.ObjectSchema< - serializers.CustomAttributeDefinitionEventData.Raw, - Square.CustomAttributeDefinitionEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CustomAttributeDefinitionEventDataObject.optional(), -}); - -export declare namespace CustomAttributeDefinitionEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CustomAttributeDefinitionEventDataObject.Raw | null; - } -} diff --git a/src/serialization/types/CustomAttributeDefinitionEventDataObject.ts b/src/serialization/types/CustomAttributeDefinitionEventDataObject.ts deleted file mode 100644 index 29edfb185..000000000 --- a/src/serialization/types/CustomAttributeDefinitionEventDataObject.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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"; - -export const CustomAttributeDefinitionEventDataObject: core.serialization.ObjectSchema< - serializers.CustomAttributeDefinitionEventDataObject.Raw, - Square.CustomAttributeDefinitionEventDataObject -> = core.serialization.object({ - customAttributeDefinition: core.serialization.property( - "custom_attribute_definition", - CustomAttributeDefinition.optional(), - ), -}); - -export declare namespace CustomAttributeDefinitionEventDataObject { - export interface Raw { - custom_attribute_definition?: CustomAttributeDefinition.Raw | null; - } -} diff --git a/src/serialization/types/CustomAttributeDefinitionVisibility.ts b/src/serialization/types/CustomAttributeDefinitionVisibility.ts deleted file mode 100644 index 09e71c424..000000000 --- a/src/serialization/types/CustomAttributeDefinitionVisibility.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/CustomAttributeEventData.ts b/src/serialization/types/CustomAttributeEventData.ts deleted file mode 100644 index 7b5a892d1..000000000 --- a/src/serialization/types/CustomAttributeEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventDataObject } from "./CustomAttributeEventDataObject"; - -export const CustomAttributeEventData: core.serialization.ObjectSchema< - serializers.CustomAttributeEventData.Raw, - Square.CustomAttributeEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CustomAttributeEventDataObject.optional(), -}); - -export declare namespace CustomAttributeEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CustomAttributeEventDataObject.Raw | null; - } -} diff --git a/src/serialization/types/CustomAttributeEventDataObject.ts b/src/serialization/types/CustomAttributeEventDataObject.ts deleted file mode 100644 index f67e51e7f..000000000 --- a/src/serialization/types/CustomAttributeEventDataObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 CustomAttributeEventDataObject: core.serialization.ObjectSchema< - serializers.CustomAttributeEventDataObject.Raw, - Square.CustomAttributeEventDataObject -> = core.serialization.object({ - customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), -}); - -export declare namespace CustomAttributeEventDataObject { - export interface Raw { - custom_attribute?: CustomAttribute.Raw | null; - } -} diff --git a/src/serialization/types/CustomAttributeFilter.ts b/src/serialization/types/CustomAttributeFilter.ts deleted file mode 100644 index 9e6d947af..000000000 --- a/src/serialization/types/CustomAttributeFilter.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 112388b70..000000000 --- a/src/serialization/types/CustomField.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ec7ddfd7f..000000000 --- a/src/serialization/types/Customer.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 536e3fec7..000000000 --- a/src/serialization/types/CustomerAddressFilter.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/CustomerCreatedEvent.ts b/src/serialization/types/CustomerCreatedEvent.ts deleted file mode 100644 index db327a752..000000000 --- a/src/serialization/types/CustomerCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerCreatedEventData } from "./CustomerCreatedEventData"; - -export const CustomerCreatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCreatedEvent.Raw, - Square.CustomerCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomerCreatedEventData.optional(), -}); - -export declare namespace CustomerCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomerCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCreatedEventData.ts b/src/serialization/types/CustomerCreatedEventData.ts deleted file mode 100644 index e6d13d800..000000000 --- a/src/serialization/types/CustomerCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerCreatedEventObject } from "./CustomerCreatedEventObject"; - -export const CustomerCreatedEventData: core.serialization.ObjectSchema< - serializers.CustomerCreatedEventData.Raw, - Square.CustomerCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CustomerCreatedEventObject.optional(), -}); - -export declare namespace CustomerCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CustomerCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCreatedEventEventContext.ts b/src/serialization/types/CustomerCreatedEventEventContext.ts deleted file mode 100644 index 560bad1d8..000000000 --- a/src/serialization/types/CustomerCreatedEventEventContext.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerCreatedEventEventContextMerge } from "./CustomerCreatedEventEventContextMerge"; - -export const CustomerCreatedEventEventContext: core.serialization.ObjectSchema< - serializers.CustomerCreatedEventEventContext.Raw, - Square.CustomerCreatedEventEventContext -> = core.serialization.object({ - merge: CustomerCreatedEventEventContextMerge.optional(), -}); - -export declare namespace CustomerCreatedEventEventContext { - export interface Raw { - merge?: CustomerCreatedEventEventContextMerge.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCreatedEventEventContextMerge.ts b/src/serialization/types/CustomerCreatedEventEventContextMerge.ts deleted file mode 100644 index ddf65c816..000000000 --- a/src/serialization/types/CustomerCreatedEventEventContextMerge.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const CustomerCreatedEventEventContextMerge: core.serialization.ObjectSchema< - serializers.CustomerCreatedEventEventContextMerge.Raw, - Square.CustomerCreatedEventEventContextMerge -> = core.serialization.object({ - fromCustomerIds: core.serialization.property( - "from_customer_ids", - core.serialization.list(core.serialization.string()).optionalNullable(), - ), - toCustomerId: core.serialization.property("to_customer_id", core.serialization.string().optionalNullable()), -}); - -export declare namespace CustomerCreatedEventEventContextMerge { - export interface Raw { - from_customer_ids?: (string[] | null) | null; - to_customer_id?: (string | null) | null; - } -} diff --git a/src/serialization/types/CustomerCreatedEventObject.ts b/src/serialization/types/CustomerCreatedEventObject.ts deleted file mode 100644 index 8becea722..000000000 --- a/src/serialization/types/CustomerCreatedEventObject.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Customer } from "./Customer"; -import { CustomerCreatedEventEventContext } from "./CustomerCreatedEventEventContext"; - -export const CustomerCreatedEventObject: core.serialization.ObjectSchema< - serializers.CustomerCreatedEventObject.Raw, - Square.CustomerCreatedEventObject -> = core.serialization.object({ - customer: Customer.optional(), - eventContext: core.serialization.property("event_context", CustomerCreatedEventEventContext.optional()), -}); - -export declare namespace CustomerCreatedEventObject { - export interface Raw { - customer?: Customer.Raw | null; - event_context?: CustomerCreatedEventEventContext.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCreationSource.ts b/src/serialization/types/CustomerCreationSource.ts deleted file mode 100644 index aa8551b3f..000000000 --- a/src/serialization/types/CustomerCreationSource.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 514cd7c2b..000000000 --- a/src/serialization/types/CustomerCreationSourceFilter.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/CustomerCustomAttributeDefinitionCreatedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionCreatedEvent.ts deleted file mode 100644 index 32262ad64..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionCreatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionCreatedEvent.Raw, - Square.CustomerCustomAttributeDefinitionCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionCreatedPublicEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionCreatedPublicEvent.ts deleted file mode 100644 index 721e2b517..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionCreatedPublicEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionCreatedPublicEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionCreatedPublicEvent.Raw, - Square.CustomerCustomAttributeDefinitionCreatedPublicEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionCreatedPublicEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionDeletedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionDeletedEvent.ts deleted file mode 100644 index 3d67c4401..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionDeletedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionDeletedEvent.Raw, - Square.CustomerCustomAttributeDefinitionDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionDeletedPublicEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionDeletedPublicEvent.ts deleted file mode 100644 index 137b4d34e..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionDeletedPublicEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionDeletedPublicEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionDeletedPublicEvent.Raw, - Square.CustomerCustomAttributeDefinitionDeletedPublicEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionDeletedPublicEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionOwnedCreatedEvent.ts deleted file mode 100644 index b601b0b63..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionOwnedCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionOwnedCreatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionOwnedCreatedEvent.Raw, - Square.CustomerCustomAttributeDefinitionOwnedCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionOwnedCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionOwnedDeletedEvent.ts deleted file mode 100644 index fff983f58..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionOwnedDeletedEvent.Raw, - Square.CustomerCustomAttributeDefinitionOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionOwnedUpdatedEvent.ts deleted file mode 100644 index ebdf5a959..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionOwnedUpdatedEvent.Raw, - Square.CustomerCustomAttributeDefinitionOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionUpdatedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionUpdatedEvent.ts deleted file mode 100644 index cab3773a0..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionUpdatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionUpdatedEvent.Raw, - Square.CustomerCustomAttributeDefinitionUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionUpdatedPublicEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionUpdatedPublicEvent.ts deleted file mode 100644 index 12b4a1c93..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionUpdatedPublicEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionUpdatedPublicEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionUpdatedPublicEvent.Raw, - Square.CustomerCustomAttributeDefinitionUpdatedPublicEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionUpdatedPublicEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionVisibleCreatedEvent.ts deleted file mode 100644 index 00dfa6b54..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionVisibleCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionVisibleCreatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionVisibleCreatedEvent.Raw, - Square.CustomerCustomAttributeDefinitionVisibleCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionVisibleCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionVisibleDeletedEvent.ts deleted file mode 100644 index 0a5fbbce2..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionVisibleDeletedEvent.Raw, - Square.CustomerCustomAttributeDefinitionVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/serialization/types/CustomerCustomAttributeDefinitionVisibleUpdatedEvent.ts deleted file mode 100644 index d22362803..000000000 --- a/src/serialization/types/CustomerCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const CustomerCustomAttributeDefinitionVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDefinitionVisibleUpdatedEvent.Raw, - Square.CustomerCustomAttributeDefinitionVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDefinitionVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDeletedEvent.ts b/src/serialization/types/CustomerCustomAttributeDeletedEvent.ts deleted file mode 100644 index c0202a40b..000000000 --- a/src/serialization/types/CustomerCustomAttributeDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeDeletedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDeletedEvent.Raw, - Square.CustomerCustomAttributeDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeDeletedPublicEvent.ts b/src/serialization/types/CustomerCustomAttributeDeletedPublicEvent.ts deleted file mode 100644 index cd997be55..000000000 --- a/src/serialization/types/CustomerCustomAttributeDeletedPublicEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeDeletedPublicEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeDeletedPublicEvent.Raw, - Square.CustomerCustomAttributeDeletedPublicEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeDeletedPublicEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeFilter.ts b/src/serialization/types/CustomerCustomAttributeFilter.ts deleted file mode 100644 index 4f4fd1320..000000000 --- a/src/serialization/types/CustomerCustomAttributeFilter.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 855a127f2..000000000 --- a/src/serialization/types/CustomerCustomAttributeFilterValue.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b7fa2ed18..000000000 --- a/src/serialization/types/CustomerCustomAttributeFilters.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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/CustomerCustomAttributeOwnedDeletedEvent.ts b/src/serialization/types/CustomerCustomAttributeOwnedDeletedEvent.ts deleted file mode 100644 index da3885373..000000000 --- a/src/serialization/types/CustomerCustomAttributeOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeOwnedDeletedEvent.Raw, - Square.CustomerCustomAttributeOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeOwnedUpdatedEvent.ts b/src/serialization/types/CustomerCustomAttributeOwnedUpdatedEvent.ts deleted file mode 100644 index bd97c5a50..000000000 --- a/src/serialization/types/CustomerCustomAttributeOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeOwnedUpdatedEvent.Raw, - Square.CustomerCustomAttributeOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeUpdatedEvent.ts b/src/serialization/types/CustomerCustomAttributeUpdatedEvent.ts deleted file mode 100644 index f16aa1bc0..000000000 --- a/src/serialization/types/CustomerCustomAttributeUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeUpdatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeUpdatedEvent.Raw, - Square.CustomerCustomAttributeUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeUpdatedPublicEvent.ts b/src/serialization/types/CustomerCustomAttributeUpdatedPublicEvent.ts deleted file mode 100644 index 3a99d562c..000000000 --- a/src/serialization/types/CustomerCustomAttributeUpdatedPublicEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeUpdatedPublicEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeUpdatedPublicEvent.Raw, - Square.CustomerCustomAttributeUpdatedPublicEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeUpdatedPublicEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeVisibleDeletedEvent.ts b/src/serialization/types/CustomerCustomAttributeVisibleDeletedEvent.ts deleted file mode 100644 index 0e34c5245..000000000 --- a/src/serialization/types/CustomerCustomAttributeVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeVisibleDeletedEvent.Raw, - Square.CustomerCustomAttributeVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerCustomAttributeVisibleUpdatedEvent.ts b/src/serialization/types/CustomerCustomAttributeVisibleUpdatedEvent.ts deleted file mode 100644 index 1e10fbf45..000000000 --- a/src/serialization/types/CustomerCustomAttributeVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const CustomerCustomAttributeVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.CustomerCustomAttributeVisibleUpdatedEvent.Raw, - Square.CustomerCustomAttributeVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace CustomerCustomAttributeVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerDeletedEvent.ts b/src/serialization/types/CustomerDeletedEvent.ts deleted file mode 100644 index 1c2c5317a..000000000 --- a/src/serialization/types/CustomerDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerDeletedEventData } from "./CustomerDeletedEventData"; - -export const CustomerDeletedEvent: core.serialization.ObjectSchema< - serializers.CustomerDeletedEvent.Raw, - Square.CustomerDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomerDeletedEventData.optional(), -}); - -export declare namespace CustomerDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomerDeletedEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerDeletedEventData.ts b/src/serialization/types/CustomerDeletedEventData.ts deleted file mode 100644 index 6f46eb424..000000000 --- a/src/serialization/types/CustomerDeletedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerDeletedEventObject } from "./CustomerDeletedEventObject"; - -export const CustomerDeletedEventData: core.serialization.ObjectSchema< - serializers.CustomerDeletedEventData.Raw, - Square.CustomerDeletedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CustomerDeletedEventObject.optional(), -}); - -export declare namespace CustomerDeletedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CustomerDeletedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CustomerDeletedEventEventContext.ts b/src/serialization/types/CustomerDeletedEventEventContext.ts deleted file mode 100644 index 4c0617f8c..000000000 --- a/src/serialization/types/CustomerDeletedEventEventContext.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerDeletedEventEventContextMerge } from "./CustomerDeletedEventEventContextMerge"; - -export const CustomerDeletedEventEventContext: core.serialization.ObjectSchema< - serializers.CustomerDeletedEventEventContext.Raw, - Square.CustomerDeletedEventEventContext -> = core.serialization.object({ - merge: CustomerDeletedEventEventContextMerge.optional(), -}); - -export declare namespace CustomerDeletedEventEventContext { - export interface Raw { - merge?: CustomerDeletedEventEventContextMerge.Raw | null; - } -} diff --git a/src/serialization/types/CustomerDeletedEventEventContextMerge.ts b/src/serialization/types/CustomerDeletedEventEventContextMerge.ts deleted file mode 100644 index 0c39c236c..000000000 --- a/src/serialization/types/CustomerDeletedEventEventContextMerge.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const CustomerDeletedEventEventContextMerge: core.serialization.ObjectSchema< - serializers.CustomerDeletedEventEventContextMerge.Raw, - Square.CustomerDeletedEventEventContextMerge -> = core.serialization.object({ - fromCustomerIds: core.serialization.property( - "from_customer_ids", - core.serialization.list(core.serialization.string()).optionalNullable(), - ), - toCustomerId: core.serialization.property("to_customer_id", core.serialization.string().optionalNullable()), -}); - -export declare namespace CustomerDeletedEventEventContextMerge { - export interface Raw { - from_customer_ids?: (string[] | null) | null; - to_customer_id?: (string | null) | null; - } -} diff --git a/src/serialization/types/CustomerDeletedEventObject.ts b/src/serialization/types/CustomerDeletedEventObject.ts deleted file mode 100644 index 51db7af38..000000000 --- a/src/serialization/types/CustomerDeletedEventObject.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Customer } from "./Customer"; -import { CustomerDeletedEventEventContext } from "./CustomerDeletedEventEventContext"; - -export const CustomerDeletedEventObject: core.serialization.ObjectSchema< - serializers.CustomerDeletedEventObject.Raw, - Square.CustomerDeletedEventObject -> = core.serialization.object({ - customer: Customer.optional(), - eventContext: core.serialization.property("event_context", CustomerDeletedEventEventContext.optional()), -}); - -export declare namespace CustomerDeletedEventObject { - export interface Raw { - customer?: Customer.Raw | null; - event_context?: CustomerDeletedEventEventContext.Raw | null; - } -} diff --git a/src/serialization/types/CustomerDetails.ts b/src/serialization/types/CustomerDetails.ts deleted file mode 100644 index 04afde920..000000000 --- a/src/serialization/types/CustomerDetails.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ff8288420..000000000 --- a/src/serialization/types/CustomerFilter.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7375e075e..000000000 --- a/src/serialization/types/CustomerGroup.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 70cbbbb21..000000000 --- a/src/serialization/types/CustomerInclusionExclusion.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c9f3a7d35..000000000 --- a/src/serialization/types/CustomerPreferences.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 74c50bc41..000000000 --- a/src/serialization/types/CustomerQuery.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7303e6880..000000000 --- a/src/serialization/types/CustomerSegment.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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().optional(), - 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 | null; - created_at?: string | null; - updated_at?: string | null; - } -} diff --git a/src/serialization/types/CustomerSort.ts b/src/serialization/types/CustomerSort.ts deleted file mode 100644 index 2b9ef32f7..000000000 --- a/src/serialization/types/CustomerSort.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 21e2203c2..000000000 --- a/src/serialization/types/CustomerSortField.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index cef8a8edb..000000000 --- a/src/serialization/types/CustomerTaxIds.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9812d5e91..000000000 --- a/src/serialization/types/CustomerTextFilter.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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/CustomerUpdatedEvent.ts b/src/serialization/types/CustomerUpdatedEvent.ts deleted file mode 100644 index 9be57f95c..000000000 --- a/src/serialization/types/CustomerUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerUpdatedEventData } from "./CustomerUpdatedEventData"; - -export const CustomerUpdatedEvent: core.serialization.ObjectSchema< - serializers.CustomerUpdatedEvent.Raw, - Square.CustomerUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomerUpdatedEventData.optional(), -}); - -export declare namespace CustomerUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomerUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/CustomerUpdatedEventData.ts b/src/serialization/types/CustomerUpdatedEventData.ts deleted file mode 100644 index fe42f381e..000000000 --- a/src/serialization/types/CustomerUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomerUpdatedEventObject } from "./CustomerUpdatedEventObject"; - -export const CustomerUpdatedEventData: core.serialization.ObjectSchema< - serializers.CustomerUpdatedEventData.Raw, - Square.CustomerUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: CustomerUpdatedEventObject.optional(), -}); - -export declare namespace CustomerUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: CustomerUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/CustomerUpdatedEventObject.ts b/src/serialization/types/CustomerUpdatedEventObject.ts deleted file mode 100644 index 8c4459af5..000000000 --- a/src/serialization/types/CustomerUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Customer } from "./Customer"; - -export const CustomerUpdatedEventObject: core.serialization.ObjectSchema< - serializers.CustomerUpdatedEventObject.Raw, - Square.CustomerUpdatedEventObject -> = core.serialization.object({ - customer: Customer.optional(), -}); - -export declare namespace CustomerUpdatedEventObject { - export interface Raw { - customer?: Customer.Raw | null; - } -} diff --git a/src/serialization/types/DataCollectionOptions.ts b/src/serialization/types/DataCollectionOptions.ts deleted file mode 100644 index a79221a8d..000000000 --- a/src/serialization/types/DataCollectionOptions.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 73f2c73c1..000000000 --- a/src/serialization/types/DataCollectionOptionsInputType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a4f544d8a..000000000 --- a/src/serialization/types/DateRange.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 38c8ded8d..000000000 --- a/src/serialization/types/DayOfWeek.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0a4b638fc..000000000 --- a/src/serialization/types/DeleteBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ef33e73a4..000000000 --- a/src/serialization/types/DeleteBookingCustomAttributeResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 32a9fd7b4..000000000 --- a/src/serialization/types/DeleteBreakTypeResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8cd03bde4..000000000 --- a/src/serialization/types/DeleteCatalogObjectResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index de93fa722..000000000 --- a/src/serialization/types/DeleteCustomerCardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b74465071..000000000 --- a/src/serialization/types/DeleteCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0a64db0d8..000000000 --- a/src/serialization/types/DeleteCustomerCustomAttributeResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ceefcf781..000000000 --- a/src/serialization/types/DeleteCustomerGroupResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b6b31e040..000000000 --- a/src/serialization/types/DeleteCustomerResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5462a5275..000000000 --- a/src/serialization/types/DeleteDisputeEvidenceResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6385db0c8..000000000 --- a/src/serialization/types/DeleteInvoiceAttachmentResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3475aa54b..000000000 --- a/src/serialization/types/DeleteInvoiceResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index acf03bfd2..000000000 --- a/src/serialization/types/DeleteLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fa3d0ed2b..000000000 --- a/src/serialization/types/DeleteLocationCustomAttributeResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5d3fbc7bc..000000000 --- a/src/serialization/types/DeleteLoyaltyRewardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4bb4141e6..000000000 --- a/src/serialization/types/DeleteMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5c68b8813..000000000 --- a/src/serialization/types/DeleteMerchantCustomAttributeResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3b3ff726a..000000000 --- a/src/serialization/types/DeleteOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b9edcc24a..000000000 --- a/src/serialization/types/DeleteOrderCustomAttributeResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a78fac4ba..000000000 --- a/src/serialization/types/DeletePaymentLinkResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 46c572ab5..000000000 --- a/src/serialization/types/DeleteShiftResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1c7670975..000000000 --- a/src/serialization/types/DeleteSnippetResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1f25108ee..000000000 --- a/src/serialization/types/DeleteSubscriptionActionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/DeleteTimecardResponse.ts b/src/serialization/types/DeleteTimecardResponse.ts deleted file mode 100644 index 4b02939b8..000000000 --- a/src/serialization/types/DeleteTimecardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 DeleteTimecardResponse: core.serialization.ObjectSchema< - serializers.DeleteTimecardResponse.Raw, - Square.DeleteTimecardResponse -> = core.serialization.object({ - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace DeleteTimecardResponse { - export interface Raw { - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/DeleteWebhookSubscriptionResponse.ts b/src/serialization/types/DeleteWebhookSubscriptionResponse.ts deleted file mode 100644 index b56bfc771..000000000 --- a/src/serialization/types/DeleteWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 366eff6d8..000000000 --- a/src/serialization/types/Destination.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a75499ab1..000000000 --- a/src/serialization/types/DestinationDetails.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e7aeb6e32..000000000 --- a/src/serialization/types/DestinationDetailsCardRefundDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a34890e16..000000000 --- a/src/serialization/types/DestinationDetailsCashRefundDetails.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d6cc57509..000000000 --- a/src/serialization/types/DestinationDetailsExternalRefundDetails.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8d5966cf5..000000000 --- a/src/serialization/types/DestinationType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bdfa1bd46..000000000 --- a/src/serialization/types/Device.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 364f6f982..000000000 --- a/src/serialization/types/DeviceAttributes.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cd9d9fb54..000000000 --- a/src/serialization/types/DeviceAttributesDeviceType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b9498253e..000000000 --- a/src/serialization/types/DeviceCheckoutOptions.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d21f97aa2..000000000 --- a/src/serialization/types/DeviceCode.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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/DeviceCodePairedEvent.ts b/src/serialization/types/DeviceCodePairedEvent.ts deleted file mode 100644 index 29614f09a..000000000 --- a/src/serialization/types/DeviceCodePairedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DeviceCodePairedEventData } from "./DeviceCodePairedEventData"; - -export const DeviceCodePairedEvent: core.serialization.ObjectSchema< - serializers.DeviceCodePairedEvent.Raw, - Square.DeviceCodePairedEvent -> = 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: DeviceCodePairedEventData.optional(), -}); - -export declare namespace DeviceCodePairedEvent { - 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?: DeviceCodePairedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DeviceCodePairedEventData.ts b/src/serialization/types/DeviceCodePairedEventData.ts deleted file mode 100644 index d4c70f01d..000000000 --- a/src/serialization/types/DeviceCodePairedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DeviceCodePairedEventObject } from "./DeviceCodePairedEventObject"; - -export const DeviceCodePairedEventData: core.serialization.ObjectSchema< - serializers.DeviceCodePairedEventData.Raw, - Square.DeviceCodePairedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DeviceCodePairedEventObject.optional(), -}); - -export declare namespace DeviceCodePairedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DeviceCodePairedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DeviceCodePairedEventObject.ts b/src/serialization/types/DeviceCodePairedEventObject.ts deleted file mode 100644 index c8fcfeb25..000000000 --- a/src/serialization/types/DeviceCodePairedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./DeviceCode"; - -export const DeviceCodePairedEventObject: core.serialization.ObjectSchema< - serializers.DeviceCodePairedEventObject.Raw, - Square.DeviceCodePairedEventObject -> = core.serialization.object({ - deviceCode: core.serialization.property("device_code", DeviceCode.optional()), -}); - -export declare namespace DeviceCodePairedEventObject { - export interface Raw { - device_code?: DeviceCode.Raw | null; - } -} diff --git a/src/serialization/types/DeviceCodeStatus.ts b/src/serialization/types/DeviceCodeStatus.ts deleted file mode 100644 index f3c765feb..000000000 --- a/src/serialization/types/DeviceCodeStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b0c35e557..000000000 --- a/src/serialization/types/DeviceComponentDetailsApplicationDetails.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 12e3b61d6..000000000 --- a/src/serialization/types/DeviceComponentDetailsBatteryDetails.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5904dbe18..000000000 --- a/src/serialization/types/DeviceComponentDetailsCardReaderDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9fd0da52a..000000000 --- a/src/serialization/types/DeviceComponentDetailsEthernetDetails.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0f81b7fee..000000000 --- a/src/serialization/types/DeviceComponentDetailsExternalPower.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 6a6bfea0b..000000000 --- a/src/serialization/types/DeviceComponentDetailsMeasurement.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f8d34847c..000000000 --- a/src/serialization/types/DeviceComponentDetailsWiFiDetails.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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/DeviceCreatedEvent.ts b/src/serialization/types/DeviceCreatedEvent.ts deleted file mode 100644 index 2f888c6be..000000000 --- a/src/serialization/types/DeviceCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DeviceCreatedEventData } from "./DeviceCreatedEventData"; - -export const DeviceCreatedEvent: core.serialization.ObjectSchema< - serializers.DeviceCreatedEvent.Raw, - Square.DeviceCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: DeviceCreatedEventData.optional(), -}); - -export declare namespace DeviceCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: DeviceCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DeviceCreatedEventData.ts b/src/serialization/types/DeviceCreatedEventData.ts deleted file mode 100644 index 1e03bb561..000000000 --- a/src/serialization/types/DeviceCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DeviceCreatedEventObject } from "./DeviceCreatedEventObject"; - -export const DeviceCreatedEventData: core.serialization.ObjectSchema< - serializers.DeviceCreatedEventData.Raw, - Square.DeviceCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DeviceCreatedEventObject.optional(), -}); - -export declare namespace DeviceCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DeviceCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DeviceCreatedEventObject.ts b/src/serialization/types/DeviceCreatedEventObject.ts deleted file mode 100644 index f4a3bde8f..000000000 --- a/src/serialization/types/DeviceCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Device } from "./Device"; - -export const DeviceCreatedEventObject: core.serialization.ObjectSchema< - serializers.DeviceCreatedEventObject.Raw, - Square.DeviceCreatedEventObject -> = core.serialization.object({ - device: Device.optional(), -}); - -export declare namespace DeviceCreatedEventObject { - export interface Raw { - device?: Device.Raw | null; - } -} diff --git a/src/serialization/types/DeviceDetails.ts b/src/serialization/types/DeviceDetails.ts deleted file mode 100644 index 569bd6b08..000000000 --- a/src/serialization/types/DeviceDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 13b723292..000000000 --- a/src/serialization/types/DeviceMetadata.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3cb85b739..000000000 --- a/src/serialization/types/DeviceStatus.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 35f539b5b..000000000 --- a/src/serialization/types/DeviceStatusCategory.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 22a338e6f..000000000 --- a/src/serialization/types/DigitalWalletDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9b0895fff..000000000 --- a/src/serialization/types/DisableCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c00d6bce6..000000000 --- a/src/serialization/types/DisableEventsResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 31c15cb00..000000000 --- a/src/serialization/types/DismissTerminalActionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 355ace5b7..000000000 --- a/src/serialization/types/DismissTerminalCheckoutResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 533b62e3a..000000000 --- a/src/serialization/types/DismissTerminalRefundResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bff1b3f70..000000000 --- a/src/serialization/types/Dispute.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * This file was auto-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/DisputeCreatedEvent.ts b/src/serialization/types/DisputeCreatedEvent.ts deleted file mode 100644 index cadc6c3c7..000000000 --- a/src/serialization/types/DisputeCreatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeCreatedEventData } from "./DisputeCreatedEventData"; - -export const DisputeCreatedEvent: core.serialization.ObjectSchema< - serializers.DisputeCreatedEvent.Raw, - Square.DisputeCreatedEvent -> = 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: DisputeCreatedEventData.optional(), -}); - -export declare namespace DisputeCreatedEvent { - 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?: DisputeCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DisputeCreatedEventData.ts b/src/serialization/types/DisputeCreatedEventData.ts deleted file mode 100644 index 66bb01a23..000000000 --- a/src/serialization/types/DisputeCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeCreatedEventObject } from "./DisputeCreatedEventObject"; - -export const DisputeCreatedEventData: core.serialization.ObjectSchema< - serializers.DisputeCreatedEventData.Raw, - Square.DisputeCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DisputeCreatedEventObject.optional(), -}); - -export declare namespace DisputeCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DisputeCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DisputeCreatedEventObject.ts b/src/serialization/types/DisputeCreatedEventObject.ts deleted file mode 100644 index 7a045ffd3..000000000 --- a/src/serialization/types/DisputeCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Dispute } from "./Dispute"; - -export const DisputeCreatedEventObject: core.serialization.ObjectSchema< - serializers.DisputeCreatedEventObject.Raw, - Square.DisputeCreatedEventObject -> = core.serialization.object({ - object: Dispute.optional(), -}); - -export declare namespace DisputeCreatedEventObject { - export interface Raw { - object?: Dispute.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidence.ts b/src/serialization/types/DisputeEvidence.ts deleted file mode 100644 index 905aca8e1..000000000 --- a/src/serialization/types/DisputeEvidence.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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/DisputeEvidenceAddedEvent.ts b/src/serialization/types/DisputeEvidenceAddedEvent.ts deleted file mode 100644 index ce7890266..000000000 --- a/src/serialization/types/DisputeEvidenceAddedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceAddedEventData } from "./DisputeEvidenceAddedEventData"; - -export const DisputeEvidenceAddedEvent: core.serialization.ObjectSchema< - serializers.DisputeEvidenceAddedEvent.Raw, - Square.DisputeEvidenceAddedEvent -> = 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: DisputeEvidenceAddedEventData.optional(), -}); - -export declare namespace DisputeEvidenceAddedEvent { - 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?: DisputeEvidenceAddedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceAddedEventData.ts b/src/serialization/types/DisputeEvidenceAddedEventData.ts deleted file mode 100644 index c8b9db56f..000000000 --- a/src/serialization/types/DisputeEvidenceAddedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceAddedEventObject } from "./DisputeEvidenceAddedEventObject"; - -export const DisputeEvidenceAddedEventData: core.serialization.ObjectSchema< - serializers.DisputeEvidenceAddedEventData.Raw, - Square.DisputeEvidenceAddedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DisputeEvidenceAddedEventObject.optional(), -}); - -export declare namespace DisputeEvidenceAddedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DisputeEvidenceAddedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceAddedEventObject.ts b/src/serialization/types/DisputeEvidenceAddedEventObject.ts deleted file mode 100644 index caebd0ba8..000000000 --- a/src/serialization/types/DisputeEvidenceAddedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Dispute } from "./Dispute"; - -export const DisputeEvidenceAddedEventObject: core.serialization.ObjectSchema< - serializers.DisputeEvidenceAddedEventObject.Raw, - Square.DisputeEvidenceAddedEventObject -> = core.serialization.object({ - object: Dispute.optional(), -}); - -export declare namespace DisputeEvidenceAddedEventObject { - export interface Raw { - object?: Dispute.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceCreatedEvent.ts b/src/serialization/types/DisputeEvidenceCreatedEvent.ts deleted file mode 100644 index ce0a33036..000000000 --- a/src/serialization/types/DisputeEvidenceCreatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceCreatedEventData } from "./DisputeEvidenceCreatedEventData"; - -export const DisputeEvidenceCreatedEvent: core.serialization.ObjectSchema< - serializers.DisputeEvidenceCreatedEvent.Raw, - Square.DisputeEvidenceCreatedEvent -> = 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: DisputeEvidenceCreatedEventData.optional(), -}); - -export declare namespace DisputeEvidenceCreatedEvent { - 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?: DisputeEvidenceCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceCreatedEventData.ts b/src/serialization/types/DisputeEvidenceCreatedEventData.ts deleted file mode 100644 index 74decd9ab..000000000 --- a/src/serialization/types/DisputeEvidenceCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceCreatedEventObject } from "./DisputeEvidenceCreatedEventObject"; - -export const DisputeEvidenceCreatedEventData: core.serialization.ObjectSchema< - serializers.DisputeEvidenceCreatedEventData.Raw, - Square.DisputeEvidenceCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DisputeEvidenceCreatedEventObject.optional(), -}); - -export declare namespace DisputeEvidenceCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DisputeEvidenceCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceCreatedEventObject.ts b/src/serialization/types/DisputeEvidenceCreatedEventObject.ts deleted file mode 100644 index 4c454286a..000000000 --- a/src/serialization/types/DisputeEvidenceCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Dispute } from "./Dispute"; - -export const DisputeEvidenceCreatedEventObject: core.serialization.ObjectSchema< - serializers.DisputeEvidenceCreatedEventObject.Raw, - Square.DisputeEvidenceCreatedEventObject -> = core.serialization.object({ - object: Dispute.optional(), -}); - -export declare namespace DisputeEvidenceCreatedEventObject { - export interface Raw { - object?: Dispute.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceDeletedEvent.ts b/src/serialization/types/DisputeEvidenceDeletedEvent.ts deleted file mode 100644 index 5c23ee39d..000000000 --- a/src/serialization/types/DisputeEvidenceDeletedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceDeletedEventData } from "./DisputeEvidenceDeletedEventData"; - -export const DisputeEvidenceDeletedEvent: core.serialization.ObjectSchema< - serializers.DisputeEvidenceDeletedEvent.Raw, - Square.DisputeEvidenceDeletedEvent -> = 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: DisputeEvidenceDeletedEventData.optional(), -}); - -export declare namespace DisputeEvidenceDeletedEvent { - 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?: DisputeEvidenceDeletedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceDeletedEventData.ts b/src/serialization/types/DisputeEvidenceDeletedEventData.ts deleted file mode 100644 index a4bebee39..000000000 --- a/src/serialization/types/DisputeEvidenceDeletedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceDeletedEventObject } from "./DisputeEvidenceDeletedEventObject"; - -export const DisputeEvidenceDeletedEventData: core.serialization.ObjectSchema< - serializers.DisputeEvidenceDeletedEventData.Raw, - Square.DisputeEvidenceDeletedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DisputeEvidenceDeletedEventObject.optional(), -}); - -export declare namespace DisputeEvidenceDeletedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DisputeEvidenceDeletedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceDeletedEventObject.ts b/src/serialization/types/DisputeEvidenceDeletedEventObject.ts deleted file mode 100644 index a67a5890d..000000000 --- a/src/serialization/types/DisputeEvidenceDeletedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Dispute } from "./Dispute"; - -export const DisputeEvidenceDeletedEventObject: core.serialization.ObjectSchema< - serializers.DisputeEvidenceDeletedEventObject.Raw, - Square.DisputeEvidenceDeletedEventObject -> = core.serialization.object({ - object: Dispute.optional(), -}); - -export declare namespace DisputeEvidenceDeletedEventObject { - export interface Raw { - object?: Dispute.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceFile.ts b/src/serialization/types/DisputeEvidenceFile.ts deleted file mode 100644 index 0d0db54ea..000000000 --- a/src/serialization/types/DisputeEvidenceFile.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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/DisputeEvidenceRemovedEvent.ts b/src/serialization/types/DisputeEvidenceRemovedEvent.ts deleted file mode 100644 index 6141b61b2..000000000 --- a/src/serialization/types/DisputeEvidenceRemovedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceRemovedEventData } from "./DisputeEvidenceRemovedEventData"; - -export const DisputeEvidenceRemovedEvent: core.serialization.ObjectSchema< - serializers.DisputeEvidenceRemovedEvent.Raw, - Square.DisputeEvidenceRemovedEvent -> = 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: DisputeEvidenceRemovedEventData.optional(), -}); - -export declare namespace DisputeEvidenceRemovedEvent { - 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?: DisputeEvidenceRemovedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceRemovedEventData.ts b/src/serialization/types/DisputeEvidenceRemovedEventData.ts deleted file mode 100644 index 7f0bc0915..000000000 --- a/src/serialization/types/DisputeEvidenceRemovedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeEvidenceRemovedEventObject } from "./DisputeEvidenceRemovedEventObject"; - -export const DisputeEvidenceRemovedEventData: core.serialization.ObjectSchema< - serializers.DisputeEvidenceRemovedEventData.Raw, - Square.DisputeEvidenceRemovedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DisputeEvidenceRemovedEventObject.optional(), -}); - -export declare namespace DisputeEvidenceRemovedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DisputeEvidenceRemovedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceRemovedEventObject.ts b/src/serialization/types/DisputeEvidenceRemovedEventObject.ts deleted file mode 100644 index c037d953f..000000000 --- a/src/serialization/types/DisputeEvidenceRemovedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Dispute } from "./Dispute"; - -export const DisputeEvidenceRemovedEventObject: core.serialization.ObjectSchema< - serializers.DisputeEvidenceRemovedEventObject.Raw, - Square.DisputeEvidenceRemovedEventObject -> = core.serialization.object({ - object: Dispute.optional(), -}); - -export declare namespace DisputeEvidenceRemovedEventObject { - export interface Raw { - object?: Dispute.Raw | null; - } -} diff --git a/src/serialization/types/DisputeEvidenceType.ts b/src/serialization/types/DisputeEvidenceType.ts deleted file mode 100644 index 4d28b606f..000000000 --- a/src/serialization/types/DisputeEvidenceType.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f2e6f91f4..000000000 --- a/src/serialization/types/DisputeReason.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 815e152bd..000000000 --- a/src/serialization/types/DisputeState.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated 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/DisputeStateChangedEvent.ts b/src/serialization/types/DisputeStateChangedEvent.ts deleted file mode 100644 index 39ef9cf13..000000000 --- a/src/serialization/types/DisputeStateChangedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeStateChangedEventData } from "./DisputeStateChangedEventData"; - -export const DisputeStateChangedEvent: core.serialization.ObjectSchema< - serializers.DisputeStateChangedEvent.Raw, - Square.DisputeStateChangedEvent -> = 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: DisputeStateChangedEventData.optional(), -}); - -export declare namespace DisputeStateChangedEvent { - 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?: DisputeStateChangedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DisputeStateChangedEventData.ts b/src/serialization/types/DisputeStateChangedEventData.ts deleted file mode 100644 index 48c566bae..000000000 --- a/src/serialization/types/DisputeStateChangedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeStateChangedEventObject } from "./DisputeStateChangedEventObject"; - -export const DisputeStateChangedEventData: core.serialization.ObjectSchema< - serializers.DisputeStateChangedEventData.Raw, - Square.DisputeStateChangedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DisputeStateChangedEventObject.optional(), -}); - -export declare namespace DisputeStateChangedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DisputeStateChangedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DisputeStateChangedEventObject.ts b/src/serialization/types/DisputeStateChangedEventObject.ts deleted file mode 100644 index 9384df171..000000000 --- a/src/serialization/types/DisputeStateChangedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Dispute } from "./Dispute"; - -export const DisputeStateChangedEventObject: core.serialization.ObjectSchema< - serializers.DisputeStateChangedEventObject.Raw, - Square.DisputeStateChangedEventObject -> = core.serialization.object({ - object: Dispute.optional(), -}); - -export declare namespace DisputeStateChangedEventObject { - export interface Raw { - object?: Dispute.Raw | null; - } -} diff --git a/src/serialization/types/DisputeStateUpdatedEvent.ts b/src/serialization/types/DisputeStateUpdatedEvent.ts deleted file mode 100644 index 7c05a6f04..000000000 --- a/src/serialization/types/DisputeStateUpdatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeStateUpdatedEventData } from "./DisputeStateUpdatedEventData"; - -export const DisputeStateUpdatedEvent: core.serialization.ObjectSchema< - serializers.DisputeStateUpdatedEvent.Raw, - Square.DisputeStateUpdatedEvent -> = 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: DisputeStateUpdatedEventData.optional(), -}); - -export declare namespace DisputeStateUpdatedEvent { - 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?: DisputeStateUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/DisputeStateUpdatedEventData.ts b/src/serialization/types/DisputeStateUpdatedEventData.ts deleted file mode 100644 index ff28f07a8..000000000 --- a/src/serialization/types/DisputeStateUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { DisputeStateUpdatedEventObject } from "./DisputeStateUpdatedEventObject"; - -export const DisputeStateUpdatedEventData: core.serialization.ObjectSchema< - serializers.DisputeStateUpdatedEventData.Raw, - Square.DisputeStateUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: DisputeStateUpdatedEventObject.optional(), -}); - -export declare namespace DisputeStateUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: DisputeStateUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/DisputeStateUpdatedEventObject.ts b/src/serialization/types/DisputeStateUpdatedEventObject.ts deleted file mode 100644 index 4bd6d4d02..000000000 --- a/src/serialization/types/DisputeStateUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Dispute } from "./Dispute"; - -export const DisputeStateUpdatedEventObject: core.serialization.ObjectSchema< - serializers.DisputeStateUpdatedEventObject.Raw, - Square.DisputeStateUpdatedEventObject -> = core.serialization.object({ - object: Dispute.optional(), -}); - -export declare namespace DisputeStateUpdatedEventObject { - export interface Raw { - object?: Dispute.Raw | null; - } -} diff --git a/src/serialization/types/DisputedPayment.ts b/src/serialization/types/DisputedPayment.ts deleted file mode 100644 index 5c0798547..000000000 --- a/src/serialization/types/DisputedPayment.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated 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/EcomVisibility.ts b/src/serialization/types/EcomVisibility.ts deleted file mode 100644 index abbb5c027..000000000 --- a/src/serialization/types/EcomVisibility.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const EcomVisibility: core.serialization.Schema = - core.serialization.enum_(["UNINDEXED", "UNAVAILABLE", "HIDDEN", "VISIBLE"]); - -export declare namespace EcomVisibility { - export type Raw = "UNINDEXED" | "UNAVAILABLE" | "HIDDEN" | "VISIBLE"; -} diff --git a/src/serialization/types/Employee.ts b/src/serialization/types/Employee.ts deleted file mode 100644 index 860e08f00..000000000 --- a/src/serialization/types/Employee.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 46d16d836..000000000 --- a/src/serialization/types/EmployeeStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 14437ed3b..000000000 --- a/src/serialization/types/EmployeeWage.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 98c90c894..000000000 --- a/src/serialization/types/EnableEventsResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index dad8ca955..000000000 --- a/src/serialization/types/ErrorCategory.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ffbff6731..000000000 --- a/src/serialization/types/ErrorCode.ts +++ /dev/null @@ -1,321 +0,0 @@ -/** - * This file was auto-generated 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", - "READER_DECLINED", - "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_ERROR_PAYMENT_NEEDS_COMPLETION", - "REFUND_DECLINED", - "INSUFFICIENT_PERMISSIONS_FOR_REFUND", - "INVALID_CARD_DATA", - "SOURCE_USED", - "SOURCE_EXPIRED", - "UNSUPPORTED_LOYALTY_REWARD_TIER", - "LOCATION_MISMATCH", - "ORDER_UNPAID_NOT_RETURNABLE", - "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" - | "READER_DECLINED" - | "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_ERROR_PAYMENT_NEEDS_COMPLETION" - | "REFUND_DECLINED" - | "INSUFFICIENT_PERMISSIONS_FOR_REFUND" - | "INVALID_CARD_DATA" - | "SOURCE_USED" - | "SOURCE_EXPIRED" - | "UNSUPPORTED_LOYALTY_REWARD_TIER" - | "LOCATION_MISMATCH" - | "ORDER_UNPAID_NOT_RETURNABLE" - | "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 deleted file mode 100644 index 00b51db34..000000000 --- a/src/serialization/types/Error_.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4c24c847c..000000000 --- a/src/serialization/types/Event.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a4f971bf8..000000000 --- a/src/serialization/types/EventData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 6e97d0967..000000000 --- a/src/serialization/types/EventMetadata.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5eddc56f3..000000000 --- a/src/serialization/types/EventTypeMetadata.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d00e62988..000000000 --- a/src/serialization/types/ExcludeStrategy.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 957fe6370..000000000 --- a/src/serialization/types/ExternalPaymentDetails.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b16ce73bd..000000000 --- a/src/serialization/types/FilterValue.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 40ebe8f9e..000000000 --- a/src/serialization/types/FloatNumberRange.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 761eeaa08..000000000 --- a/src/serialization/types/Fulfillment.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index fc6a290f3..000000000 --- a/src/serialization/types/FulfillmentDeliveryDetails.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index dd1d97b1e..000000000 --- a/src/serialization/types/FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index da586b64f..000000000 --- a/src/serialization/types/FulfillmentFulfillmentEntry.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0a3c8ab9e..000000000 --- a/src/serialization/types/FulfillmentFulfillmentLineItemApplication.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f88d88241..000000000 --- a/src/serialization/types/FulfillmentPickupDetails.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ce8f1eb19..000000000 --- a/src/serialization/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 1d5ad7e9b..000000000 --- a/src/serialization/types/FulfillmentPickupDetailsScheduleType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 43148eacb..000000000 --- a/src/serialization/types/FulfillmentRecipient.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b79f6229d..000000000 --- a/src/serialization/types/FulfillmentShipmentDetails.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d624ac9e3..000000000 --- a/src/serialization/types/FulfillmentState.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 88783a472..000000000 --- a/src/serialization/types/FulfillmentType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f4c5e2568..000000000 --- a/src/serialization/types/GetBankAccountByV1IdResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cb4e4e99d..000000000 --- a/src/serialization/types/GetBankAccountResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetBookingRequest.ts b/src/serialization/types/GetBookingRequest.ts deleted file mode 100644 index d408951cc..000000000 --- a/src/serialization/types/GetBookingRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetBookingRequest: core.serialization.Schema = - core.serialization.unknown(); - -export declare namespace GetBookingRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetBookingResponse.ts b/src/serialization/types/GetBookingResponse.ts deleted file mode 100644 index 2a90fa6d8..000000000 --- a/src/serialization/types/GetBookingResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 026c809cc..000000000 --- a/src/serialization/types/GetBreakTypeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetBusinessBookingProfileRequest.ts b/src/serialization/types/GetBusinessBookingProfileRequest.ts deleted file mode 100644 index 26bfcf738..000000000 --- a/src/serialization/types/GetBusinessBookingProfileRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetBusinessBookingProfileRequest: core.serialization.Schema< - serializers.GetBusinessBookingProfileRequest.Raw, - Square.GetBusinessBookingProfileRequest -> = core.serialization.unknown(); - -export declare namespace GetBusinessBookingProfileRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetBusinessBookingProfileResponse.ts b/src/serialization/types/GetBusinessBookingProfileResponse.ts deleted file mode 100644 index 9c7bd48c6..000000000 --- a/src/serialization/types/GetBusinessBookingProfileResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetCardRequest.ts b/src/serialization/types/GetCardRequest.ts deleted file mode 100644 index 12ae29f20..000000000 --- a/src/serialization/types/GetCardRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetCardRequest: core.serialization.Schema = - core.serialization.unknown(); - -export declare namespace GetCardRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetCardResponse.ts b/src/serialization/types/GetCardResponse.ts deleted file mode 100644 index 4f32f7c94..000000000 --- a/src/serialization/types/GetCardResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7dbb57527..000000000 --- a/src/serialization/types/GetCashDrawerShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bfaac4ff3..000000000 --- a/src/serialization/types/GetCatalogObjectResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1472950ac..000000000 --- a/src/serialization/types/GetCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b927cf0fa..000000000 --- a/src/serialization/types/GetCustomerCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetCustomerGroupRequest.ts b/src/serialization/types/GetCustomerGroupRequest.ts deleted file mode 100644 index f4dfa52b9..000000000 --- a/src/serialization/types/GetCustomerGroupRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetCustomerGroupRequest: core.serialization.Schema< - serializers.GetCustomerGroupRequest.Raw, - Square.GetCustomerGroupRequest -> = core.serialization.unknown(); - -export declare namespace GetCustomerGroupRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetCustomerGroupResponse.ts b/src/serialization/types/GetCustomerGroupResponse.ts deleted file mode 100644 index a7006053f..000000000 --- a/src/serialization/types/GetCustomerGroupResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetCustomerRequest.ts b/src/serialization/types/GetCustomerRequest.ts deleted file mode 100644 index 8526416bd..000000000 --- a/src/serialization/types/GetCustomerRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetCustomerRequest: core.serialization.Schema< - serializers.GetCustomerRequest.Raw, - Square.GetCustomerRequest -> = core.serialization.unknown(); - -export declare namespace GetCustomerRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetCustomerResponse.ts b/src/serialization/types/GetCustomerResponse.ts deleted file mode 100644 index f590308e1..000000000 --- a/src/serialization/types/GetCustomerResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetCustomerSegmentRequest.ts b/src/serialization/types/GetCustomerSegmentRequest.ts deleted file mode 100644 index c247de446..000000000 --- a/src/serialization/types/GetCustomerSegmentRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetCustomerSegmentRequest: core.serialization.Schema< - serializers.GetCustomerSegmentRequest.Raw, - Square.GetCustomerSegmentRequest -> = core.serialization.unknown(); - -export declare namespace GetCustomerSegmentRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetCustomerSegmentResponse.ts b/src/serialization/types/GetCustomerSegmentResponse.ts deleted file mode 100644 index 40aa558b5..000000000 --- a/src/serialization/types/GetCustomerSegmentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ce9400994..000000000 --- a/src/serialization/types/GetDeviceCodeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0de28714a..000000000 --- a/src/serialization/types/GetDeviceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetDisputeEvidenceRequest.ts b/src/serialization/types/GetDisputeEvidenceRequest.ts deleted file mode 100644 index 63effcd24..000000000 --- a/src/serialization/types/GetDisputeEvidenceRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetDisputeEvidenceRequest: core.serialization.Schema< - serializers.GetDisputeEvidenceRequest.Raw, - Square.GetDisputeEvidenceRequest -> = core.serialization.unknown(); - -export declare namespace GetDisputeEvidenceRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetDisputeEvidenceResponse.ts b/src/serialization/types/GetDisputeEvidenceResponse.ts deleted file mode 100644 index df9d25569..000000000 --- a/src/serialization/types/GetDisputeEvidenceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetDisputeRequest.ts b/src/serialization/types/GetDisputeRequest.ts deleted file mode 100644 index e8d3f5ce1..000000000 --- a/src/serialization/types/GetDisputeRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetDisputeRequest: core.serialization.Schema = - core.serialization.unknown(); - -export declare namespace GetDisputeRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetDisputeResponse.ts b/src/serialization/types/GetDisputeResponse.ts deleted file mode 100644 index 182b44846..000000000 --- a/src/serialization/types/GetDisputeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetEmployeeRequest.ts b/src/serialization/types/GetEmployeeRequest.ts deleted file mode 100644 index 136c96bbe..000000000 --- a/src/serialization/types/GetEmployeeRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetEmployeeRequest: core.serialization.Schema< - serializers.GetEmployeeRequest.Raw, - Square.GetEmployeeRequest -> = core.serialization.unknown(); - -export declare namespace GetEmployeeRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetEmployeeResponse.ts b/src/serialization/types/GetEmployeeResponse.ts deleted file mode 100644 index 268f84fc5..000000000 --- a/src/serialization/types/GetEmployeeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5181efdb6..000000000 --- a/src/serialization/types/GetEmployeeWageResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cf88fa9ad..000000000 --- a/src/serialization/types/GetGiftCardFromGanResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 242d8b966..000000000 --- a/src/serialization/types/GetGiftCardFromNonceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetGiftCardRequest.ts b/src/serialization/types/GetGiftCardRequest.ts deleted file mode 100644 index 3c705f1c6..000000000 --- a/src/serialization/types/GetGiftCardRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetGiftCardRequest: core.serialization.Schema< - serializers.GetGiftCardRequest.Raw, - Square.GetGiftCardRequest -> = core.serialization.unknown(); - -export declare namespace GetGiftCardRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetGiftCardResponse.ts b/src/serialization/types/GetGiftCardResponse.ts deleted file mode 100644 index 467a46cc0..000000000 --- a/src/serialization/types/GetGiftCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetInventoryAdjustmentRequest.ts b/src/serialization/types/GetInventoryAdjustmentRequest.ts deleted file mode 100644 index 4902f518c..000000000 --- a/src/serialization/types/GetInventoryAdjustmentRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetInventoryAdjustmentRequest: core.serialization.Schema< - serializers.GetInventoryAdjustmentRequest.Raw, - Square.GetInventoryAdjustmentRequest -> = core.serialization.unknown(); - -export declare namespace GetInventoryAdjustmentRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetInventoryAdjustmentResponse.ts b/src/serialization/types/GetInventoryAdjustmentResponse.ts deleted file mode 100644 index 74163baa7..000000000 --- a/src/serialization/types/GetInventoryAdjustmentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1c75db603..000000000 --- a/src/serialization/types/GetInventoryChangesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f9f487d37..000000000 --- a/src/serialization/types/GetInventoryCountResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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/GetInventoryPhysicalCountRequest.ts b/src/serialization/types/GetInventoryPhysicalCountRequest.ts deleted file mode 100644 index 0df7bf141..000000000 --- a/src/serialization/types/GetInventoryPhysicalCountRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetInventoryPhysicalCountRequest: core.serialization.Schema< - serializers.GetInventoryPhysicalCountRequest.Raw, - Square.GetInventoryPhysicalCountRequest -> = core.serialization.unknown(); - -export declare namespace GetInventoryPhysicalCountRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetInventoryPhysicalCountResponse.ts b/src/serialization/types/GetInventoryPhysicalCountResponse.ts deleted file mode 100644 index 74e4f9b41..000000000 --- a/src/serialization/types/GetInventoryPhysicalCountResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetInventoryTransferRequest.ts b/src/serialization/types/GetInventoryTransferRequest.ts deleted file mode 100644 index 7d7383fce..000000000 --- a/src/serialization/types/GetInventoryTransferRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetInventoryTransferRequest: core.serialization.Schema< - serializers.GetInventoryTransferRequest.Raw, - Square.GetInventoryTransferRequest -> = core.serialization.unknown(); - -export declare namespace GetInventoryTransferRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetInventoryTransferResponse.ts b/src/serialization/types/GetInventoryTransferResponse.ts deleted file mode 100644 index 2094d9103..000000000 --- a/src/serialization/types/GetInventoryTransferResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 038461e76..000000000 --- a/src/serialization/types/GetInvoiceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetLocationRequest.ts b/src/serialization/types/GetLocationRequest.ts deleted file mode 100644 index 461c0c8cc..000000000 --- a/src/serialization/types/GetLocationRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetLocationRequest: core.serialization.Schema< - serializers.GetLocationRequest.Raw, - Square.GetLocationRequest -> = core.serialization.unknown(); - -export declare namespace GetLocationRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetLocationResponse.ts b/src/serialization/types/GetLocationResponse.ts deleted file mode 100644 index 7d4112fd7..000000000 --- a/src/serialization/types/GetLocationResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetLoyaltyAccountRequest.ts b/src/serialization/types/GetLoyaltyAccountRequest.ts deleted file mode 100644 index 689c3491a..000000000 --- a/src/serialization/types/GetLoyaltyAccountRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetLoyaltyAccountRequest: core.serialization.Schema< - serializers.GetLoyaltyAccountRequest.Raw, - Square.GetLoyaltyAccountRequest -> = core.serialization.unknown(); - -export declare namespace GetLoyaltyAccountRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetLoyaltyAccountResponse.ts b/src/serialization/types/GetLoyaltyAccountResponse.ts deleted file mode 100644 index 15b8eeb30..000000000 --- a/src/serialization/types/GetLoyaltyAccountResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetLoyaltyProgramRequest.ts b/src/serialization/types/GetLoyaltyProgramRequest.ts deleted file mode 100644 index c7ab0be0a..000000000 --- a/src/serialization/types/GetLoyaltyProgramRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetLoyaltyProgramRequest: core.serialization.Schema< - serializers.GetLoyaltyProgramRequest.Raw, - Square.GetLoyaltyProgramRequest -> = core.serialization.unknown(); - -export declare namespace GetLoyaltyProgramRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetLoyaltyProgramResponse.ts b/src/serialization/types/GetLoyaltyProgramResponse.ts deleted file mode 100644 index c054699c1..000000000 --- a/src/serialization/types/GetLoyaltyProgramResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetLoyaltyPromotionRequest.ts b/src/serialization/types/GetLoyaltyPromotionRequest.ts deleted file mode 100644 index 36531ed2e..000000000 --- a/src/serialization/types/GetLoyaltyPromotionRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetLoyaltyPromotionRequest: core.serialization.Schema< - serializers.GetLoyaltyPromotionRequest.Raw, - Square.GetLoyaltyPromotionRequest -> = core.serialization.unknown(); - -export declare namespace GetLoyaltyPromotionRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetLoyaltyPromotionResponse.ts b/src/serialization/types/GetLoyaltyPromotionResponse.ts deleted file mode 100644 index d300d9cbd..000000000 --- a/src/serialization/types/GetLoyaltyPromotionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetLoyaltyRewardRequest.ts b/src/serialization/types/GetLoyaltyRewardRequest.ts deleted file mode 100644 index d8ecd561b..000000000 --- a/src/serialization/types/GetLoyaltyRewardRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetLoyaltyRewardRequest: core.serialization.Schema< - serializers.GetLoyaltyRewardRequest.Raw, - Square.GetLoyaltyRewardRequest -> = core.serialization.unknown(); - -export declare namespace GetLoyaltyRewardRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetLoyaltyRewardResponse.ts b/src/serialization/types/GetLoyaltyRewardResponse.ts deleted file mode 100644 index d936de9af..000000000 --- a/src/serialization/types/GetLoyaltyRewardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetMerchantRequest.ts b/src/serialization/types/GetMerchantRequest.ts deleted file mode 100644 index 23b622a5b..000000000 --- a/src/serialization/types/GetMerchantRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetMerchantRequest: core.serialization.Schema< - serializers.GetMerchantRequest.Raw, - Square.GetMerchantRequest -> = core.serialization.unknown(); - -export declare namespace GetMerchantRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetMerchantResponse.ts b/src/serialization/types/GetMerchantResponse.ts deleted file mode 100644 index 4f6ed35c3..000000000 --- a/src/serialization/types/GetMerchantResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetOrderRequest.ts b/src/serialization/types/GetOrderRequest.ts deleted file mode 100644 index 90f21d792..000000000 --- a/src/serialization/types/GetOrderRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetOrderRequest: core.serialization.Schema = - core.serialization.unknown(); - -export declare namespace GetOrderRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetOrderResponse.ts b/src/serialization/types/GetOrderResponse.ts deleted file mode 100644 index 903ce0f8c..000000000 --- a/src/serialization/types/GetOrderResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetPaymentLinkRequest.ts b/src/serialization/types/GetPaymentLinkRequest.ts deleted file mode 100644 index 96dd5d8a5..000000000 --- a/src/serialization/types/GetPaymentLinkRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetPaymentLinkRequest: core.serialization.Schema< - serializers.GetPaymentLinkRequest.Raw, - Square.GetPaymentLinkRequest -> = core.serialization.unknown(); - -export declare namespace GetPaymentLinkRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetPaymentLinkResponse.ts b/src/serialization/types/GetPaymentLinkResponse.ts deleted file mode 100644 index bcdcca186..000000000 --- a/src/serialization/types/GetPaymentLinkResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9711d4d39..000000000 --- a/src/serialization/types/GetPaymentRefundResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0f380cf2f..000000000 --- a/src/serialization/types/GetPaymentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cebd3beca..000000000 --- a/src/serialization/types/GetPayoutResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9c02f8677..000000000 --- a/src/serialization/types/GetShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetSnippetRequest.ts b/src/serialization/types/GetSnippetRequest.ts deleted file mode 100644 index 8bcf10913..000000000 --- a/src/serialization/types/GetSnippetRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetSnippetRequest: core.serialization.Schema = - core.serialization.unknown(); - -export declare namespace GetSnippetRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetSnippetResponse.ts b/src/serialization/types/GetSnippetResponse.ts deleted file mode 100644 index a0a418678..000000000 --- a/src/serialization/types/GetSnippetResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 76695322b..000000000 --- a/src/serialization/types/GetSubscriptionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetTeamMemberBookingProfileRequest.ts b/src/serialization/types/GetTeamMemberBookingProfileRequest.ts deleted file mode 100644 index ff7ab4a1e..000000000 --- a/src/serialization/types/GetTeamMemberBookingProfileRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetTeamMemberBookingProfileRequest: core.serialization.Schema< - serializers.GetTeamMemberBookingProfileRequest.Raw, - Square.GetTeamMemberBookingProfileRequest -> = core.serialization.unknown(); - -export declare namespace GetTeamMemberBookingProfileRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetTeamMemberBookingProfileResponse.ts b/src/serialization/types/GetTeamMemberBookingProfileResponse.ts deleted file mode 100644 index 5069af0aa..000000000 --- a/src/serialization/types/GetTeamMemberBookingProfileResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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/GetTeamMemberRequest.ts b/src/serialization/types/GetTeamMemberRequest.ts deleted file mode 100644 index b65d724ff..000000000 --- a/src/serialization/types/GetTeamMemberRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetTeamMemberRequest: core.serialization.Schema< - serializers.GetTeamMemberRequest.Raw, - Square.GetTeamMemberRequest -> = core.serialization.unknown(); - -export declare namespace GetTeamMemberRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetTeamMemberResponse.ts b/src/serialization/types/GetTeamMemberResponse.ts deleted file mode 100644 index 4023d83fe..000000000 --- a/src/serialization/types/GetTeamMemberResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d226f40f6..000000000 --- a/src/serialization/types/GetTeamMemberWageResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 701202b83..000000000 --- a/src/serialization/types/GetTerminalActionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2a89d63a4..000000000 --- a/src/serialization/types/GetTerminalCheckoutResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 87febea02..000000000 --- a/src/serialization/types/GetTerminalRefundResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetTransactionRequest.ts b/src/serialization/types/GetTransactionRequest.ts deleted file mode 100644 index f3adb132a..000000000 --- a/src/serialization/types/GetTransactionRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetTransactionRequest: core.serialization.Schema< - serializers.GetTransactionRequest.Raw, - Square.GetTransactionRequest -> = core.serialization.unknown(); - -export declare namespace GetTransactionRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetTransactionResponse.ts b/src/serialization/types/GetTransactionResponse.ts deleted file mode 100644 index c91a94d24..000000000 --- a/src/serialization/types/GetTransactionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetVendorRequest.ts b/src/serialization/types/GetVendorRequest.ts deleted file mode 100644 index 4c6a3fd38..000000000 --- a/src/serialization/types/GetVendorRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetVendorRequest: core.serialization.Schema = - core.serialization.unknown(); - -export declare namespace GetVendorRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetVendorResponse.ts b/src/serialization/types/GetVendorResponse.ts deleted file mode 100644 index e2c170739..000000000 --- a/src/serialization/types/GetVendorResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetWageSettingRequest.ts b/src/serialization/types/GetWageSettingRequest.ts deleted file mode 100644 index 52ba32b82..000000000 --- a/src/serialization/types/GetWageSettingRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetWageSettingRequest: core.serialization.Schema< - serializers.GetWageSettingRequest.Raw, - Square.GetWageSettingRequest -> = core.serialization.unknown(); - -export declare namespace GetWageSettingRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetWageSettingResponse.ts b/src/serialization/types/GetWageSettingResponse.ts deleted file mode 100644 index cb181e5e7..000000000 --- a/src/serialization/types/GetWageSettingResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/GetWebhookSubscriptionRequest.ts b/src/serialization/types/GetWebhookSubscriptionRequest.ts deleted file mode 100644 index 2e6771793..000000000 --- a/src/serialization/types/GetWebhookSubscriptionRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const GetWebhookSubscriptionRequest: core.serialization.Schema< - serializers.GetWebhookSubscriptionRequest.Raw, - Square.GetWebhookSubscriptionRequest -> = core.serialization.unknown(); - -export declare namespace GetWebhookSubscriptionRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/GetWebhookSubscriptionResponse.ts b/src/serialization/types/GetWebhookSubscriptionResponse.ts deleted file mode 100644 index 3e02e9e12..000000000 --- a/src/serialization/types/GetWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 87199f596..000000000 --- a/src/serialization/types/GiftCard.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5f2f95243..000000000 --- a/src/serialization/types/GiftCardActivity.ts +++ /dev/null @@ -1,106 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f4643ba31..000000000 --- a/src/serialization/types/GiftCardActivityActivate.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2f77e39a1..000000000 --- a/src/serialization/types/GiftCardActivityAdjustDecrement.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9d2d0fbd3..000000000 --- a/src/serialization/types/GiftCardActivityAdjustDecrementReason.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 49f48b1e2..000000000 --- a/src/serialization/types/GiftCardActivityAdjustIncrement.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cadc8cc9a..000000000 --- a/src/serialization/types/GiftCardActivityAdjustIncrementReason.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e1d40a989..000000000 --- a/src/serialization/types/GiftCardActivityBlock.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d24d63096..000000000 --- a/src/serialization/types/GiftCardActivityBlockReason.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 14f5d1d26..000000000 --- a/src/serialization/types/GiftCardActivityClearBalance.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5fe86e635..000000000 --- a/src/serialization/types/GiftCardActivityClearBalanceReason.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/GiftCardActivityCreatedEvent.ts b/src/serialization/types/GiftCardActivityCreatedEvent.ts deleted file mode 100644 index 82935bdd9..000000000 --- a/src/serialization/types/GiftCardActivityCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardActivityCreatedEventData } from "./GiftCardActivityCreatedEventData"; - -export const GiftCardActivityCreatedEvent: core.serialization.ObjectSchema< - serializers.GiftCardActivityCreatedEvent.Raw, - Square.GiftCardActivityCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: GiftCardActivityCreatedEventData.optional(), -}); - -export declare namespace GiftCardActivityCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: GiftCardActivityCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardActivityCreatedEventData.ts b/src/serialization/types/GiftCardActivityCreatedEventData.ts deleted file mode 100644 index 1d274aa2b..000000000 --- a/src/serialization/types/GiftCardActivityCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardActivityCreatedEventObject } from "./GiftCardActivityCreatedEventObject"; - -export const GiftCardActivityCreatedEventData: core.serialization.ObjectSchema< - serializers.GiftCardActivityCreatedEventData.Raw, - Square.GiftCardActivityCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: GiftCardActivityCreatedEventObject.optional(), -}); - -export declare namespace GiftCardActivityCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: GiftCardActivityCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardActivityCreatedEventObject.ts b/src/serialization/types/GiftCardActivityCreatedEventObject.ts deleted file mode 100644 index 736486217..000000000 --- a/src/serialization/types/GiftCardActivityCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./GiftCardActivity"; - -export const GiftCardActivityCreatedEventObject: core.serialization.ObjectSchema< - serializers.GiftCardActivityCreatedEventObject.Raw, - Square.GiftCardActivityCreatedEventObject -> = core.serialization.object({ - giftCardActivity: core.serialization.property("gift_card_activity", GiftCardActivity.optional()), -}); - -export declare namespace GiftCardActivityCreatedEventObject { - export interface Raw { - gift_card_activity?: GiftCardActivity.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardActivityDeactivate.ts b/src/serialization/types/GiftCardActivityDeactivate.ts deleted file mode 100644 index 490a74c9e..000000000 --- a/src/serialization/types/GiftCardActivityDeactivate.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 47ecedbf1..000000000 --- a/src/serialization/types/GiftCardActivityDeactivateReason.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3a84bf94b..000000000 --- a/src/serialization/types/GiftCardActivityImport.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f7627916d..000000000 --- a/src/serialization/types/GiftCardActivityImportReversal.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 610635f63..000000000 --- a/src/serialization/types/GiftCardActivityLoad.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0e43c3bc3..000000000 --- a/src/serialization/types/GiftCardActivityRedeem.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ea0717145..000000000 --- a/src/serialization/types/GiftCardActivityRedeemStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b2983e9be..000000000 --- a/src/serialization/types/GiftCardActivityRefund.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 852fb7857..000000000 --- a/src/serialization/types/GiftCardActivityTransferBalanceFrom.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 147277398..000000000 --- a/src/serialization/types/GiftCardActivityTransferBalanceTo.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2c628dac9..000000000 --- a/src/serialization/types/GiftCardActivityType.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 6cf9f515b..000000000 --- a/src/serialization/types/GiftCardActivityUnblock.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1ffb7a9bb..000000000 --- a/src/serialization/types/GiftCardActivityUnblockReason.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5e5cd0347..000000000 --- a/src/serialization/types/GiftCardActivityUnlinkedActivityRefund.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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/GiftCardActivityUpdatedEvent.ts b/src/serialization/types/GiftCardActivityUpdatedEvent.ts deleted file mode 100644 index 31442efd6..000000000 --- a/src/serialization/types/GiftCardActivityUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardActivityUpdatedEventData } from "./GiftCardActivityUpdatedEventData"; - -export const GiftCardActivityUpdatedEvent: core.serialization.ObjectSchema< - serializers.GiftCardActivityUpdatedEvent.Raw, - Square.GiftCardActivityUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: GiftCardActivityUpdatedEventData.optional(), -}); - -export declare namespace GiftCardActivityUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: GiftCardActivityUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardActivityUpdatedEventData.ts b/src/serialization/types/GiftCardActivityUpdatedEventData.ts deleted file mode 100644 index b7be9ff4d..000000000 --- a/src/serialization/types/GiftCardActivityUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardActivityUpdatedEventObject } from "./GiftCardActivityUpdatedEventObject"; - -export const GiftCardActivityUpdatedEventData: core.serialization.ObjectSchema< - serializers.GiftCardActivityUpdatedEventData.Raw, - Square.GiftCardActivityUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: GiftCardActivityUpdatedEventObject.optional(), -}); - -export declare namespace GiftCardActivityUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: GiftCardActivityUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardActivityUpdatedEventObject.ts b/src/serialization/types/GiftCardActivityUpdatedEventObject.ts deleted file mode 100644 index 0a0f6804f..000000000 --- a/src/serialization/types/GiftCardActivityUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./GiftCardActivity"; - -export const GiftCardActivityUpdatedEventObject: core.serialization.ObjectSchema< - serializers.GiftCardActivityUpdatedEventObject.Raw, - Square.GiftCardActivityUpdatedEventObject -> = core.serialization.object({ - giftCardActivity: core.serialization.property("gift_card_activity", GiftCardActivity.optional()), -}); - -export declare namespace GiftCardActivityUpdatedEventObject { - export interface Raw { - gift_card_activity?: GiftCardActivity.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCreatedEvent.ts b/src/serialization/types/GiftCardCreatedEvent.ts deleted file mode 100644 index 5a8b97b7a..000000000 --- a/src/serialization/types/GiftCardCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardCreatedEventData } from "./GiftCardCreatedEventData"; - -export const GiftCardCreatedEvent: core.serialization.ObjectSchema< - serializers.GiftCardCreatedEvent.Raw, - Square.GiftCardCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: GiftCardCreatedEventData.optional(), -}); - -export declare namespace GiftCardCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: GiftCardCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCreatedEventData.ts b/src/serialization/types/GiftCardCreatedEventData.ts deleted file mode 100644 index 1339cb783..000000000 --- a/src/serialization/types/GiftCardCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardCreatedEventObject } from "./GiftCardCreatedEventObject"; - -export const GiftCardCreatedEventData: core.serialization.ObjectSchema< - serializers.GiftCardCreatedEventData.Raw, - Square.GiftCardCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: GiftCardCreatedEventObject.optional(), -}); - -export declare namespace GiftCardCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: GiftCardCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCreatedEventObject.ts b/src/serialization/types/GiftCardCreatedEventObject.ts deleted file mode 100644 index 34de654f4..000000000 --- a/src/serialization/types/GiftCardCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./GiftCard"; - -export const GiftCardCreatedEventObject: core.serialization.ObjectSchema< - serializers.GiftCardCreatedEventObject.Raw, - Square.GiftCardCreatedEventObject -> = core.serialization.object({ - giftCard: core.serialization.property("gift_card", GiftCard.optional()), -}); - -export declare namespace GiftCardCreatedEventObject { - export interface Raw { - gift_card?: GiftCard.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCustomerLinkedEvent.ts b/src/serialization/types/GiftCardCustomerLinkedEvent.ts deleted file mode 100644 index 3bda42ea3..000000000 --- a/src/serialization/types/GiftCardCustomerLinkedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardCustomerLinkedEventData } from "./GiftCardCustomerLinkedEventData"; - -export const GiftCardCustomerLinkedEvent: core.serialization.ObjectSchema< - serializers.GiftCardCustomerLinkedEvent.Raw, - Square.GiftCardCustomerLinkedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: GiftCardCustomerLinkedEventData.optional(), -}); - -export declare namespace GiftCardCustomerLinkedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: GiftCardCustomerLinkedEventData.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCustomerLinkedEventData.ts b/src/serialization/types/GiftCardCustomerLinkedEventData.ts deleted file mode 100644 index 08fd44bc4..000000000 --- a/src/serialization/types/GiftCardCustomerLinkedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardCustomerLinkedEventObject } from "./GiftCardCustomerLinkedEventObject"; - -export const GiftCardCustomerLinkedEventData: core.serialization.ObjectSchema< - serializers.GiftCardCustomerLinkedEventData.Raw, - Square.GiftCardCustomerLinkedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: GiftCardCustomerLinkedEventObject.optional(), -}); - -export declare namespace GiftCardCustomerLinkedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: GiftCardCustomerLinkedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCustomerLinkedEventObject.ts b/src/serialization/types/GiftCardCustomerLinkedEventObject.ts deleted file mode 100644 index 78d7baf47..000000000 --- a/src/serialization/types/GiftCardCustomerLinkedEventObject.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 "./GiftCard"; - -export const GiftCardCustomerLinkedEventObject: core.serialization.ObjectSchema< - serializers.GiftCardCustomerLinkedEventObject.Raw, - Square.GiftCardCustomerLinkedEventObject -> = core.serialization.object({ - giftCard: core.serialization.property("gift_card", GiftCard.optional()), - linkedCustomerId: core.serialization.property("linked_customer_id", core.serialization.string().optionalNullable()), -}); - -export declare namespace GiftCardCustomerLinkedEventObject { - export interface Raw { - gift_card?: GiftCard.Raw | null; - linked_customer_id?: (string | null) | null; - } -} diff --git a/src/serialization/types/GiftCardCustomerUnlinkedEvent.ts b/src/serialization/types/GiftCardCustomerUnlinkedEvent.ts deleted file mode 100644 index fc128d347..000000000 --- a/src/serialization/types/GiftCardCustomerUnlinkedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardCustomerUnlinkedEventData } from "./GiftCardCustomerUnlinkedEventData"; - -export const GiftCardCustomerUnlinkedEvent: core.serialization.ObjectSchema< - serializers.GiftCardCustomerUnlinkedEvent.Raw, - Square.GiftCardCustomerUnlinkedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: GiftCardCustomerUnlinkedEventData.optional(), -}); - -export declare namespace GiftCardCustomerUnlinkedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: GiftCardCustomerUnlinkedEventData.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCustomerUnlinkedEventData.ts b/src/serialization/types/GiftCardCustomerUnlinkedEventData.ts deleted file mode 100644 index 3208e670e..000000000 --- a/src/serialization/types/GiftCardCustomerUnlinkedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardCustomerUnlinkedEventObject } from "./GiftCardCustomerUnlinkedEventObject"; - -export const GiftCardCustomerUnlinkedEventData: core.serialization.ObjectSchema< - serializers.GiftCardCustomerUnlinkedEventData.Raw, - Square.GiftCardCustomerUnlinkedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: GiftCardCustomerUnlinkedEventObject.optional(), -}); - -export declare namespace GiftCardCustomerUnlinkedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: GiftCardCustomerUnlinkedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardCustomerUnlinkedEventObject.ts b/src/serialization/types/GiftCardCustomerUnlinkedEventObject.ts deleted file mode 100644 index 2c74d9e6d..000000000 --- a/src/serialization/types/GiftCardCustomerUnlinkedEventObject.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 "./GiftCard"; - -export const GiftCardCustomerUnlinkedEventObject: core.serialization.ObjectSchema< - serializers.GiftCardCustomerUnlinkedEventObject.Raw, - Square.GiftCardCustomerUnlinkedEventObject -> = core.serialization.object({ - giftCard: core.serialization.property("gift_card", GiftCard.optional()), - unlinkedCustomerId: core.serialization.property( - "unlinked_customer_id", - core.serialization.string().optionalNullable(), - ), -}); - -export declare namespace GiftCardCustomerUnlinkedEventObject { - export interface Raw { - gift_card?: GiftCard.Raw | null; - unlinked_customer_id?: (string | null) | null; - } -} diff --git a/src/serialization/types/GiftCardGanSource.ts b/src/serialization/types/GiftCardGanSource.ts deleted file mode 100644 index 759e10061..000000000 --- a/src/serialization/types/GiftCardGanSource.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index eeb183e8f..000000000 --- a/src/serialization/types/GiftCardStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 42a52afa9..000000000 --- a/src/serialization/types/GiftCardType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/GiftCardUpdatedEvent.ts b/src/serialization/types/GiftCardUpdatedEvent.ts deleted file mode 100644 index e947e260c..000000000 --- a/src/serialization/types/GiftCardUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardUpdatedEventData } from "./GiftCardUpdatedEventData"; - -export const GiftCardUpdatedEvent: core.serialization.ObjectSchema< - serializers.GiftCardUpdatedEvent.Raw, - Square.GiftCardUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: GiftCardUpdatedEventData.optional(), -}); - -export declare namespace GiftCardUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: GiftCardUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardUpdatedEventData.ts b/src/serialization/types/GiftCardUpdatedEventData.ts deleted file mode 100644 index d5dd91b53..000000000 --- a/src/serialization/types/GiftCardUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { GiftCardUpdatedEventObject } from "./GiftCardUpdatedEventObject"; - -export const GiftCardUpdatedEventData: core.serialization.ObjectSchema< - serializers.GiftCardUpdatedEventData.Raw, - Square.GiftCardUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: GiftCardUpdatedEventObject.optional(), -}); - -export declare namespace GiftCardUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: GiftCardUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/GiftCardUpdatedEventObject.ts b/src/serialization/types/GiftCardUpdatedEventObject.ts deleted file mode 100644 index d550374cc..000000000 --- a/src/serialization/types/GiftCardUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./GiftCard"; - -export const GiftCardUpdatedEventObject: core.serialization.ObjectSchema< - serializers.GiftCardUpdatedEventObject.Raw, - Square.GiftCardUpdatedEventObject -> = core.serialization.object({ - giftCard: core.serialization.property("gift_card", GiftCard.optional()), -}); - -export declare namespace GiftCardUpdatedEventObject { - export interface Raw { - gift_card?: GiftCard.Raw | null; - } -} diff --git a/src/serialization/types/InventoryAdjustment.ts b/src/serialization/types/InventoryAdjustment.ts deleted file mode 100644 index c0f813c6f..000000000 --- a/src/serialization/types/InventoryAdjustment.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d32aa7ef2..000000000 --- a/src/serialization/types/InventoryAdjustmentGroup.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d89842f58..000000000 --- a/src/serialization/types/InventoryAlertType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ef50a81b7..000000000 --- a/src/serialization/types/InventoryChange.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6598bec3a..000000000 --- a/src/serialization/types/InventoryChangeType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5bc02050e..000000000 --- a/src/serialization/types/InventoryCount.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-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/InventoryCountUpdatedEvent.ts b/src/serialization/types/InventoryCountUpdatedEvent.ts deleted file mode 100644 index 982a5261d..000000000 --- a/src/serialization/types/InventoryCountUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InventoryCountUpdatedEventData } from "./InventoryCountUpdatedEventData"; - -export const InventoryCountUpdatedEvent: core.serialization.ObjectSchema< - serializers.InventoryCountUpdatedEvent.Raw, - Square.InventoryCountUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InventoryCountUpdatedEventData.optional(), -}); - -export declare namespace InventoryCountUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InventoryCountUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/InventoryCountUpdatedEventData.ts b/src/serialization/types/InventoryCountUpdatedEventData.ts deleted file mode 100644 index add9c6731..000000000 --- a/src/serialization/types/InventoryCountUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InventoryCountUpdatedEventObject } from "./InventoryCountUpdatedEventObject"; - -export const InventoryCountUpdatedEventData: core.serialization.ObjectSchema< - serializers.InventoryCountUpdatedEventData.Raw, - Square.InventoryCountUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InventoryCountUpdatedEventObject.optional(), -}); - -export declare namespace InventoryCountUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InventoryCountUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InventoryCountUpdatedEventObject.ts b/src/serialization/types/InventoryCountUpdatedEventObject.ts deleted file mode 100644 index f8329760c..000000000 --- a/src/serialization/types/InventoryCountUpdatedEventObject.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InventoryCount } from "./InventoryCount"; - -export const InventoryCountUpdatedEventObject: core.serialization.ObjectSchema< - serializers.InventoryCountUpdatedEventObject.Raw, - Square.InventoryCountUpdatedEventObject -> = core.serialization.object({ - inventoryCounts: core.serialization.property( - "inventory_counts", - core.serialization.list(InventoryCount).optionalNullable(), - ), -}); - -export declare namespace InventoryCountUpdatedEventObject { - export interface Raw { - inventory_counts?: (InventoryCount.Raw[] | null) | null; - } -} diff --git a/src/serialization/types/InventoryPhysicalCount.ts b/src/serialization/types/InventoryPhysicalCount.ts deleted file mode 100644 index 113358026..000000000 --- a/src/serialization/types/InventoryPhysicalCount.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9772f0399..000000000 --- a/src/serialization/types/InventoryState.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 27a01f6ad..000000000 --- a/src/serialization/types/InventoryTransfer.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cefcdd375..000000000 --- a/src/serialization/types/Invoice.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * This file was auto-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(), - creatorTeamMemberId: core.serialization.property( - "creator_team_member_id", - core.serialization.string().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; - creator_team_member_id?: string | null; - } -} diff --git a/src/serialization/types/InvoiceAcceptedPaymentMethods.ts b/src/serialization/types/InvoiceAcceptedPaymentMethods.ts deleted file mode 100644 index 17a0fc90e..000000000 --- a/src/serialization/types/InvoiceAcceptedPaymentMethods.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8479a3ba1..000000000 --- a/src/serialization/types/InvoiceAttachment.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f40f3b0cb..000000000 --- a/src/serialization/types/InvoiceAutomaticPaymentSource.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/InvoiceCanceledEvent.ts b/src/serialization/types/InvoiceCanceledEvent.ts deleted file mode 100644 index dde974a8a..000000000 --- a/src/serialization/types/InvoiceCanceledEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceCanceledEventData } from "./InvoiceCanceledEventData"; - -export const InvoiceCanceledEvent: core.serialization.ObjectSchema< - serializers.InvoiceCanceledEvent.Raw, - Square.InvoiceCanceledEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoiceCanceledEventData.optional(), -}); - -export declare namespace InvoiceCanceledEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoiceCanceledEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceCanceledEventData.ts b/src/serialization/types/InvoiceCanceledEventData.ts deleted file mode 100644 index 8de734272..000000000 --- a/src/serialization/types/InvoiceCanceledEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceCanceledEventObject } from "./InvoiceCanceledEventObject"; - -export const InvoiceCanceledEventData: core.serialization.ObjectSchema< - serializers.InvoiceCanceledEventData.Raw, - Square.InvoiceCanceledEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InvoiceCanceledEventObject.optional(), -}); - -export declare namespace InvoiceCanceledEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InvoiceCanceledEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceCanceledEventObject.ts b/src/serialization/types/InvoiceCanceledEventObject.ts deleted file mode 100644 index 65ee37ad2..000000000 --- a/src/serialization/types/InvoiceCanceledEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const InvoiceCanceledEventObject: core.serialization.ObjectSchema< - serializers.InvoiceCanceledEventObject.Raw, - Square.InvoiceCanceledEventObject -> = core.serialization.object({ - invoice: Invoice.optional(), -}); - -export declare namespace InvoiceCanceledEventObject { - export interface Raw { - invoice?: Invoice.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceCreatedEvent.ts b/src/serialization/types/InvoiceCreatedEvent.ts deleted file mode 100644 index d9e40bc13..000000000 --- a/src/serialization/types/InvoiceCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceCreatedEventData } from "./InvoiceCreatedEventData"; - -export const InvoiceCreatedEvent: core.serialization.ObjectSchema< - serializers.InvoiceCreatedEvent.Raw, - Square.InvoiceCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoiceCreatedEventData.optional(), -}); - -export declare namespace InvoiceCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoiceCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceCreatedEventData.ts b/src/serialization/types/InvoiceCreatedEventData.ts deleted file mode 100644 index 264b2d10c..000000000 --- a/src/serialization/types/InvoiceCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceCreatedEventObject } from "./InvoiceCreatedEventObject"; - -export const InvoiceCreatedEventData: core.serialization.ObjectSchema< - serializers.InvoiceCreatedEventData.Raw, - Square.InvoiceCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InvoiceCreatedEventObject.optional(), -}); - -export declare namespace InvoiceCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InvoiceCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceCreatedEventObject.ts b/src/serialization/types/InvoiceCreatedEventObject.ts deleted file mode 100644 index e2599d833..000000000 --- a/src/serialization/types/InvoiceCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const InvoiceCreatedEventObject: core.serialization.ObjectSchema< - serializers.InvoiceCreatedEventObject.Raw, - Square.InvoiceCreatedEventObject -> = core.serialization.object({ - invoice: Invoice.optional(), -}); - -export declare namespace InvoiceCreatedEventObject { - export interface Raw { - invoice?: Invoice.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceCustomField.ts b/src/serialization/types/InvoiceCustomField.ts deleted file mode 100644 index b68fb4a50..000000000 --- a/src/serialization/types/InvoiceCustomField.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 65e63c445..000000000 --- a/src/serialization/types/InvoiceCustomFieldPlacement.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/InvoiceDeletedEvent.ts b/src/serialization/types/InvoiceDeletedEvent.ts deleted file mode 100644 index ce27bea56..000000000 --- a/src/serialization/types/InvoiceDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceDeletedEventData } from "./InvoiceDeletedEventData"; - -export const InvoiceDeletedEvent: core.serialization.ObjectSchema< - serializers.InvoiceDeletedEvent.Raw, - Square.InvoiceDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoiceDeletedEventData.optional(), -}); - -export declare namespace InvoiceDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoiceDeletedEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceDeletedEventData.ts b/src/serialization/types/InvoiceDeletedEventData.ts deleted file mode 100644 index 13530b55b..000000000 --- a/src/serialization/types/InvoiceDeletedEventData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const InvoiceDeletedEventData: core.serialization.ObjectSchema< - serializers.InvoiceDeletedEventData.Raw, - Square.InvoiceDeletedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - deleted: core.serialization.boolean().optionalNullable(), -}); - -export declare namespace InvoiceDeletedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - deleted?: (boolean | null) | null; - } -} diff --git a/src/serialization/types/InvoiceDeliveryMethod.ts b/src/serialization/types/InvoiceDeliveryMethod.ts deleted file mode 100644 index 42ecaeb2d..000000000 --- a/src/serialization/types/InvoiceDeliveryMethod.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 2660f6970..000000000 --- a/src/serialization/types/InvoiceFilter.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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/InvoicePaymentMadeEvent.ts b/src/serialization/types/InvoicePaymentMadeEvent.ts deleted file mode 100644 index f9c95fd2a..000000000 --- a/src/serialization/types/InvoicePaymentMadeEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoicePaymentMadeEventData } from "./InvoicePaymentMadeEventData"; - -export const InvoicePaymentMadeEvent: core.serialization.ObjectSchema< - serializers.InvoicePaymentMadeEvent.Raw, - Square.InvoicePaymentMadeEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoicePaymentMadeEventData.optional(), -}); - -export declare namespace InvoicePaymentMadeEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoicePaymentMadeEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoicePaymentMadeEventData.ts b/src/serialization/types/InvoicePaymentMadeEventData.ts deleted file mode 100644 index 6086307ac..000000000 --- a/src/serialization/types/InvoicePaymentMadeEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoicePaymentMadeEventObject } from "./InvoicePaymentMadeEventObject"; - -export const InvoicePaymentMadeEventData: core.serialization.ObjectSchema< - serializers.InvoicePaymentMadeEventData.Raw, - Square.InvoicePaymentMadeEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InvoicePaymentMadeEventObject.optional(), -}); - -export declare namespace InvoicePaymentMadeEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InvoicePaymentMadeEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InvoicePaymentMadeEventObject.ts b/src/serialization/types/InvoicePaymentMadeEventObject.ts deleted file mode 100644 index bdd8ab3d4..000000000 --- a/src/serialization/types/InvoicePaymentMadeEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const InvoicePaymentMadeEventObject: core.serialization.ObjectSchema< - serializers.InvoicePaymentMadeEventObject.Raw, - Square.InvoicePaymentMadeEventObject -> = core.serialization.object({ - invoice: Invoice.optional(), -}); - -export declare namespace InvoicePaymentMadeEventObject { - export interface Raw { - invoice?: Invoice.Raw | null; - } -} diff --git a/src/serialization/types/InvoicePaymentReminder.ts b/src/serialization/types/InvoicePaymentReminder.ts deleted file mode 100644 index bc717670e..000000000 --- a/src/serialization/types/InvoicePaymentReminder.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index af696d158..000000000 --- a/src/serialization/types/InvoicePaymentReminderStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index cf3fa688f..000000000 --- a/src/serialization/types/InvoicePaymentRequest.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * This file was auto-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/InvoicePublishedEvent.ts b/src/serialization/types/InvoicePublishedEvent.ts deleted file mode 100644 index 5c69f8d03..000000000 --- a/src/serialization/types/InvoicePublishedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoicePublishedEventData } from "./InvoicePublishedEventData"; - -export const InvoicePublishedEvent: core.serialization.ObjectSchema< - serializers.InvoicePublishedEvent.Raw, - Square.InvoicePublishedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoicePublishedEventData.optional(), -}); - -export declare namespace InvoicePublishedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoicePublishedEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoicePublishedEventData.ts b/src/serialization/types/InvoicePublishedEventData.ts deleted file mode 100644 index e7eab5e8c..000000000 --- a/src/serialization/types/InvoicePublishedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoicePublishedEventObject } from "./InvoicePublishedEventObject"; - -export const InvoicePublishedEventData: core.serialization.ObjectSchema< - serializers.InvoicePublishedEventData.Raw, - Square.InvoicePublishedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InvoicePublishedEventObject.optional(), -}); - -export declare namespace InvoicePublishedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InvoicePublishedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InvoicePublishedEventObject.ts b/src/serialization/types/InvoicePublishedEventObject.ts deleted file mode 100644 index fa5cfa5a0..000000000 --- a/src/serialization/types/InvoicePublishedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const InvoicePublishedEventObject: core.serialization.ObjectSchema< - serializers.InvoicePublishedEventObject.Raw, - Square.InvoicePublishedEventObject -> = core.serialization.object({ - invoice: Invoice.optional(), -}); - -export declare namespace InvoicePublishedEventObject { - export interface Raw { - invoice?: Invoice.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceQuery.ts b/src/serialization/types/InvoiceQuery.ts deleted file mode 100644 index 9f15c7b8c..000000000 --- a/src/serialization/types/InvoiceQuery.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6062f89fb..000000000 --- a/src/serialization/types/InvoiceRecipient.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index da795ddb1..000000000 --- a/src/serialization/types/InvoiceRecipientTaxIds.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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/InvoiceRefundedEvent.ts b/src/serialization/types/InvoiceRefundedEvent.ts deleted file mode 100644 index 2bc213459..000000000 --- a/src/serialization/types/InvoiceRefundedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceRefundedEventData } from "./InvoiceRefundedEventData"; - -export const InvoiceRefundedEvent: core.serialization.ObjectSchema< - serializers.InvoiceRefundedEvent.Raw, - Square.InvoiceRefundedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoiceRefundedEventData.optional(), -}); - -export declare namespace InvoiceRefundedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoiceRefundedEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceRefundedEventData.ts b/src/serialization/types/InvoiceRefundedEventData.ts deleted file mode 100644 index 62397a7d0..000000000 --- a/src/serialization/types/InvoiceRefundedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceRefundedEventObject } from "./InvoiceRefundedEventObject"; - -export const InvoiceRefundedEventData: core.serialization.ObjectSchema< - serializers.InvoiceRefundedEventData.Raw, - Square.InvoiceRefundedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InvoiceRefundedEventObject.optional(), -}); - -export declare namespace InvoiceRefundedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InvoiceRefundedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceRefundedEventObject.ts b/src/serialization/types/InvoiceRefundedEventObject.ts deleted file mode 100644 index 3fc268233..000000000 --- a/src/serialization/types/InvoiceRefundedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const InvoiceRefundedEventObject: core.serialization.ObjectSchema< - serializers.InvoiceRefundedEventObject.Raw, - Square.InvoiceRefundedEventObject -> = core.serialization.object({ - invoice: Invoice.optional(), -}); - -export declare namespace InvoiceRefundedEventObject { - export interface Raw { - invoice?: Invoice.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceRequestMethod.ts b/src/serialization/types/InvoiceRequestMethod.ts deleted file mode 100644 index c1ae8b27b..000000000 --- a/src/serialization/types/InvoiceRequestMethod.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index cb33fb072..000000000 --- a/src/serialization/types/InvoiceRequestType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/InvoiceScheduledChargeFailedEvent.ts b/src/serialization/types/InvoiceScheduledChargeFailedEvent.ts deleted file mode 100644 index 8404aa5b2..000000000 --- a/src/serialization/types/InvoiceScheduledChargeFailedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceScheduledChargeFailedEventData } from "./InvoiceScheduledChargeFailedEventData"; - -export const InvoiceScheduledChargeFailedEvent: core.serialization.ObjectSchema< - serializers.InvoiceScheduledChargeFailedEvent.Raw, - Square.InvoiceScheduledChargeFailedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoiceScheduledChargeFailedEventData.optional(), -}); - -export declare namespace InvoiceScheduledChargeFailedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoiceScheduledChargeFailedEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceScheduledChargeFailedEventData.ts b/src/serialization/types/InvoiceScheduledChargeFailedEventData.ts deleted file mode 100644 index e694bdb82..000000000 --- a/src/serialization/types/InvoiceScheduledChargeFailedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceScheduledChargeFailedEventObject } from "./InvoiceScheduledChargeFailedEventObject"; - -export const InvoiceScheduledChargeFailedEventData: core.serialization.ObjectSchema< - serializers.InvoiceScheduledChargeFailedEventData.Raw, - Square.InvoiceScheduledChargeFailedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InvoiceScheduledChargeFailedEventObject.optional(), -}); - -export declare namespace InvoiceScheduledChargeFailedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InvoiceScheduledChargeFailedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceScheduledChargeFailedEventObject.ts b/src/serialization/types/InvoiceScheduledChargeFailedEventObject.ts deleted file mode 100644 index e88fce573..000000000 --- a/src/serialization/types/InvoiceScheduledChargeFailedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const InvoiceScheduledChargeFailedEventObject: core.serialization.ObjectSchema< - serializers.InvoiceScheduledChargeFailedEventObject.Raw, - Square.InvoiceScheduledChargeFailedEventObject -> = core.serialization.object({ - invoice: Invoice.optional(), -}); - -export declare namespace InvoiceScheduledChargeFailedEventObject { - export interface Raw { - invoice?: Invoice.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceSort.ts b/src/serialization/types/InvoiceSort.ts deleted file mode 100644 index c993551b0..000000000 --- a/src/serialization/types/InvoiceSort.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index de97dd1af..000000000 --- a/src/serialization/types/InvoiceSortField.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0d5019adb..000000000 --- a/src/serialization/types/InvoiceStatus.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-generated 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/InvoiceUpdatedEvent.ts b/src/serialization/types/InvoiceUpdatedEvent.ts deleted file mode 100644 index 11a6e1e61..000000000 --- a/src/serialization/types/InvoiceUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceUpdatedEventData } from "./InvoiceUpdatedEventData"; - -export const InvoiceUpdatedEvent: core.serialization.ObjectSchema< - serializers.InvoiceUpdatedEvent.Raw, - Square.InvoiceUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: InvoiceUpdatedEventData.optional(), -}); - -export declare namespace InvoiceUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: InvoiceUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceUpdatedEventData.ts b/src/serialization/types/InvoiceUpdatedEventData.ts deleted file mode 100644 index ce58d91bb..000000000 --- a/src/serialization/types/InvoiceUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { InvoiceUpdatedEventObject } from "./InvoiceUpdatedEventObject"; - -export const InvoiceUpdatedEventData: core.serialization.ObjectSchema< - serializers.InvoiceUpdatedEventData.Raw, - Square.InvoiceUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: InvoiceUpdatedEventObject.optional(), -}); - -export declare namespace InvoiceUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: InvoiceUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/InvoiceUpdatedEventObject.ts b/src/serialization/types/InvoiceUpdatedEventObject.ts deleted file mode 100644 index 00246a6d1..000000000 --- a/src/serialization/types/InvoiceUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const InvoiceUpdatedEventObject: core.serialization.ObjectSchema< - serializers.InvoiceUpdatedEventObject.Raw, - Square.InvoiceUpdatedEventObject -> = core.serialization.object({ - invoice: Invoice.optional(), -}); - -export declare namespace InvoiceUpdatedEventObject { - export interface Raw { - invoice?: Invoice.Raw | null; - } -} diff --git a/src/serialization/types/ItemVariationLocationOverrides.ts b/src/serialization/types/ItemVariationLocationOverrides.ts deleted file mode 100644 index f960fa211..000000000 --- a/src/serialization/types/ItemVariationLocationOverrides.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8e0104ca1..000000000 --- a/src/serialization/types/Job.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0d11dd48a..000000000 --- a/src/serialization/types/JobAssignment.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ba51de358..000000000 --- a/src/serialization/types/JobAssignmentPayType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/JobCreatedEvent.ts b/src/serialization/types/JobCreatedEvent.ts deleted file mode 100644 index c2d2b0e59..000000000 --- a/src/serialization/types/JobCreatedEvent.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { JobCreatedEventData } from "./JobCreatedEventData"; - -export const JobCreatedEvent: core.serialization.ObjectSchema = - core.serialization.object({ - merchantId: core.serialization.property("merchant_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: JobCreatedEventData.optional(), - }); - -export declare namespace JobCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: JobCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/JobCreatedEventData.ts b/src/serialization/types/JobCreatedEventData.ts deleted file mode 100644 index d4c691f21..000000000 --- a/src/serialization/types/JobCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { JobCreatedEventObject } from "./JobCreatedEventObject"; - -export const JobCreatedEventData: core.serialization.ObjectSchema< - serializers.JobCreatedEventData.Raw, - Square.JobCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: JobCreatedEventObject.optional(), -}); - -export declare namespace JobCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: JobCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/JobCreatedEventObject.ts b/src/serialization/types/JobCreatedEventObject.ts deleted file mode 100644 index 899b86a7f..000000000 --- a/src/serialization/types/JobCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const JobCreatedEventObject: core.serialization.ObjectSchema< - serializers.JobCreatedEventObject.Raw, - Square.JobCreatedEventObject -> = core.serialization.object({ - job: Job.optional(), -}); - -export declare namespace JobCreatedEventObject { - export interface Raw { - job?: Job.Raw | null; - } -} diff --git a/src/serialization/types/JobUpdatedEvent.ts b/src/serialization/types/JobUpdatedEvent.ts deleted file mode 100644 index 32bfc0f7f..000000000 --- a/src/serialization/types/JobUpdatedEvent.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { JobUpdatedEventData } from "./JobUpdatedEventData"; - -export const JobUpdatedEvent: core.serialization.ObjectSchema = - core.serialization.object({ - merchantId: core.serialization.property("merchant_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: JobUpdatedEventData.optional(), - }); - -export declare namespace JobUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: JobUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/JobUpdatedEventData.ts b/src/serialization/types/JobUpdatedEventData.ts deleted file mode 100644 index 33dc5bf86..000000000 --- a/src/serialization/types/JobUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { JobUpdatedEventObject } from "./JobUpdatedEventObject"; - -export const JobUpdatedEventData: core.serialization.ObjectSchema< - serializers.JobUpdatedEventData.Raw, - Square.JobUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: JobUpdatedEventObject.optional(), -}); - -export declare namespace JobUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: JobUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/JobUpdatedEventObject.ts b/src/serialization/types/JobUpdatedEventObject.ts deleted file mode 100644 index 9aa97d5e8..000000000 --- a/src/serialization/types/JobUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const JobUpdatedEventObject: core.serialization.ObjectSchema< - serializers.JobUpdatedEventObject.Raw, - Square.JobUpdatedEventObject -> = core.serialization.object({ - job: Job.optional(), -}); - -export declare namespace JobUpdatedEventObject { - export interface Raw { - job?: Job.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftCreatedEvent.ts b/src/serialization/types/LaborScheduledShiftCreatedEvent.ts deleted file mode 100644 index 67c11ba57..000000000 --- a/src/serialization/types/LaborScheduledShiftCreatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborScheduledShiftCreatedEventData } from "./LaborScheduledShiftCreatedEventData"; - -export const LaborScheduledShiftCreatedEvent: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftCreatedEvent.Raw, - Square.LaborScheduledShiftCreatedEvent -> = 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: LaborScheduledShiftCreatedEventData.optional(), -}); - -export declare namespace LaborScheduledShiftCreatedEvent { - 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?: LaborScheduledShiftCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftCreatedEventData.ts b/src/serialization/types/LaborScheduledShiftCreatedEventData.ts deleted file mode 100644 index 9c0e5e3cd..000000000 --- a/src/serialization/types/LaborScheduledShiftCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborScheduledShiftCreatedEventObject } from "./LaborScheduledShiftCreatedEventObject"; - -export const LaborScheduledShiftCreatedEventData: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftCreatedEventData.Raw, - Square.LaborScheduledShiftCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LaborScheduledShiftCreatedEventObject.optional(), -}); - -export declare namespace LaborScheduledShiftCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LaborScheduledShiftCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftCreatedEventObject.ts b/src/serialization/types/LaborScheduledShiftCreatedEventObject.ts deleted file mode 100644 index 87a6fb088..000000000 --- a/src/serialization/types/LaborScheduledShiftCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; - -export const LaborScheduledShiftCreatedEventObject: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftCreatedEventObject.Raw, - Square.LaborScheduledShiftCreatedEventObject -> = core.serialization.object({ - scheduledShift: core.serialization.property("ScheduledShift", ScheduledShift.optional()), -}); - -export declare namespace LaborScheduledShiftCreatedEventObject { - export interface Raw { - ScheduledShift?: ScheduledShift.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftDeletedEvent.ts b/src/serialization/types/LaborScheduledShiftDeletedEvent.ts deleted file mode 100644 index e75d36060..000000000 --- a/src/serialization/types/LaborScheduledShiftDeletedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborScheduledShiftDeletedEventData } from "./LaborScheduledShiftDeletedEventData"; - -export const LaborScheduledShiftDeletedEvent: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftDeletedEvent.Raw, - Square.LaborScheduledShiftDeletedEvent -> = 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: LaborScheduledShiftDeletedEventData.optional(), -}); - -export declare namespace LaborScheduledShiftDeletedEvent { - 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?: LaborScheduledShiftDeletedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftDeletedEventData.ts b/src/serialization/types/LaborScheduledShiftDeletedEventData.ts deleted file mode 100644 index 15a0b447b..000000000 --- a/src/serialization/types/LaborScheduledShiftDeletedEventData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const LaborScheduledShiftDeletedEventData: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftDeletedEventData.Raw, - Square.LaborScheduledShiftDeletedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - deleted: core.serialization.boolean().optionalNullable(), -}); - -export declare namespace LaborScheduledShiftDeletedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - deleted?: (boolean | null) | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftPublishedEvent.ts b/src/serialization/types/LaborScheduledShiftPublishedEvent.ts deleted file mode 100644 index 0067662da..000000000 --- a/src/serialization/types/LaborScheduledShiftPublishedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborScheduledShiftPublishedEventData } from "./LaborScheduledShiftPublishedEventData"; - -export const LaborScheduledShiftPublishedEvent: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftPublishedEvent.Raw, - Square.LaborScheduledShiftPublishedEvent -> = 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: LaborScheduledShiftPublishedEventData.optional(), -}); - -export declare namespace LaborScheduledShiftPublishedEvent { - 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?: LaborScheduledShiftPublishedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftPublishedEventData.ts b/src/serialization/types/LaborScheduledShiftPublishedEventData.ts deleted file mode 100644 index 659a4a719..000000000 --- a/src/serialization/types/LaborScheduledShiftPublishedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborScheduledShiftPublishedEventObject } from "./LaborScheduledShiftPublishedEventObject"; - -export const LaborScheduledShiftPublishedEventData: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftPublishedEventData.Raw, - Square.LaborScheduledShiftPublishedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LaborScheduledShiftPublishedEventObject.optional(), -}); - -export declare namespace LaborScheduledShiftPublishedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LaborScheduledShiftPublishedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftPublishedEventObject.ts b/src/serialization/types/LaborScheduledShiftPublishedEventObject.ts deleted file mode 100644 index a0b8bb48e..000000000 --- a/src/serialization/types/LaborScheduledShiftPublishedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; - -export const LaborScheduledShiftPublishedEventObject: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftPublishedEventObject.Raw, - Square.LaborScheduledShiftPublishedEventObject -> = core.serialization.object({ - scheduledShift: core.serialization.property("ScheduledShift", ScheduledShift.optional()), -}); - -export declare namespace LaborScheduledShiftPublishedEventObject { - export interface Raw { - ScheduledShift?: ScheduledShift.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftUpdatedEvent.ts b/src/serialization/types/LaborScheduledShiftUpdatedEvent.ts deleted file mode 100644 index 14dd7dd7b..000000000 --- a/src/serialization/types/LaborScheduledShiftUpdatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborScheduledShiftUpdatedEventData } from "./LaborScheduledShiftUpdatedEventData"; - -export const LaborScheduledShiftUpdatedEvent: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftUpdatedEvent.Raw, - Square.LaborScheduledShiftUpdatedEvent -> = 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: LaborScheduledShiftUpdatedEventData.optional(), -}); - -export declare namespace LaborScheduledShiftUpdatedEvent { - 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?: LaborScheduledShiftUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftUpdatedEventData.ts b/src/serialization/types/LaborScheduledShiftUpdatedEventData.ts deleted file mode 100644 index 52fe63804..000000000 --- a/src/serialization/types/LaborScheduledShiftUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborScheduledShiftUpdatedEventObject } from "./LaborScheduledShiftUpdatedEventObject"; - -export const LaborScheduledShiftUpdatedEventData: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftUpdatedEventData.Raw, - Square.LaborScheduledShiftUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LaborScheduledShiftUpdatedEventObject.optional(), -}); - -export declare namespace LaborScheduledShiftUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LaborScheduledShiftUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LaborScheduledShiftUpdatedEventObject.ts b/src/serialization/types/LaborScheduledShiftUpdatedEventObject.ts deleted file mode 100644 index 960cb5a79..000000000 --- a/src/serialization/types/LaborScheduledShiftUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; - -export const LaborScheduledShiftUpdatedEventObject: core.serialization.ObjectSchema< - serializers.LaborScheduledShiftUpdatedEventObject.Raw, - Square.LaborScheduledShiftUpdatedEventObject -> = core.serialization.object({ - scheduledShift: core.serialization.property("ScheduledShift", ScheduledShift.optional()), -}); - -export declare namespace LaborScheduledShiftUpdatedEventObject { - export interface Raw { - ScheduledShift?: ScheduledShift.Raw | null; - } -} diff --git a/src/serialization/types/LaborShiftCreatedEvent.ts b/src/serialization/types/LaborShiftCreatedEvent.ts deleted file mode 100644 index f35702b4c..000000000 --- a/src/serialization/types/LaborShiftCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborShiftCreatedEventData } from "./LaborShiftCreatedEventData"; - -export const LaborShiftCreatedEvent: core.serialization.ObjectSchema< - serializers.LaborShiftCreatedEvent.Raw, - Square.LaborShiftCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LaborShiftCreatedEventData.optional(), -}); - -export declare namespace LaborShiftCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LaborShiftCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborShiftCreatedEventData.ts b/src/serialization/types/LaborShiftCreatedEventData.ts deleted file mode 100644 index 73bddd4be..000000000 --- a/src/serialization/types/LaborShiftCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborShiftCreatedEventObject } from "./LaborShiftCreatedEventObject"; - -export const LaborShiftCreatedEventData: core.serialization.ObjectSchema< - serializers.LaborShiftCreatedEventData.Raw, - Square.LaborShiftCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LaborShiftCreatedEventObject.optional(), -}); - -export declare namespace LaborShiftCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LaborShiftCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LaborShiftCreatedEventObject.ts b/src/serialization/types/LaborShiftCreatedEventObject.ts deleted file mode 100644 index 09d3f2b67..000000000 --- a/src/serialization/types/LaborShiftCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const LaborShiftCreatedEventObject: core.serialization.ObjectSchema< - serializers.LaborShiftCreatedEventObject.Raw, - Square.LaborShiftCreatedEventObject -> = core.serialization.object({ - shift: Shift.optional(), -}); - -export declare namespace LaborShiftCreatedEventObject { - export interface Raw { - shift?: Shift.Raw | null; - } -} diff --git a/src/serialization/types/LaborShiftDeletedEvent.ts b/src/serialization/types/LaborShiftDeletedEvent.ts deleted file mode 100644 index 276289782..000000000 --- a/src/serialization/types/LaborShiftDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborShiftDeletedEventData } from "./LaborShiftDeletedEventData"; - -export const LaborShiftDeletedEvent: core.serialization.ObjectSchema< - serializers.LaborShiftDeletedEvent.Raw, - Square.LaborShiftDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LaborShiftDeletedEventData.optional(), -}); - -export declare namespace LaborShiftDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LaborShiftDeletedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborShiftDeletedEventData.ts b/src/serialization/types/LaborShiftDeletedEventData.ts deleted file mode 100644 index 480316663..000000000 --- a/src/serialization/types/LaborShiftDeletedEventData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const LaborShiftDeletedEventData: core.serialization.ObjectSchema< - serializers.LaborShiftDeletedEventData.Raw, - Square.LaborShiftDeletedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - deleted: core.serialization.boolean().optionalNullable(), -}); - -export declare namespace LaborShiftDeletedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - deleted?: (boolean | null) | null; - } -} diff --git a/src/serialization/types/LaborShiftUpdatedEvent.ts b/src/serialization/types/LaborShiftUpdatedEvent.ts deleted file mode 100644 index 71152c7b4..000000000 --- a/src/serialization/types/LaborShiftUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborShiftUpdatedEventData } from "./LaborShiftUpdatedEventData"; - -export const LaborShiftUpdatedEvent: core.serialization.ObjectSchema< - serializers.LaborShiftUpdatedEvent.Raw, - Square.LaborShiftUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LaborShiftUpdatedEventData.optional(), -}); - -export declare namespace LaborShiftUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LaborShiftUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborShiftUpdatedEventData.ts b/src/serialization/types/LaborShiftUpdatedEventData.ts deleted file mode 100644 index 79c1706bc..000000000 --- a/src/serialization/types/LaborShiftUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborShiftUpdatedEventObject } from "./LaborShiftUpdatedEventObject"; - -export const LaborShiftUpdatedEventData: core.serialization.ObjectSchema< - serializers.LaborShiftUpdatedEventData.Raw, - Square.LaborShiftUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LaborShiftUpdatedEventObject.optional(), -}); - -export declare namespace LaborShiftUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LaborShiftUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LaborShiftUpdatedEventObject.ts b/src/serialization/types/LaborShiftUpdatedEventObject.ts deleted file mode 100644 index 01d6cb26b..000000000 --- a/src/serialization/types/LaborShiftUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const LaborShiftUpdatedEventObject: core.serialization.ObjectSchema< - serializers.LaborShiftUpdatedEventObject.Raw, - Square.LaborShiftUpdatedEventObject -> = core.serialization.object({ - shift: Shift.optional(), -}); - -export declare namespace LaborShiftUpdatedEventObject { - export interface Raw { - shift?: Shift.Raw | null; - } -} diff --git a/src/serialization/types/LaborTimecardCreatedEvent.ts b/src/serialization/types/LaborTimecardCreatedEvent.ts deleted file mode 100644 index 94b4ebb29..000000000 --- a/src/serialization/types/LaborTimecardCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborTimecardCreatedEventData } from "./LaborTimecardCreatedEventData"; - -export const LaborTimecardCreatedEvent: core.serialization.ObjectSchema< - serializers.LaborTimecardCreatedEvent.Raw, - Square.LaborTimecardCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LaborTimecardCreatedEventData.optional(), -}); - -export declare namespace LaborTimecardCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LaborTimecardCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborTimecardCreatedEventData.ts b/src/serialization/types/LaborTimecardCreatedEventData.ts deleted file mode 100644 index c22dbf314..000000000 --- a/src/serialization/types/LaborTimecardCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborTimecardCreatedEventObject } from "./LaborTimecardCreatedEventObject"; - -export const LaborTimecardCreatedEventData: core.serialization.ObjectSchema< - serializers.LaborTimecardCreatedEventData.Raw, - Square.LaborTimecardCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LaborTimecardCreatedEventObject.optional(), -}); - -export declare namespace LaborTimecardCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LaborTimecardCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LaborTimecardCreatedEventObject.ts b/src/serialization/types/LaborTimecardCreatedEventObject.ts deleted file mode 100644 index a7fc48be9..000000000 --- a/src/serialization/types/LaborTimecardCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Timecard } from "./Timecard"; - -export const LaborTimecardCreatedEventObject: core.serialization.ObjectSchema< - serializers.LaborTimecardCreatedEventObject.Raw, - Square.LaborTimecardCreatedEventObject -> = core.serialization.object({ - timecard: Timecard.optional(), -}); - -export declare namespace LaborTimecardCreatedEventObject { - export interface Raw { - timecard?: Timecard.Raw | null; - } -} diff --git a/src/serialization/types/LaborTimecardDeletedEvent.ts b/src/serialization/types/LaborTimecardDeletedEvent.ts deleted file mode 100644 index a5e7786ec..000000000 --- a/src/serialization/types/LaborTimecardDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborTimecardDeletedEventData } from "./LaborTimecardDeletedEventData"; - -export const LaborTimecardDeletedEvent: core.serialization.ObjectSchema< - serializers.LaborTimecardDeletedEvent.Raw, - Square.LaborTimecardDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LaborTimecardDeletedEventData.optional(), -}); - -export declare namespace LaborTimecardDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LaborTimecardDeletedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborTimecardDeletedEventData.ts b/src/serialization/types/LaborTimecardDeletedEventData.ts deleted file mode 100644 index 33c1f3acf..000000000 --- a/src/serialization/types/LaborTimecardDeletedEventData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const LaborTimecardDeletedEventData: core.serialization.ObjectSchema< - serializers.LaborTimecardDeletedEventData.Raw, - Square.LaborTimecardDeletedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - deleted: core.serialization.boolean().optionalNullable(), -}); - -export declare namespace LaborTimecardDeletedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - deleted?: (boolean | null) | null; - } -} diff --git a/src/serialization/types/LaborTimecardUpdatedEvent.ts b/src/serialization/types/LaborTimecardUpdatedEvent.ts deleted file mode 100644 index ab2e5088d..000000000 --- a/src/serialization/types/LaborTimecardUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborTimecardUpdatedEventData } from "./LaborTimecardUpdatedEventData"; - -export const LaborTimecardUpdatedEvent: core.serialization.ObjectSchema< - serializers.LaborTimecardUpdatedEvent.Raw, - Square.LaborTimecardUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LaborTimecardUpdatedEventData.optional(), -}); - -export declare namespace LaborTimecardUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LaborTimecardUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LaborTimecardUpdatedEventData.ts b/src/serialization/types/LaborTimecardUpdatedEventData.ts deleted file mode 100644 index 321f0887b..000000000 --- a/src/serialization/types/LaborTimecardUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LaborTimecardUpdatedEventObject } from "./LaborTimecardUpdatedEventObject"; - -export const LaborTimecardUpdatedEventData: core.serialization.ObjectSchema< - serializers.LaborTimecardUpdatedEventData.Raw, - Square.LaborTimecardUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LaborTimecardUpdatedEventObject.optional(), -}); - -export declare namespace LaborTimecardUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LaborTimecardUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LaborTimecardUpdatedEventObject.ts b/src/serialization/types/LaborTimecardUpdatedEventObject.ts deleted file mode 100644 index 8477837ab..000000000 --- a/src/serialization/types/LaborTimecardUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Timecard } from "./Timecard"; - -export const LaborTimecardUpdatedEventObject: core.serialization.ObjectSchema< - serializers.LaborTimecardUpdatedEventObject.Raw, - Square.LaborTimecardUpdatedEventObject -> = core.serialization.object({ - timecard: Timecard.optional(), -}); - -export declare namespace LaborTimecardUpdatedEventObject { - export interface Raw { - timecard?: Timecard.Raw | null; - } -} diff --git a/src/serialization/types/LinkCustomerToGiftCardResponse.ts b/src/serialization/types/LinkCustomerToGiftCardResponse.ts deleted file mode 100644 index 8a6f64bbc..000000000 --- a/src/serialization/types/LinkCustomerToGiftCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9ae803f54..000000000 --- a/src/serialization/types/ListBankAccountsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0074fe8bd..000000000 --- a/src/serialization/types/ListBookingCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index dbfc99ae3..000000000 --- a/src/serialization/types/ListBookingCustomAttributesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4bc031920..000000000 --- a/src/serialization/types/ListBookingsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index eca335c53..000000000 --- a/src/serialization/types/ListBreakTypesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b4ff596e5..000000000 --- a/src/serialization/types/ListCardsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 45ac96bc9..000000000 --- a/src/serialization/types/ListCashDrawerShiftEventsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c36631fa0..000000000 --- a/src/serialization/types/ListCashDrawerShiftsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0a38150d8..000000000 --- a/src/serialization/types/ListCatalogResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d73872e4f..000000000 --- a/src/serialization/types/ListCustomerCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ef66ceeaf..000000000 --- a/src/serialization/types/ListCustomerCustomAttributesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c8e2b0a90..000000000 --- a/src/serialization/types/ListCustomerGroupsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e6f3c59b8..000000000 --- a/src/serialization/types/ListCustomerSegmentsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 697809709..000000000 --- a/src/serialization/types/ListCustomersResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 67bd8848f..000000000 --- a/src/serialization/types/ListDeviceCodesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cd6940182..000000000 --- a/src/serialization/types/ListDevicesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e9788cd53..000000000 --- a/src/serialization/types/ListDisputeEvidenceResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 84a1eaa91..000000000 --- a/src/serialization/types/ListDisputesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d6143cbdb..000000000 --- a/src/serialization/types/ListEmployeeWagesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 77807351e..000000000 --- a/src/serialization/types/ListEmployeesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 928ab03c9..000000000 --- a/src/serialization/types/ListEventTypesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4b120a9dc..000000000 --- a/src/serialization/types/ListGiftCardActivitiesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c3404662a..000000000 --- a/src/serialization/types/ListGiftCardsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7397ad716..000000000 --- a/src/serialization/types/ListInvoicesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 40768cd12..000000000 --- a/src/serialization/types/ListJobsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1bf45e1b1..000000000 --- a/src/serialization/types/ListLocationBookingProfilesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a5ed1021b..000000000 --- a/src/serialization/types/ListLocationCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0866efabd..000000000 --- a/src/serialization/types/ListLocationCustomAttributesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 877b12961..000000000 --- a/src/serialization/types/ListLocationsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 85b9e0855..000000000 --- a/src/serialization/types/ListLoyaltyProgramsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 90889f9a2..000000000 --- a/src/serialization/types/ListLoyaltyPromotionsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 97bcd71bd..000000000 --- a/src/serialization/types/ListMerchantCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bdc90edc2..000000000 --- a/src/serialization/types/ListMerchantCustomAttributesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5129540da..000000000 --- a/src/serialization/types/ListMerchantsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 25c06a63e..000000000 --- a/src/serialization/types/ListOrderCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e1a445ef3..000000000 --- a/src/serialization/types/ListOrderCustomAttributesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b5eaf0acf..000000000 --- a/src/serialization/types/ListPaymentLinksResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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/ListPaymentRefundsRequestSortField.ts b/src/serialization/types/ListPaymentRefundsRequestSortField.ts deleted file mode 100644 index 2f8f790b8..000000000 --- a/src/serialization/types/ListPaymentRefundsRequestSortField.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ListPaymentRefundsRequestSortField: core.serialization.Schema< - serializers.ListPaymentRefundsRequestSortField.Raw, - Square.ListPaymentRefundsRequestSortField -> = core.serialization.enum_(["CREATED_AT", "UPDATED_AT"]); - -export declare namespace ListPaymentRefundsRequestSortField { - export type Raw = "CREATED_AT" | "UPDATED_AT"; -} diff --git a/src/serialization/types/ListPaymentRefundsResponse.ts b/src/serialization/types/ListPaymentRefundsResponse.ts deleted file mode 100644 index 8ce9c8655..000000000 --- a/src/serialization/types/ListPaymentRefundsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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/ListPaymentsRequestSortField.ts b/src/serialization/types/ListPaymentsRequestSortField.ts deleted file mode 100644 index 07efc7589..000000000 --- a/src/serialization/types/ListPaymentsRequestSortField.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ListPaymentsRequestSortField: core.serialization.Schema< - serializers.ListPaymentsRequestSortField.Raw, - Square.ListPaymentsRequestSortField -> = core.serialization.enum_(["CREATED_AT", "OFFLINE_CREATED_AT", "UPDATED_AT"]); - -export declare namespace ListPaymentsRequestSortField { - export type Raw = "CREATED_AT" | "OFFLINE_CREATED_AT" | "UPDATED_AT"; -} diff --git a/src/serialization/types/ListPaymentsResponse.ts b/src/serialization/types/ListPaymentsResponse.ts deleted file mode 100644 index e7aaddf4a..000000000 --- a/src/serialization/types/ListPaymentsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 55da07c34..000000000 --- a/src/serialization/types/ListPayoutEntriesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 94bd7a835..000000000 --- a/src/serialization/types/ListPayoutsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 557dc290c..000000000 --- a/src/serialization/types/ListSitesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 55be5a067..000000000 --- a/src/serialization/types/ListSubscriptionEventsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8cf951929..000000000 --- a/src/serialization/types/ListTeamMemberBookingProfilesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3b5d52b44..000000000 --- a/src/serialization/types/ListTeamMemberWagesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 219aaedd3..000000000 --- a/src/serialization/types/ListTransactionsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a0d1c8bbb..000000000 --- a/src/serialization/types/ListWebhookEventTypesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 331d5e18a..000000000 --- a/src/serialization/types/ListWebhookSubscriptionsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ab9d168d1..000000000 --- a/src/serialization/types/ListWorkweekConfigsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 699cf9ea9..000000000 --- a/src/serialization/types/Location.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ebd5ccbfb..000000000 --- a/src/serialization/types/LocationBookingProfile.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3a3245814..000000000 --- a/src/serialization/types/LocationCapability.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/LocationCreatedEvent.ts b/src/serialization/types/LocationCreatedEvent.ts deleted file mode 100644 index 47b4bc155..000000000 --- a/src/serialization/types/LocationCreatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LocationCreatedEventData } from "./LocationCreatedEventData"; - -export const LocationCreatedEvent: core.serialization.ObjectSchema< - serializers.LocationCreatedEvent.Raw, - Square.LocationCreatedEvent -> = 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: LocationCreatedEventData.optional(), -}); - -export declare namespace LocationCreatedEvent { - 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?: LocationCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCreatedEventData.ts b/src/serialization/types/LocationCreatedEventData.ts deleted file mode 100644 index dac14e648..000000000 --- a/src/serialization/types/LocationCreatedEventData.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const LocationCreatedEventData: core.serialization.ObjectSchema< - serializers.LocationCreatedEventData.Raw, - Square.LocationCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), -}); - -export declare namespace LocationCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/serialization/types/LocationCustomAttributeDefinitionOwnedCreatedEvent.ts deleted file mode 100644 index 35d2056e3..000000000 --- a/src/serialization/types/LocationCustomAttributeDefinitionOwnedCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const LocationCustomAttributeDefinitionOwnedCreatedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeDefinitionOwnedCreatedEvent.Raw, - Square.LocationCustomAttributeDefinitionOwnedCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace LocationCustomAttributeDefinitionOwnedCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/serialization/types/LocationCustomAttributeDefinitionOwnedDeletedEvent.ts deleted file mode 100644 index 486528f87..000000000 --- a/src/serialization/types/LocationCustomAttributeDefinitionOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const LocationCustomAttributeDefinitionOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeDefinitionOwnedDeletedEvent.Raw, - Square.LocationCustomAttributeDefinitionOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace LocationCustomAttributeDefinitionOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/serialization/types/LocationCustomAttributeDefinitionOwnedUpdatedEvent.ts deleted file mode 100644 index f3099de04..000000000 --- a/src/serialization/types/LocationCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const LocationCustomAttributeDefinitionOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeDefinitionOwnedUpdatedEvent.Raw, - Square.LocationCustomAttributeDefinitionOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace LocationCustomAttributeDefinitionOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/serialization/types/LocationCustomAttributeDefinitionVisibleCreatedEvent.ts deleted file mode 100644 index c3ad8a091..000000000 --- a/src/serialization/types/LocationCustomAttributeDefinitionVisibleCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const LocationCustomAttributeDefinitionVisibleCreatedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeDefinitionVisibleCreatedEvent.Raw, - Square.LocationCustomAttributeDefinitionVisibleCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace LocationCustomAttributeDefinitionVisibleCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/serialization/types/LocationCustomAttributeDefinitionVisibleDeletedEvent.ts deleted file mode 100644 index c8165b10a..000000000 --- a/src/serialization/types/LocationCustomAttributeDefinitionVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const LocationCustomAttributeDefinitionVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeDefinitionVisibleDeletedEvent.Raw, - Square.LocationCustomAttributeDefinitionVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace LocationCustomAttributeDefinitionVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/serialization/types/LocationCustomAttributeDefinitionVisibleUpdatedEvent.ts deleted file mode 100644 index fd6a95049..000000000 --- a/src/serialization/types/LocationCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const LocationCustomAttributeDefinitionVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeDefinitionVisibleUpdatedEvent.Raw, - Square.LocationCustomAttributeDefinitionVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace LocationCustomAttributeDefinitionVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeOwnedDeletedEvent.ts b/src/serialization/types/LocationCustomAttributeOwnedDeletedEvent.ts deleted file mode 100644 index 450f6e1f5..000000000 --- a/src/serialization/types/LocationCustomAttributeOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const LocationCustomAttributeOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeOwnedDeletedEvent.Raw, - Square.LocationCustomAttributeOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace LocationCustomAttributeOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeOwnedUpdatedEvent.ts b/src/serialization/types/LocationCustomAttributeOwnedUpdatedEvent.ts deleted file mode 100644 index 4b676842a..000000000 --- a/src/serialization/types/LocationCustomAttributeOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const LocationCustomAttributeOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeOwnedUpdatedEvent.Raw, - Square.LocationCustomAttributeOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace LocationCustomAttributeOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeVisibleDeletedEvent.ts b/src/serialization/types/LocationCustomAttributeVisibleDeletedEvent.ts deleted file mode 100644 index 6a9e35548..000000000 --- a/src/serialization/types/LocationCustomAttributeVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const LocationCustomAttributeVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeVisibleDeletedEvent.Raw, - Square.LocationCustomAttributeVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace LocationCustomAttributeVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationCustomAttributeVisibleUpdatedEvent.ts b/src/serialization/types/LocationCustomAttributeVisibleUpdatedEvent.ts deleted file mode 100644 index 4461a8c67..000000000 --- a/src/serialization/types/LocationCustomAttributeVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const LocationCustomAttributeVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.LocationCustomAttributeVisibleUpdatedEvent.Raw, - Square.LocationCustomAttributeVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace LocationCustomAttributeVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationSettingsUpdatedEvent.ts b/src/serialization/types/LocationSettingsUpdatedEvent.ts deleted file mode 100644 index 52960a31e..000000000 --- a/src/serialization/types/LocationSettingsUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LocationSettingsUpdatedEventData } from "./LocationSettingsUpdatedEventData"; - -export const LocationSettingsUpdatedEvent: core.serialization.ObjectSchema< - serializers.LocationSettingsUpdatedEvent.Raw, - Square.LocationSettingsUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LocationSettingsUpdatedEventData.optional(), -}); - -export declare namespace LocationSettingsUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LocationSettingsUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationSettingsUpdatedEventData.ts b/src/serialization/types/LocationSettingsUpdatedEventData.ts deleted file mode 100644 index 117f66d49..000000000 --- a/src/serialization/types/LocationSettingsUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LocationSettingsUpdatedEventObject } from "./LocationSettingsUpdatedEventObject"; - -export const LocationSettingsUpdatedEventData: core.serialization.ObjectSchema< - serializers.LocationSettingsUpdatedEventData.Raw, - Square.LocationSettingsUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LocationSettingsUpdatedEventObject.optional(), -}); - -export declare namespace LocationSettingsUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LocationSettingsUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LocationSettingsUpdatedEventObject.ts b/src/serialization/types/LocationSettingsUpdatedEventObject.ts deleted file mode 100644 index be61b400c..000000000 --- a/src/serialization/types/LocationSettingsUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./CheckoutLocationSettings"; - -export const LocationSettingsUpdatedEventObject: core.serialization.ObjectSchema< - serializers.LocationSettingsUpdatedEventObject.Raw, - Square.LocationSettingsUpdatedEventObject -> = core.serialization.object({ - locationSettings: core.serialization.property("location_settings", CheckoutLocationSettings.optional()), -}); - -export declare namespace LocationSettingsUpdatedEventObject { - export interface Raw { - location_settings?: CheckoutLocationSettings.Raw | null; - } -} diff --git a/src/serialization/types/LocationStatus.ts b/src/serialization/types/LocationStatus.ts deleted file mode 100644 index 7a3722527..000000000 --- a/src/serialization/types/LocationStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d2003c9d2..000000000 --- a/src/serialization/types/LocationType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/LocationUpdatedEvent.ts b/src/serialization/types/LocationUpdatedEvent.ts deleted file mode 100644 index 7604abbb9..000000000 --- a/src/serialization/types/LocationUpdatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LocationUpdatedEventData } from "./LocationUpdatedEventData"; - -export const LocationUpdatedEvent: core.serialization.ObjectSchema< - serializers.LocationUpdatedEvent.Raw, - Square.LocationUpdatedEvent -> = 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: LocationUpdatedEventData.optional(), -}); - -export declare namespace LocationUpdatedEvent { - 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?: LocationUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LocationUpdatedEventData.ts b/src/serialization/types/LocationUpdatedEventData.ts deleted file mode 100644 index c46891648..000000000 --- a/src/serialization/types/LocationUpdatedEventData.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const LocationUpdatedEventData: core.serialization.ObjectSchema< - serializers.LocationUpdatedEventData.Raw, - Square.LocationUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), -}); - -export declare namespace LocationUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - } -} diff --git a/src/serialization/types/LoyaltyAccount.ts b/src/serialization/types/LoyaltyAccount.ts deleted file mode 100644 index 78a50fcf0..000000000 --- a/src/serialization/types/LoyaltyAccount.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file was auto-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/LoyaltyAccountCreatedEvent.ts b/src/serialization/types/LoyaltyAccountCreatedEvent.ts deleted file mode 100644 index a2493dc53..000000000 --- a/src/serialization/types/LoyaltyAccountCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyAccountCreatedEventData } from "./LoyaltyAccountCreatedEventData"; - -export const LoyaltyAccountCreatedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyAccountCreatedEvent.Raw, - Square.LoyaltyAccountCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyAccountCreatedEventData.optional(), -}); - -export declare namespace LoyaltyAccountCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyAccountCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountCreatedEventData.ts b/src/serialization/types/LoyaltyAccountCreatedEventData.ts deleted file mode 100644 index 2845ba72c..000000000 --- a/src/serialization/types/LoyaltyAccountCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyAccountCreatedEventObject } from "./LoyaltyAccountCreatedEventObject"; - -export const LoyaltyAccountCreatedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyAccountCreatedEventData.Raw, - Square.LoyaltyAccountCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyAccountCreatedEventObject.optional(), -}); - -export declare namespace LoyaltyAccountCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyAccountCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountCreatedEventObject.ts b/src/serialization/types/LoyaltyAccountCreatedEventObject.ts deleted file mode 100644 index ceb16bfca..000000000 --- a/src/serialization/types/LoyaltyAccountCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./LoyaltyAccount"; - -export const LoyaltyAccountCreatedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyAccountCreatedEventObject.Raw, - Square.LoyaltyAccountCreatedEventObject -> = core.serialization.object({ - loyaltyAccount: core.serialization.property("loyalty_account", LoyaltyAccount.optional()), -}); - -export declare namespace LoyaltyAccountCreatedEventObject { - export interface Raw { - loyalty_account?: LoyaltyAccount.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountDeletedEvent.ts b/src/serialization/types/LoyaltyAccountDeletedEvent.ts deleted file mode 100644 index 877fa1328..000000000 --- a/src/serialization/types/LoyaltyAccountDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyAccountDeletedEventData } from "./LoyaltyAccountDeletedEventData"; - -export const LoyaltyAccountDeletedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyAccountDeletedEvent.Raw, - Square.LoyaltyAccountDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyAccountDeletedEventData.optional(), -}); - -export declare namespace LoyaltyAccountDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyAccountDeletedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountDeletedEventData.ts b/src/serialization/types/LoyaltyAccountDeletedEventData.ts deleted file mode 100644 index 3cfa1878d..000000000 --- a/src/serialization/types/LoyaltyAccountDeletedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyAccountDeletedEventObject } from "./LoyaltyAccountDeletedEventObject"; - -export const LoyaltyAccountDeletedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyAccountDeletedEventData.Raw, - Square.LoyaltyAccountDeletedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyAccountDeletedEventObject.optional(), -}); - -export declare namespace LoyaltyAccountDeletedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyAccountDeletedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountDeletedEventObject.ts b/src/serialization/types/LoyaltyAccountDeletedEventObject.ts deleted file mode 100644 index ad10cb8a4..000000000 --- a/src/serialization/types/LoyaltyAccountDeletedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./LoyaltyAccount"; - -export const LoyaltyAccountDeletedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyAccountDeletedEventObject.Raw, - Square.LoyaltyAccountDeletedEventObject -> = core.serialization.object({ - loyaltyAccount: core.serialization.property("loyalty_account", LoyaltyAccount.optional()), -}); - -export declare namespace LoyaltyAccountDeletedEventObject { - export interface Raw { - loyalty_account?: LoyaltyAccount.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountExpiringPointDeadline.ts b/src/serialization/types/LoyaltyAccountExpiringPointDeadline.ts deleted file mode 100644 index 8da4115ca..000000000 --- a/src/serialization/types/LoyaltyAccountExpiringPointDeadline.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 6c3ac7656..000000000 --- a/src/serialization/types/LoyaltyAccountMapping.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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/LoyaltyAccountMappingType.ts b/src/serialization/types/LoyaltyAccountMappingType.ts deleted file mode 100644 index c7d2af17e..000000000 --- a/src/serialization/types/LoyaltyAccountMappingType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const LoyaltyAccountMappingType: core.serialization.Schema< - serializers.LoyaltyAccountMappingType.Raw, - Square.LoyaltyAccountMappingType -> = core.serialization.stringLiteral("PHONE"); - -export declare namespace LoyaltyAccountMappingType { - export type Raw = "PHONE"; -} diff --git a/src/serialization/types/LoyaltyAccountUpdatedEvent.ts b/src/serialization/types/LoyaltyAccountUpdatedEvent.ts deleted file mode 100644 index ffe6e38af..000000000 --- a/src/serialization/types/LoyaltyAccountUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyAccountUpdatedEventData } from "./LoyaltyAccountUpdatedEventData"; - -export const LoyaltyAccountUpdatedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyAccountUpdatedEvent.Raw, - Square.LoyaltyAccountUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyAccountUpdatedEventData.optional(), -}); - -export declare namespace LoyaltyAccountUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyAccountUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountUpdatedEventData.ts b/src/serialization/types/LoyaltyAccountUpdatedEventData.ts deleted file mode 100644 index f3171bd9c..000000000 --- a/src/serialization/types/LoyaltyAccountUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyAccountUpdatedEventObject } from "./LoyaltyAccountUpdatedEventObject"; - -export const LoyaltyAccountUpdatedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyAccountUpdatedEventData.Raw, - Square.LoyaltyAccountUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyAccountUpdatedEventObject.optional(), -}); - -export declare namespace LoyaltyAccountUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyAccountUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyAccountUpdatedEventObject.ts b/src/serialization/types/LoyaltyAccountUpdatedEventObject.ts deleted file mode 100644 index 9ab327ced..000000000 --- a/src/serialization/types/LoyaltyAccountUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./LoyaltyAccount"; - -export const LoyaltyAccountUpdatedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyAccountUpdatedEventObject.Raw, - Square.LoyaltyAccountUpdatedEventObject -> = core.serialization.object({ - loyaltyAccount: core.serialization.property("loyalty_account", LoyaltyAccount.optional()), -}); - -export declare namespace LoyaltyAccountUpdatedEventObject { - export interface Raw { - loyalty_account?: LoyaltyAccount.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyEvent.ts b/src/serialization/types/LoyaltyEvent.ts deleted file mode 100644 index 4503c375b..000000000 --- a/src/serialization/types/LoyaltyEvent.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file was auto-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().optional(), - type: LoyaltyEventType, - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - 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().optional()), - 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 | null; - type: LoyaltyEventType.Raw; - created_at?: string | null; - 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 | null; - 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 deleted file mode 100644 index d04eda5e4..000000000 --- a/src/serialization/types/LoyaltyEventAccumulatePoints.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bae7b7806..000000000 --- a/src/serialization/types/LoyaltyEventAccumulatePromotionPoints.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated 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().optional(), - orderId: core.serialization.property("order_id", core.serialization.string().optional()), -}); - -export declare namespace LoyaltyEventAccumulatePromotionPoints { - export interface Raw { - loyalty_program_id?: string | null; - loyalty_promotion_id?: string | null; - points?: number | null; - order_id?: string | null; - } -} diff --git a/src/serialization/types/LoyaltyEventAdjustPoints.ts b/src/serialization/types/LoyaltyEventAdjustPoints.ts deleted file mode 100644 index f1be0699c..000000000 --- a/src/serialization/types/LoyaltyEventAdjustPoints.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c677f1508..000000000 --- a/src/serialization/types/LoyaltyEventCreateReward.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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().optional()), - rewardId: core.serialization.property("reward_id", core.serialization.string().optional()), - points: core.serialization.number().optional(), -}); - -export declare namespace LoyaltyEventCreateReward { - export interface Raw { - loyalty_program_id?: string | null; - reward_id?: string | null; - points?: number | null; - } -} diff --git a/src/serialization/types/LoyaltyEventCreatedEvent.ts b/src/serialization/types/LoyaltyEventCreatedEvent.ts deleted file mode 100644 index 21655eb60..000000000 --- a/src/serialization/types/LoyaltyEventCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyEventCreatedEventData } from "./LoyaltyEventCreatedEventData"; - -export const LoyaltyEventCreatedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyEventCreatedEvent.Raw, - Square.LoyaltyEventCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyEventCreatedEventData.optional(), -}); - -export declare namespace LoyaltyEventCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyEventCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyEventCreatedEventData.ts b/src/serialization/types/LoyaltyEventCreatedEventData.ts deleted file mode 100644 index 65f9620c7..000000000 --- a/src/serialization/types/LoyaltyEventCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyEventCreatedEventObject } from "./LoyaltyEventCreatedEventObject"; - -export const LoyaltyEventCreatedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyEventCreatedEventData.Raw, - Square.LoyaltyEventCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyEventCreatedEventObject.optional(), -}); - -export declare namespace LoyaltyEventCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyEventCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyEventCreatedEventObject.ts b/src/serialization/types/LoyaltyEventCreatedEventObject.ts deleted file mode 100644 index 994636b16..000000000 --- a/src/serialization/types/LoyaltyEventCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyEvent } from "./LoyaltyEvent"; - -export const LoyaltyEventCreatedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyEventCreatedEventObject.Raw, - Square.LoyaltyEventCreatedEventObject -> = core.serialization.object({ - loyaltyEvent: core.serialization.property("loyalty_event", LoyaltyEvent.optional()), -}); - -export declare namespace LoyaltyEventCreatedEventObject { - export interface Raw { - loyalty_event?: LoyaltyEvent.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyEventDateTimeFilter.ts b/src/serialization/types/LoyaltyEventDateTimeFilter.ts deleted file mode 100644 index c8675f7a3..000000000 --- a/src/serialization/types/LoyaltyEventDateTimeFilter.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b0e883563..000000000 --- a/src/serialization/types/LoyaltyEventDeleteReward.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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().optional()), - rewardId: core.serialization.property("reward_id", core.serialization.string().optional()), - points: core.serialization.number().optional(), -}); - -export declare namespace LoyaltyEventDeleteReward { - export interface Raw { - loyalty_program_id?: string | null; - reward_id?: string | null; - points?: number | null; - } -} diff --git a/src/serialization/types/LoyaltyEventExpirePoints.ts b/src/serialization/types/LoyaltyEventExpirePoints.ts deleted file mode 100644 index f8ab6e654..000000000 --- a/src/serialization/types/LoyaltyEventExpirePoints.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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().optional()), - points: core.serialization.number(), -}); - -export declare namespace LoyaltyEventExpirePoints { - export interface Raw { - loyalty_program_id?: string | null; - points: number; - } -} diff --git a/src/serialization/types/LoyaltyEventFilter.ts b/src/serialization/types/LoyaltyEventFilter.ts deleted file mode 100644 index 145b2ddc6..000000000 --- a/src/serialization/types/LoyaltyEventFilter.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 06ae6117b..000000000 --- a/src/serialization/types/LoyaltyEventLocationFilter.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ea4be1b22..000000000 --- a/src/serialization/types/LoyaltyEventLoyaltyAccountFilter.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 60aceb6ee..000000000 --- a/src/serialization/types/LoyaltyEventOrderFilter.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4cbbdd044..000000000 --- a/src/serialization/types/LoyaltyEventOther.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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().optional()), - points: core.serialization.number(), -}); - -export declare namespace LoyaltyEventOther { - export interface Raw { - loyalty_program_id?: string | null; - points: number; - } -} diff --git a/src/serialization/types/LoyaltyEventQuery.ts b/src/serialization/types/LoyaltyEventQuery.ts deleted file mode 100644 index f85d5e9c4..000000000 --- a/src/serialization/types/LoyaltyEventQuery.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3f2bdfa6b..000000000 --- a/src/serialization/types/LoyaltyEventRedeemReward.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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().optional()), - 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 | null; - reward_id?: string | null; - order_id?: string | null; - } -} diff --git a/src/serialization/types/LoyaltyEventSource.ts b/src/serialization/types/LoyaltyEventSource.ts deleted file mode 100644 index db9ffcaed..000000000 --- a/src/serialization/types/LoyaltyEventSource.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7dca763aa..000000000 --- a/src/serialization/types/LoyaltyEventType.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 405b69228..000000000 --- a/src/serialization/types/LoyaltyEventTypeFilter.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d020c5377..000000000 --- a/src/serialization/types/LoyaltyProgram.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d24f34354..000000000 --- a/src/serialization/types/LoyaltyProgramAccrualRule.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f528cfad6..000000000 --- a/src/serialization/types/LoyaltyProgramAccrualRuleCategoryData.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index afd62c584..000000000 --- a/src/serialization/types/LoyaltyProgramAccrualRuleItemVariationData.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 392662f9c..000000000 --- a/src/serialization/types/LoyaltyProgramAccrualRuleSpendData.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cda917057..000000000 --- a/src/serialization/types/LoyaltyProgramAccrualRuleTaxMode.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 76c2c16a0..000000000 --- a/src/serialization/types/LoyaltyProgramAccrualRuleType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 55869b831..000000000 --- a/src/serialization/types/LoyaltyProgramAccrualRuleVisitData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/LoyaltyProgramCreatedEvent.ts b/src/serialization/types/LoyaltyProgramCreatedEvent.ts deleted file mode 100644 index c32e88ec8..000000000 --- a/src/serialization/types/LoyaltyProgramCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyProgramCreatedEventData } from "./LoyaltyProgramCreatedEventData"; - -export const LoyaltyProgramCreatedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyProgramCreatedEvent.Raw, - Square.LoyaltyProgramCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyProgramCreatedEventData.optional(), -}); - -export declare namespace LoyaltyProgramCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyProgramCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyProgramCreatedEventData.ts b/src/serialization/types/LoyaltyProgramCreatedEventData.ts deleted file mode 100644 index e124e6a97..000000000 --- a/src/serialization/types/LoyaltyProgramCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyProgramCreatedEventObject } from "./LoyaltyProgramCreatedEventObject"; - -export const LoyaltyProgramCreatedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyProgramCreatedEventData.Raw, - Square.LoyaltyProgramCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyProgramCreatedEventObject.optional(), -}); - -export declare namespace LoyaltyProgramCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyProgramCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyProgramCreatedEventObject.ts b/src/serialization/types/LoyaltyProgramCreatedEventObject.ts deleted file mode 100644 index a8e3a404b..000000000 --- a/src/serialization/types/LoyaltyProgramCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyProgram } from "./LoyaltyProgram"; - -export const LoyaltyProgramCreatedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyProgramCreatedEventObject.Raw, - Square.LoyaltyProgramCreatedEventObject -> = core.serialization.object({ - loyaltyProgram: core.serialization.property("loyalty_program", LoyaltyProgram.optional()), -}); - -export declare namespace LoyaltyProgramCreatedEventObject { - export interface Raw { - loyalty_program?: LoyaltyProgram.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyProgramExpirationPolicy.ts b/src/serialization/types/LoyaltyProgramExpirationPolicy.ts deleted file mode 100644 index 46559ff5e..000000000 --- a/src/serialization/types/LoyaltyProgramExpirationPolicy.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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/LoyaltyProgramRewardTier.ts b/src/serialization/types/LoyaltyProgramRewardTier.ts deleted file mode 100644 index e728ad13c..000000000 --- a/src/serialization/types/LoyaltyProgramRewardTier.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -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(), - 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; - created_at?: string | null; - pricing_rule_reference: CatalogObjectReference.Raw; - } -} diff --git a/src/serialization/types/LoyaltyProgramStatus.ts b/src/serialization/types/LoyaltyProgramStatus.ts deleted file mode 100644 index 437b0cc79..000000000 --- a/src/serialization/types/LoyaltyProgramStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5f9aa7b54..000000000 --- a/src/serialization/types/LoyaltyProgramTerminology.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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/LoyaltyProgramUpdatedEvent.ts b/src/serialization/types/LoyaltyProgramUpdatedEvent.ts deleted file mode 100644 index 3d80c96fb..000000000 --- a/src/serialization/types/LoyaltyProgramUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyProgramUpdatedEventData } from "./LoyaltyProgramUpdatedEventData"; - -export const LoyaltyProgramUpdatedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyProgramUpdatedEvent.Raw, - Square.LoyaltyProgramUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyProgramUpdatedEventData.optional(), -}); - -export declare namespace LoyaltyProgramUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyProgramUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyProgramUpdatedEventData.ts b/src/serialization/types/LoyaltyProgramUpdatedEventData.ts deleted file mode 100644 index 9f6562630..000000000 --- a/src/serialization/types/LoyaltyProgramUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyProgramUpdatedEventObject } from "./LoyaltyProgramUpdatedEventObject"; - -export const LoyaltyProgramUpdatedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyProgramUpdatedEventData.Raw, - Square.LoyaltyProgramUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyProgramUpdatedEventObject.optional(), -}); - -export declare namespace LoyaltyProgramUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyProgramUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyProgramUpdatedEventObject.ts b/src/serialization/types/LoyaltyProgramUpdatedEventObject.ts deleted file mode 100644 index d5069372e..000000000 --- a/src/serialization/types/LoyaltyProgramUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyProgram } from "./LoyaltyProgram"; - -export const LoyaltyProgramUpdatedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyProgramUpdatedEventObject.Raw, - Square.LoyaltyProgramUpdatedEventObject -> = core.serialization.object({ - loyaltyProgram: core.serialization.property("loyalty_program", LoyaltyProgram.optional()), -}); - -export declare namespace LoyaltyProgramUpdatedEventObject { - export interface Raw { - loyalty_program?: LoyaltyProgram.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyPromotion.ts b/src/serialization/types/LoyaltyPromotion.ts deleted file mode 100644 index aaf228eb2..000000000 --- a/src/serialization/types/LoyaltyPromotion.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index f7b34ac92..000000000 --- a/src/serialization/types/LoyaltyPromotionAvailableTimeData.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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/LoyaltyPromotionCreatedEvent.ts b/src/serialization/types/LoyaltyPromotionCreatedEvent.ts deleted file mode 100644 index f7068ab9d..000000000 --- a/src/serialization/types/LoyaltyPromotionCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyPromotionCreatedEventData } from "./LoyaltyPromotionCreatedEventData"; - -export const LoyaltyPromotionCreatedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyPromotionCreatedEvent.Raw, - Square.LoyaltyPromotionCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyPromotionCreatedEventData.optional(), -}); - -export declare namespace LoyaltyPromotionCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyPromotionCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyPromotionCreatedEventData.ts b/src/serialization/types/LoyaltyPromotionCreatedEventData.ts deleted file mode 100644 index 456b03b56..000000000 --- a/src/serialization/types/LoyaltyPromotionCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyPromotionCreatedEventObject } from "./LoyaltyPromotionCreatedEventObject"; - -export const LoyaltyPromotionCreatedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyPromotionCreatedEventData.Raw, - Square.LoyaltyPromotionCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyPromotionCreatedEventObject.optional(), -}); - -export declare namespace LoyaltyPromotionCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyPromotionCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyPromotionCreatedEventObject.ts b/src/serialization/types/LoyaltyPromotionCreatedEventObject.ts deleted file mode 100644 index a4023966d..000000000 --- a/src/serialization/types/LoyaltyPromotionCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./LoyaltyPromotion"; - -export const LoyaltyPromotionCreatedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyPromotionCreatedEventObject.Raw, - Square.LoyaltyPromotionCreatedEventObject -> = core.serialization.object({ - loyaltyPromotion: core.serialization.property("loyalty_promotion", LoyaltyPromotion.optional()), -}); - -export declare namespace LoyaltyPromotionCreatedEventObject { - export interface Raw { - loyalty_promotion?: LoyaltyPromotion.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyPromotionIncentive.ts b/src/serialization/types/LoyaltyPromotionIncentive.ts deleted file mode 100644 index 0301b9d63..000000000 --- a/src/serialization/types/LoyaltyPromotionIncentive.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8b0ed9225..000000000 --- a/src/serialization/types/LoyaltyPromotionIncentivePointsAdditionData.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 97309104c..000000000 --- a/src/serialization/types/LoyaltyPromotionIncentivePointsMultiplierData.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 11ce60a53..000000000 --- a/src/serialization/types/LoyaltyPromotionIncentiveType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 248bc733e..000000000 --- a/src/serialization/types/LoyaltyPromotionStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 98aef06d2..000000000 --- a/src/serialization/types/LoyaltyPromotionTriggerLimit.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ee4f88df7..000000000 --- a/src/serialization/types/LoyaltyPromotionTriggerLimitInterval.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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/LoyaltyPromotionUpdatedEvent.ts b/src/serialization/types/LoyaltyPromotionUpdatedEvent.ts deleted file mode 100644 index 7c961c4e4..000000000 --- a/src/serialization/types/LoyaltyPromotionUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyPromotionUpdatedEventData } from "./LoyaltyPromotionUpdatedEventData"; - -export const LoyaltyPromotionUpdatedEvent: core.serialization.ObjectSchema< - serializers.LoyaltyPromotionUpdatedEvent.Raw, - Square.LoyaltyPromotionUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: LoyaltyPromotionUpdatedEventData.optional(), -}); - -export declare namespace LoyaltyPromotionUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: LoyaltyPromotionUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyPromotionUpdatedEventData.ts b/src/serialization/types/LoyaltyPromotionUpdatedEventData.ts deleted file mode 100644 index f19cbac42..000000000 --- a/src/serialization/types/LoyaltyPromotionUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { LoyaltyPromotionUpdatedEventObject } from "./LoyaltyPromotionUpdatedEventObject"; - -export const LoyaltyPromotionUpdatedEventData: core.serialization.ObjectSchema< - serializers.LoyaltyPromotionUpdatedEventData.Raw, - Square.LoyaltyPromotionUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: LoyaltyPromotionUpdatedEventObject.optional(), -}); - -export declare namespace LoyaltyPromotionUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: LoyaltyPromotionUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyPromotionUpdatedEventObject.ts b/src/serialization/types/LoyaltyPromotionUpdatedEventObject.ts deleted file mode 100644 index 57c1a6849..000000000 --- a/src/serialization/types/LoyaltyPromotionUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./LoyaltyPromotion"; - -export const LoyaltyPromotionUpdatedEventObject: core.serialization.ObjectSchema< - serializers.LoyaltyPromotionUpdatedEventObject.Raw, - Square.LoyaltyPromotionUpdatedEventObject -> = core.serialization.object({ - loyaltyPromotion: core.serialization.property("loyalty_promotion", LoyaltyPromotion.optional()), -}); - -export declare namespace LoyaltyPromotionUpdatedEventObject { - export interface Raw { - loyalty_promotion?: LoyaltyPromotion.Raw | null; - } -} diff --git a/src/serialization/types/LoyaltyReward.ts b/src/serialization/types/LoyaltyReward.ts deleted file mode 100644 index 5eaeb90bc..000000000 --- a/src/serialization/types/LoyaltyReward.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 73204b87a..000000000 --- a/src/serialization/types/LoyaltyRewardStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b567cfbe7..000000000 --- a/src/serialization/types/MeasurementUnit.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b6e8bb363..000000000 --- a/src/serialization/types/MeasurementUnitArea.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c1a9688ac..000000000 --- a/src/serialization/types/MeasurementUnitCustom.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c2a5a8fa6..000000000 --- a/src/serialization/types/MeasurementUnitGeneric.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f2bbedab8..000000000 --- a/src/serialization/types/MeasurementUnitLength.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 2470332b0..000000000 --- a/src/serialization/types/MeasurementUnitTime.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b1466384a..000000000 --- a/src/serialization/types/MeasurementUnitUnitType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0d8db1ee4..000000000 --- a/src/serialization/types/MeasurementUnitVolume.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 14a458dd5..000000000 --- a/src/serialization/types/MeasurementUnitWeight.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 72cc5e821..000000000 --- a/src/serialization/types/Merchant.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-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/MerchantCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/serialization/types/MerchantCustomAttributeDefinitionOwnedCreatedEvent.ts deleted file mode 100644 index 0070343a3..000000000 --- a/src/serialization/types/MerchantCustomAttributeDefinitionOwnedCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const MerchantCustomAttributeDefinitionOwnedCreatedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeDefinitionOwnedCreatedEvent.Raw, - Square.MerchantCustomAttributeDefinitionOwnedCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeDefinitionOwnedCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/serialization/types/MerchantCustomAttributeDefinitionOwnedDeletedEvent.ts deleted file mode 100644 index 3f5c37bb4..000000000 --- a/src/serialization/types/MerchantCustomAttributeDefinitionOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const MerchantCustomAttributeDefinitionOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeDefinitionOwnedDeletedEvent.Raw, - Square.MerchantCustomAttributeDefinitionOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeDefinitionOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/serialization/types/MerchantCustomAttributeDefinitionOwnedUpdatedEvent.ts deleted file mode 100644 index 4c0689bbd..000000000 --- a/src/serialization/types/MerchantCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const MerchantCustomAttributeDefinitionOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeDefinitionOwnedUpdatedEvent.Raw, - Square.MerchantCustomAttributeDefinitionOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeDefinitionOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/serialization/types/MerchantCustomAttributeDefinitionVisibleCreatedEvent.ts deleted file mode 100644 index 92780fedf..000000000 --- a/src/serialization/types/MerchantCustomAttributeDefinitionVisibleCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const MerchantCustomAttributeDefinitionVisibleCreatedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeDefinitionVisibleCreatedEvent.Raw, - Square.MerchantCustomAttributeDefinitionVisibleCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeDefinitionVisibleCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/serialization/types/MerchantCustomAttributeDefinitionVisibleDeletedEvent.ts deleted file mode 100644 index 55e90c8ef..000000000 --- a/src/serialization/types/MerchantCustomAttributeDefinitionVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const MerchantCustomAttributeDefinitionVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeDefinitionVisibleDeletedEvent.Raw, - Square.MerchantCustomAttributeDefinitionVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeDefinitionVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/serialization/types/MerchantCustomAttributeDefinitionVisibleUpdatedEvent.ts deleted file mode 100644 index d46c41f1f..000000000 --- a/src/serialization/types/MerchantCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const MerchantCustomAttributeDefinitionVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeDefinitionVisibleUpdatedEvent.Raw, - Square.MerchantCustomAttributeDefinitionVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeDefinitionVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeOwnedDeletedEvent.ts b/src/serialization/types/MerchantCustomAttributeOwnedDeletedEvent.ts deleted file mode 100644 index 2f6b6d01a..000000000 --- a/src/serialization/types/MerchantCustomAttributeOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const MerchantCustomAttributeOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeOwnedDeletedEvent.Raw, - Square.MerchantCustomAttributeOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeOwnedUpdatedEvent.ts b/src/serialization/types/MerchantCustomAttributeOwnedUpdatedEvent.ts deleted file mode 100644 index 45b503737..000000000 --- a/src/serialization/types/MerchantCustomAttributeOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const MerchantCustomAttributeOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeOwnedUpdatedEvent.Raw, - Square.MerchantCustomAttributeOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeVisibleDeletedEvent.ts b/src/serialization/types/MerchantCustomAttributeVisibleDeletedEvent.ts deleted file mode 100644 index 7b401cf29..000000000 --- a/src/serialization/types/MerchantCustomAttributeVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const MerchantCustomAttributeVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeVisibleDeletedEvent.Raw, - Square.MerchantCustomAttributeVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantCustomAttributeVisibleUpdatedEvent.ts b/src/serialization/types/MerchantCustomAttributeVisibleUpdatedEvent.ts deleted file mode 100644 index bf7ba98a2..000000000 --- a/src/serialization/types/MerchantCustomAttributeVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const MerchantCustomAttributeVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.MerchantCustomAttributeVisibleUpdatedEvent.Raw, - Square.MerchantCustomAttributeVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace MerchantCustomAttributeVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantSettingsUpdatedEvent.ts b/src/serialization/types/MerchantSettingsUpdatedEvent.ts deleted file mode 100644 index ebb38a51a..000000000 --- a/src/serialization/types/MerchantSettingsUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { MerchantSettingsUpdatedEventData } from "./MerchantSettingsUpdatedEventData"; - -export const MerchantSettingsUpdatedEvent: core.serialization.ObjectSchema< - serializers.MerchantSettingsUpdatedEvent.Raw, - Square.MerchantSettingsUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: MerchantSettingsUpdatedEventData.optional(), -}); - -export declare namespace MerchantSettingsUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: MerchantSettingsUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/MerchantSettingsUpdatedEventData.ts b/src/serialization/types/MerchantSettingsUpdatedEventData.ts deleted file mode 100644 index 5b6d16dfb..000000000 --- a/src/serialization/types/MerchantSettingsUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { MerchantSettingsUpdatedEventObject } from "./MerchantSettingsUpdatedEventObject"; - -export const MerchantSettingsUpdatedEventData: core.serialization.ObjectSchema< - serializers.MerchantSettingsUpdatedEventData.Raw, - Square.MerchantSettingsUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: MerchantSettingsUpdatedEventObject.optional(), -}); - -export declare namespace MerchantSettingsUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: MerchantSettingsUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/MerchantSettingsUpdatedEventObject.ts b/src/serialization/types/MerchantSettingsUpdatedEventObject.ts deleted file mode 100644 index a5c2bb4f2..000000000 --- a/src/serialization/types/MerchantSettingsUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./CheckoutMerchantSettings"; - -export const MerchantSettingsUpdatedEventObject: core.serialization.ObjectSchema< - serializers.MerchantSettingsUpdatedEventObject.Raw, - Square.MerchantSettingsUpdatedEventObject -> = core.serialization.object({ - merchantSettings: core.serialization.property("merchant_settings", CheckoutMerchantSettings.optional()), -}); - -export declare namespace MerchantSettingsUpdatedEventObject { - export interface Raw { - merchant_settings?: CheckoutMerchantSettings.Raw | null; - } -} diff --git a/src/serialization/types/MerchantStatus.ts b/src/serialization/types/MerchantStatus.ts deleted file mode 100644 index f5f261227..000000000 --- a/src/serialization/types/MerchantStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ca69ef371..000000000 --- a/src/serialization/types/ModifierLocationOverrides.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2ae0cc3be..000000000 --- a/src/serialization/types/Money.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-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/OauthAuthorizationRevokedEvent.ts b/src/serialization/types/OauthAuthorizationRevokedEvent.ts deleted file mode 100644 index 5877443e3..000000000 --- a/src/serialization/types/OauthAuthorizationRevokedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OauthAuthorizationRevokedEventData } from "./OauthAuthorizationRevokedEventData"; - -export const OauthAuthorizationRevokedEvent: core.serialization.ObjectSchema< - serializers.OauthAuthorizationRevokedEvent.Raw, - Square.OauthAuthorizationRevokedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: OauthAuthorizationRevokedEventData.optional(), -}); - -export declare namespace OauthAuthorizationRevokedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: OauthAuthorizationRevokedEventData.Raw | null; - } -} diff --git a/src/serialization/types/OauthAuthorizationRevokedEventData.ts b/src/serialization/types/OauthAuthorizationRevokedEventData.ts deleted file mode 100644 index a209163ae..000000000 --- a/src/serialization/types/OauthAuthorizationRevokedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OauthAuthorizationRevokedEventObject } from "./OauthAuthorizationRevokedEventObject"; - -export const OauthAuthorizationRevokedEventData: core.serialization.ObjectSchema< - serializers.OauthAuthorizationRevokedEventData.Raw, - Square.OauthAuthorizationRevokedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: OauthAuthorizationRevokedEventObject.optional(), -}); - -export declare namespace OauthAuthorizationRevokedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: OauthAuthorizationRevokedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/OauthAuthorizationRevokedEventObject.ts b/src/serialization/types/OauthAuthorizationRevokedEventObject.ts deleted file mode 100644 index a362c45ea..000000000 --- a/src/serialization/types/OauthAuthorizationRevokedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OauthAuthorizationRevokedEventRevocationObject } from "./OauthAuthorizationRevokedEventRevocationObject"; - -export const OauthAuthorizationRevokedEventObject: core.serialization.ObjectSchema< - serializers.OauthAuthorizationRevokedEventObject.Raw, - Square.OauthAuthorizationRevokedEventObject -> = core.serialization.object({ - revocation: OauthAuthorizationRevokedEventRevocationObject.optional(), -}); - -export declare namespace OauthAuthorizationRevokedEventObject { - export interface Raw { - revocation?: OauthAuthorizationRevokedEventRevocationObject.Raw | null; - } -} diff --git a/src/serialization/types/OauthAuthorizationRevokedEventRevocationObject.ts b/src/serialization/types/OauthAuthorizationRevokedEventRevocationObject.ts deleted file mode 100644 index a2e073b93..000000000 --- a/src/serialization/types/OauthAuthorizationRevokedEventRevocationObject.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OauthAuthorizationRevokedEventRevokerType } from "./OauthAuthorizationRevokedEventRevokerType"; - -export const OauthAuthorizationRevokedEventRevocationObject: core.serialization.ObjectSchema< - serializers.OauthAuthorizationRevokedEventRevocationObject.Raw, - Square.OauthAuthorizationRevokedEventRevocationObject -> = core.serialization.object({ - revokedAt: core.serialization.property("revoked_at", core.serialization.string().optionalNullable()), - revokerType: core.serialization.property("revoker_type", OauthAuthorizationRevokedEventRevokerType.optional()), -}); - -export declare namespace OauthAuthorizationRevokedEventRevocationObject { - export interface Raw { - revoked_at?: (string | null) | null; - revoker_type?: OauthAuthorizationRevokedEventRevokerType.Raw | null; - } -} diff --git a/src/serialization/types/OauthAuthorizationRevokedEventRevokerType.ts b/src/serialization/types/OauthAuthorizationRevokedEventRevokerType.ts deleted file mode 100644 index 63f07783e..000000000 --- a/src/serialization/types/OauthAuthorizationRevokedEventRevokerType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const OauthAuthorizationRevokedEventRevokerType: core.serialization.Schema< - serializers.OauthAuthorizationRevokedEventRevokerType.Raw, - Square.OauthAuthorizationRevokedEventRevokerType -> = core.serialization.enum_(["APPLICATION", "MERCHANT", "SQUARE"]); - -export declare namespace OauthAuthorizationRevokedEventRevokerType { - export type Raw = "APPLICATION" | "MERCHANT" | "SQUARE"; -} diff --git a/src/serialization/types/ObtainTokenResponse.ts b/src/serialization/types/ObtainTokenResponse.ts deleted file mode 100644 index 1d3aca06b..000000000 --- a/src/serialization/types/ObtainTokenResponse.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 139973f11..000000000 --- a/src/serialization/types/OfflinePaymentDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 892f18430..000000000 --- a/src/serialization/types/Order.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file was auto-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/OrderCreated.ts b/src/serialization/types/OrderCreated.ts deleted file mode 100644 index 8123ff537..000000000 --- a/src/serialization/types/OrderCreated.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 OrderCreated: 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()), - state: OrderState.optional(), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - }); - -export declare namespace OrderCreated { - export interface Raw { - order_id?: (string | null) | null; - version?: number | null; - location_id?: (string | null) | null; - state?: OrderState.Raw | null; - created_at?: string | null; - } -} diff --git a/src/serialization/types/OrderCreatedEvent.ts b/src/serialization/types/OrderCreatedEvent.ts deleted file mode 100644 index d79d0ae52..000000000 --- a/src/serialization/types/OrderCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderCreatedEventData } from "./OrderCreatedEventData"; - -export const OrderCreatedEvent: core.serialization.ObjectSchema< - serializers.OrderCreatedEvent.Raw, - Square.OrderCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: OrderCreatedEventData.optional(), -}); - -export declare namespace OrderCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: OrderCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCreatedEventData.ts b/src/serialization/types/OrderCreatedEventData.ts deleted file mode 100644 index 7e6fd99a8..000000000 --- a/src/serialization/types/OrderCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderCreatedObject } from "./OrderCreatedObject"; - -export const OrderCreatedEventData: core.serialization.ObjectSchema< - serializers.OrderCreatedEventData.Raw, - Square.OrderCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: OrderCreatedObject.optional(), -}); - -export declare namespace OrderCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: OrderCreatedObject.Raw | null; - } -} diff --git a/src/serialization/types/OrderCreatedObject.ts b/src/serialization/types/OrderCreatedObject.ts deleted file mode 100644 index 29831d1d0..000000000 --- a/src/serialization/types/OrderCreatedObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderCreated } from "./OrderCreated"; - -export const OrderCreatedObject: core.serialization.ObjectSchema< - serializers.OrderCreatedObject.Raw, - Square.OrderCreatedObject -> = core.serialization.object({ - orderCreated: core.serialization.property("order_created", OrderCreated.optional()), -}); - -export declare namespace OrderCreatedObject { - export interface Raw { - order_created?: OrderCreated.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeDefinitionOwnedCreatedEvent.ts b/src/serialization/types/OrderCustomAttributeDefinitionOwnedCreatedEvent.ts deleted file mode 100644 index 0fa972820..000000000 --- a/src/serialization/types/OrderCustomAttributeDefinitionOwnedCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const OrderCustomAttributeDefinitionOwnedCreatedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeDefinitionOwnedCreatedEvent.Raw, - Square.OrderCustomAttributeDefinitionOwnedCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace OrderCustomAttributeDefinitionOwnedCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeDefinitionOwnedDeletedEvent.ts b/src/serialization/types/OrderCustomAttributeDefinitionOwnedDeletedEvent.ts deleted file mode 100644 index 264b11ef8..000000000 --- a/src/serialization/types/OrderCustomAttributeDefinitionOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const OrderCustomAttributeDefinitionOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeDefinitionOwnedDeletedEvent.Raw, - Square.OrderCustomAttributeDefinitionOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace OrderCustomAttributeDefinitionOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeDefinitionOwnedUpdatedEvent.ts b/src/serialization/types/OrderCustomAttributeDefinitionOwnedUpdatedEvent.ts deleted file mode 100644 index 2ed0dd567..000000000 --- a/src/serialization/types/OrderCustomAttributeDefinitionOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const OrderCustomAttributeDefinitionOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeDefinitionOwnedUpdatedEvent.Raw, - Square.OrderCustomAttributeDefinitionOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace OrderCustomAttributeDefinitionOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeDefinitionVisibleCreatedEvent.ts b/src/serialization/types/OrderCustomAttributeDefinitionVisibleCreatedEvent.ts deleted file mode 100644 index 55d4d8f1c..000000000 --- a/src/serialization/types/OrderCustomAttributeDefinitionVisibleCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const OrderCustomAttributeDefinitionVisibleCreatedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeDefinitionVisibleCreatedEvent.Raw, - Square.OrderCustomAttributeDefinitionVisibleCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace OrderCustomAttributeDefinitionVisibleCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeDefinitionVisibleDeletedEvent.ts b/src/serialization/types/OrderCustomAttributeDefinitionVisibleDeletedEvent.ts deleted file mode 100644 index 50cca2a43..000000000 --- a/src/serialization/types/OrderCustomAttributeDefinitionVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const OrderCustomAttributeDefinitionVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeDefinitionVisibleDeletedEvent.Raw, - Square.OrderCustomAttributeDefinitionVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace OrderCustomAttributeDefinitionVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeDefinitionVisibleUpdatedEvent.ts b/src/serialization/types/OrderCustomAttributeDefinitionVisibleUpdatedEvent.ts deleted file mode 100644 index f682dd992..000000000 --- a/src/serialization/types/OrderCustomAttributeDefinitionVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeDefinitionEventData } from "./CustomAttributeDefinitionEventData"; - -export const OrderCustomAttributeDefinitionVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeDefinitionVisibleUpdatedEvent.Raw, - Square.OrderCustomAttributeDefinitionVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeDefinitionEventData.optional(), -}); - -export declare namespace OrderCustomAttributeDefinitionVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeDefinitionEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeOwnedDeletedEvent.ts b/src/serialization/types/OrderCustomAttributeOwnedDeletedEvent.ts deleted file mode 100644 index 33f65a013..000000000 --- a/src/serialization/types/OrderCustomAttributeOwnedDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const OrderCustomAttributeOwnedDeletedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeOwnedDeletedEvent.Raw, - Square.OrderCustomAttributeOwnedDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace OrderCustomAttributeOwnedDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeOwnedUpdatedEvent.ts b/src/serialization/types/OrderCustomAttributeOwnedUpdatedEvent.ts deleted file mode 100644 index 1f85cd519..000000000 --- a/src/serialization/types/OrderCustomAttributeOwnedUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const OrderCustomAttributeOwnedUpdatedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeOwnedUpdatedEvent.Raw, - Square.OrderCustomAttributeOwnedUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace OrderCustomAttributeOwnedUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeVisibleDeletedEvent.ts b/src/serialization/types/OrderCustomAttributeVisibleDeletedEvent.ts deleted file mode 100644 index a0fc52244..000000000 --- a/src/serialization/types/OrderCustomAttributeVisibleDeletedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const OrderCustomAttributeVisibleDeletedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeVisibleDeletedEvent.Raw, - Square.OrderCustomAttributeVisibleDeletedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace OrderCustomAttributeVisibleDeletedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderCustomAttributeVisibleUpdatedEvent.ts b/src/serialization/types/OrderCustomAttributeVisibleUpdatedEvent.ts deleted file mode 100644 index b1b3e167c..000000000 --- a/src/serialization/types/OrderCustomAttributeVisibleUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { CustomAttributeEventData } from "./CustomAttributeEventData"; - -export const OrderCustomAttributeVisibleUpdatedEvent: core.serialization.ObjectSchema< - serializers.OrderCustomAttributeVisibleUpdatedEvent.Raw, - Square.OrderCustomAttributeVisibleUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: CustomAttributeEventData.optional(), -}); - -export declare namespace OrderCustomAttributeVisibleUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: CustomAttributeEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderEntry.ts b/src/serialization/types/OrderEntry.ts deleted file mode 100644 index 7d0ea2c29..000000000 --- a/src/serialization/types/OrderEntry.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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/OrderFulfillmentDeliveryDetailsScheduleType.ts b/src/serialization/types/OrderFulfillmentDeliveryDetailsScheduleType.ts deleted file mode 100644 index ada54aada..000000000 --- a/src/serialization/types/OrderFulfillmentDeliveryDetailsScheduleType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const OrderFulfillmentDeliveryDetailsScheduleType: core.serialization.Schema< - serializers.OrderFulfillmentDeliveryDetailsScheduleType.Raw, - Square.OrderFulfillmentDeliveryDetailsScheduleType -> = core.serialization.enum_(["SCHEDULED", "ASAP"]); - -export declare namespace OrderFulfillmentDeliveryDetailsScheduleType { - export type Raw = "SCHEDULED" | "ASAP"; -} diff --git a/src/serialization/types/OrderFulfillmentFulfillmentLineItemApplication.ts b/src/serialization/types/OrderFulfillmentFulfillmentLineItemApplication.ts deleted file mode 100644 index a6f622424..000000000 --- a/src/serialization/types/OrderFulfillmentFulfillmentLineItemApplication.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const OrderFulfillmentFulfillmentLineItemApplication: core.serialization.Schema< - serializers.OrderFulfillmentFulfillmentLineItemApplication.Raw, - Square.OrderFulfillmentFulfillmentLineItemApplication -> = core.serialization.enum_(["ALL", "ENTRY_LIST"]); - -export declare namespace OrderFulfillmentFulfillmentLineItemApplication { - export type Raw = "ALL" | "ENTRY_LIST"; -} diff --git a/src/serialization/types/OrderFulfillmentPickupDetailsScheduleType.ts b/src/serialization/types/OrderFulfillmentPickupDetailsScheduleType.ts deleted file mode 100644 index 6c7508461..000000000 --- a/src/serialization/types/OrderFulfillmentPickupDetailsScheduleType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const OrderFulfillmentPickupDetailsScheduleType: core.serialization.Schema< - serializers.OrderFulfillmentPickupDetailsScheduleType.Raw, - Square.OrderFulfillmentPickupDetailsScheduleType -> = core.serialization.enum_(["SCHEDULED", "ASAP"]); - -export declare namespace OrderFulfillmentPickupDetailsScheduleType { - export type Raw = "SCHEDULED" | "ASAP"; -} diff --git a/src/serialization/types/OrderFulfillmentState.ts b/src/serialization/types/OrderFulfillmentState.ts deleted file mode 100644 index 37f9f1bf2..000000000 --- a/src/serialization/types/OrderFulfillmentState.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const OrderFulfillmentState: core.serialization.Schema< - serializers.OrderFulfillmentState.Raw, - Square.OrderFulfillmentState -> = core.serialization.enum_(["PROPOSED", "RESERVED", "PREPARED", "COMPLETED", "CANCELED", "FAILED"]); - -export declare namespace OrderFulfillmentState { - export type Raw = "PROPOSED" | "RESERVED" | "PREPARED" | "COMPLETED" | "CANCELED" | "FAILED"; -} diff --git a/src/serialization/types/OrderFulfillmentType.ts b/src/serialization/types/OrderFulfillmentType.ts deleted file mode 100644 index 5a5b5dc0d..000000000 --- a/src/serialization/types/OrderFulfillmentType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const OrderFulfillmentType: core.serialization.Schema< - serializers.OrderFulfillmentType.Raw, - Square.OrderFulfillmentType -> = core.serialization.enum_(["PICKUP", "SHIPMENT", "DELIVERY"]); - -export declare namespace OrderFulfillmentType { - export type Raw = "PICKUP" | "SHIPMENT" | "DELIVERY"; -} diff --git a/src/serialization/types/OrderFulfillmentUpdated.ts b/src/serialization/types/OrderFulfillmentUpdated.ts deleted file mode 100644 index 40c4c0e52..000000000 --- a/src/serialization/types/OrderFulfillmentUpdated.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-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"; -import { OrderFulfillmentUpdatedUpdate } from "./OrderFulfillmentUpdatedUpdate"; - -export const OrderFulfillmentUpdated: core.serialization.ObjectSchema< - serializers.OrderFulfillmentUpdated.Raw, - Square.OrderFulfillmentUpdated -> = 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()), - state: OrderState.optional(), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), - fulfillmentUpdate: core.serialization.property( - "fulfillment_update", - core.serialization.list(OrderFulfillmentUpdatedUpdate).optionalNullable(), - ), -}); - -export declare namespace OrderFulfillmentUpdated { - export interface Raw { - order_id?: (string | null) | null; - version?: number | null; - location_id?: (string | null) | null; - state?: OrderState.Raw | null; - created_at?: string | null; - updated_at?: string | null; - fulfillment_update?: (OrderFulfillmentUpdatedUpdate.Raw[] | null) | null; - } -} diff --git a/src/serialization/types/OrderFulfillmentUpdatedEvent.ts b/src/serialization/types/OrderFulfillmentUpdatedEvent.ts deleted file mode 100644 index 6d4626c2d..000000000 --- a/src/serialization/types/OrderFulfillmentUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderFulfillmentUpdatedEventData } from "./OrderFulfillmentUpdatedEventData"; - -export const OrderFulfillmentUpdatedEvent: core.serialization.ObjectSchema< - serializers.OrderFulfillmentUpdatedEvent.Raw, - Square.OrderFulfillmentUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: OrderFulfillmentUpdatedEventData.optional(), -}); - -export declare namespace OrderFulfillmentUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: OrderFulfillmentUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderFulfillmentUpdatedEventData.ts b/src/serialization/types/OrderFulfillmentUpdatedEventData.ts deleted file mode 100644 index b87a0e1da..000000000 --- a/src/serialization/types/OrderFulfillmentUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderFulfillmentUpdatedObject } from "./OrderFulfillmentUpdatedObject"; - -export const OrderFulfillmentUpdatedEventData: core.serialization.ObjectSchema< - serializers.OrderFulfillmentUpdatedEventData.Raw, - Square.OrderFulfillmentUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: OrderFulfillmentUpdatedObject.optional(), -}); - -export declare namespace OrderFulfillmentUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: OrderFulfillmentUpdatedObject.Raw | null; - } -} diff --git a/src/serialization/types/OrderFulfillmentUpdatedObject.ts b/src/serialization/types/OrderFulfillmentUpdatedObject.ts deleted file mode 100644 index 937e85064..000000000 --- a/src/serialization/types/OrderFulfillmentUpdatedObject.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderFulfillmentUpdated } from "./OrderFulfillmentUpdated"; - -export const OrderFulfillmentUpdatedObject: core.serialization.ObjectSchema< - serializers.OrderFulfillmentUpdatedObject.Raw, - Square.OrderFulfillmentUpdatedObject -> = core.serialization.object({ - orderFulfillmentUpdated: core.serialization.property( - "order_fulfillment_updated", - OrderFulfillmentUpdated.optional(), - ), -}); - -export declare namespace OrderFulfillmentUpdatedObject { - export interface Raw { - order_fulfillment_updated?: OrderFulfillmentUpdated.Raw | null; - } -} diff --git a/src/serialization/types/OrderFulfillmentUpdatedUpdate.ts b/src/serialization/types/OrderFulfillmentUpdatedUpdate.ts deleted file mode 100644 index 4f7d6ef8a..000000000 --- a/src/serialization/types/OrderFulfillmentUpdatedUpdate.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { FulfillmentState } from "./FulfillmentState"; - -export const OrderFulfillmentUpdatedUpdate: core.serialization.ObjectSchema< - serializers.OrderFulfillmentUpdatedUpdate.Raw, - Square.OrderFulfillmentUpdatedUpdate -> = core.serialization.object({ - fulfillmentUid: core.serialization.property("fulfillment_uid", core.serialization.string().optionalNullable()), - oldState: core.serialization.property("old_state", FulfillmentState.optional()), - newState: core.serialization.property("new_state", FulfillmentState.optional()), -}); - -export declare namespace OrderFulfillmentUpdatedUpdate { - export interface Raw { - fulfillment_uid?: (string | null) | null; - old_state?: FulfillmentState.Raw | null; - new_state?: FulfillmentState.Raw | null; - } -} diff --git a/src/serialization/types/OrderLineItem.ts b/src/serialization/types/OrderLineItem.ts deleted file mode 100644 index 77dac1de4..000000000 --- a/src/serialization/types/OrderLineItem.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2e1d5875e..000000000 --- a/src/serialization/types/OrderLineItemAppliedDiscount.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 36612b700..000000000 --- a/src/serialization/types/OrderLineItemAppliedServiceCharge.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d04a39c78..000000000 --- a/src/serialization/types/OrderLineItemAppliedTax.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d4044eb07..000000000 --- a/src/serialization/types/OrderLineItemDiscount.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bce436185..000000000 --- a/src/serialization/types/OrderLineItemDiscountScope.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index dfb201efd..000000000 --- a/src/serialization/types/OrderLineItemDiscountType.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 68533023b..000000000 --- a/src/serialization/types/OrderLineItemItemType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8e1eca6ac..000000000 --- a/src/serialization/types/OrderLineItemModifier.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2042642b5..000000000 --- a/src/serialization/types/OrderLineItemPricingBlocklists.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2c326bb13..000000000 --- a/src/serialization/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 0909a8346..000000000 --- a/src/serialization/types/OrderLineItemPricingBlocklistsBlockedTax.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 2e61af997..000000000 --- a/src/serialization/types/OrderLineItemTax.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c819edbed..000000000 --- a/src/serialization/types/OrderLineItemTaxScope.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 37322d402..000000000 --- a/src/serialization/types/OrderLineItemTaxType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 40e754627..000000000 --- a/src/serialization/types/OrderMoneyAmounts.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cb0dd842b..000000000 --- a/src/serialization/types/OrderPricingOptions.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7d67fdc6a..000000000 --- a/src/serialization/types/OrderQuantityUnit.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 650a90208..000000000 --- a/src/serialization/types/OrderReturn.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 05c25785e..000000000 --- a/src/serialization/types/OrderReturnDiscount.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 565236307..000000000 --- a/src/serialization/types/OrderReturnLineItem.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2515ff830..000000000 --- a/src/serialization/types/OrderReturnLineItemModifier.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5e69e20f8..000000000 --- a/src/serialization/types/OrderReturnServiceCharge.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6d3f0f0ea..000000000 --- a/src/serialization/types/OrderReturnTax.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 683b370d0..000000000 --- a/src/serialization/types/OrderReturnTip.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7a9bb193c..000000000 --- a/src/serialization/types/OrderReward.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index fcdf03719..000000000 --- a/src/serialization/types/OrderRoundingAdjustment.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 88fbd238a..000000000 --- a/src/serialization/types/OrderServiceCharge.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ac6544627..000000000 --- a/src/serialization/types/OrderServiceChargeCalculationPhase.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 83faa80ea..000000000 --- a/src/serialization/types/OrderServiceChargeScope.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index af0aca06c..000000000 --- a/src/serialization/types/OrderServiceChargeTreatmentType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4553380e3..000000000 --- a/src/serialization/types/OrderServiceChargeType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index f260b8b09..000000000 --- a/src/serialization/types/OrderSource.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index eb74759b5..000000000 --- a/src/serialization/types/OrderState.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/OrderUpdated.ts b/src/serialization/types/OrderUpdated.ts deleted file mode 100644 index 8d3ef5fb1..000000000 --- a/src/serialization/types/OrderUpdated.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 OrderUpdated: 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()), - state: OrderState.optional(), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), - }); - -export declare namespace OrderUpdated { - export interface Raw { - order_id?: (string | null) | null; - version?: number | null; - location_id?: (string | null) | null; - state?: OrderState.Raw | null; - created_at?: string | null; - updated_at?: string | null; - } -} diff --git a/src/serialization/types/OrderUpdatedEvent.ts b/src/serialization/types/OrderUpdatedEvent.ts deleted file mode 100644 index c8b6722d9..000000000 --- a/src/serialization/types/OrderUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderUpdatedEventData } from "./OrderUpdatedEventData"; - -export const OrderUpdatedEvent: core.serialization.ObjectSchema< - serializers.OrderUpdatedEvent.Raw, - Square.OrderUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: OrderUpdatedEventData.optional(), -}); - -export declare namespace OrderUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: OrderUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/OrderUpdatedEventData.ts b/src/serialization/types/OrderUpdatedEventData.ts deleted file mode 100644 index 09ead4e9f..000000000 --- a/src/serialization/types/OrderUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderUpdatedObject } from "./OrderUpdatedObject"; - -export const OrderUpdatedEventData: core.serialization.ObjectSchema< - serializers.OrderUpdatedEventData.Raw, - Square.OrderUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: OrderUpdatedObject.optional(), -}); - -export declare namespace OrderUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: OrderUpdatedObject.Raw | null; - } -} diff --git a/src/serialization/types/OrderUpdatedObject.ts b/src/serialization/types/OrderUpdatedObject.ts deleted file mode 100644 index cfb2efa2c..000000000 --- a/src/serialization/types/OrderUpdatedObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { OrderUpdated } from "./OrderUpdated"; - -export const OrderUpdatedObject: core.serialization.ObjectSchema< - serializers.OrderUpdatedObject.Raw, - Square.OrderUpdatedObject -> = core.serialization.object({ - orderUpdated: core.serialization.property("order_updated", OrderUpdated.optional()), -}); - -export declare namespace OrderUpdatedObject { - export interface Raw { - order_updated?: OrderUpdated.Raw | null; - } -} diff --git a/src/serialization/types/PauseSubscriptionResponse.ts b/src/serialization/types/PauseSubscriptionResponse.ts deleted file mode 100644 index 0567c7b00..000000000 --- a/src/serialization/types/PauseSubscriptionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 568b53da5..000000000 --- a/src/serialization/types/PayOrderResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c088f6643..000000000 --- a/src/serialization/types/Payment.ts +++ /dev/null @@ -1,127 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 93715e586..000000000 --- a/src/serialization/types/PaymentBalanceActivityAppFeeRefundDetail.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e51a7e1d7..000000000 --- a/src/serialization/types/PaymentBalanceActivityAppFeeRevenueDetail.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5a54a9f90..000000000 --- a/src/serialization/types/PaymentBalanceActivityAutomaticSavingsDetail.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 936413940..000000000 --- a/src/serialization/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 1106a0204..000000000 --- a/src/serialization/types/PaymentBalanceActivityChargeDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 8e3f3179e..000000000 --- a/src/serialization/types/PaymentBalanceActivityDepositFeeDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 53747895f..000000000 --- a/src/serialization/types/PaymentBalanceActivityDepositFeeReversedDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a25697664..000000000 --- a/src/serialization/types/PaymentBalanceActivityDisputeDetail.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 30db029ff..000000000 --- a/src/serialization/types/PaymentBalanceActivityFeeDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 38e81759b..000000000 --- a/src/serialization/types/PaymentBalanceActivityFreeProcessingDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7add70237..000000000 --- a/src/serialization/types/PaymentBalanceActivityHoldAdjustmentDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ffe15a534..000000000 --- a/src/serialization/types/PaymentBalanceActivityOpenDisputeDetail.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 82a2306a8..000000000 --- a/src/serialization/types/PaymentBalanceActivityOtherAdjustmentDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b630c73b3..000000000 --- a/src/serialization/types/PaymentBalanceActivityOtherDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 872d98175..000000000 --- a/src/serialization/types/PaymentBalanceActivityRefundDetail.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9cac322fd..000000000 --- a/src/serialization/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9fb979d1b..000000000 --- a/src/serialization/types/PaymentBalanceActivityReserveHoldDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3c67aee14..000000000 --- a/src/serialization/types/PaymentBalanceActivityReserveReleaseDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3d6c15fa1..000000000 --- a/src/serialization/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 055245e5c..000000000 --- a/src/serialization/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5d4921bbe..000000000 --- a/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c1788834d..000000000 --- a/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e7b9c9ded..000000000 --- a/src/serialization/types/PaymentBalanceActivityTaxOnFeeDetail.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5cd6f8826..000000000 --- a/src/serialization/types/PaymentBalanceActivityThirdPartyFeeDetail.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 177199e56..000000000 --- a/src/serialization/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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/PaymentCreatedEvent.ts b/src/serialization/types/PaymentCreatedEvent.ts deleted file mode 100644 index b34bdd905..000000000 --- a/src/serialization/types/PaymentCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PaymentCreatedEventData } from "./PaymentCreatedEventData"; - -export const PaymentCreatedEvent: core.serialization.ObjectSchema< - serializers.PaymentCreatedEvent.Raw, - Square.PaymentCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: PaymentCreatedEventData.optional(), -}); - -export declare namespace PaymentCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: PaymentCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/PaymentCreatedEventData.ts b/src/serialization/types/PaymentCreatedEventData.ts deleted file mode 100644 index a09a44f6e..000000000 --- a/src/serialization/types/PaymentCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PaymentCreatedEventObject } from "./PaymentCreatedEventObject"; - -export const PaymentCreatedEventData: core.serialization.ObjectSchema< - serializers.PaymentCreatedEventData.Raw, - Square.PaymentCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: PaymentCreatedEventObject.optional(), -}); - -export declare namespace PaymentCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: PaymentCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/PaymentCreatedEventObject.ts b/src/serialization/types/PaymentCreatedEventObject.ts deleted file mode 100644 index 9dbe956b7..000000000 --- a/src/serialization/types/PaymentCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./Payment"; - -export const PaymentCreatedEventObject: core.serialization.ObjectSchema< - serializers.PaymentCreatedEventObject.Raw, - Square.PaymentCreatedEventObject -> = core.serialization.object({ - payment: Payment.optional(), -}); - -export declare namespace PaymentCreatedEventObject { - export interface Raw { - payment?: Payment.Raw | null; - } -} diff --git a/src/serialization/types/PaymentLink.ts b/src/serialization/types/PaymentLink.ts deleted file mode 100644 index 4bef5bb04..000000000 --- a/src/serialization/types/PaymentLink.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b2b074e85..000000000 --- a/src/serialization/types/PaymentLinkRelatedResources.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 35c20723c..000000000 --- a/src/serialization/types/PaymentOptions.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cc1fd6003..000000000 --- a/src/serialization/types/PaymentOptionsDelayAction.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4dcdccbf4..000000000 --- a/src/serialization/types/PaymentRefund.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file was auto-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/PaymentUpdatedEvent.ts b/src/serialization/types/PaymentUpdatedEvent.ts deleted file mode 100644 index ab9a839bc..000000000 --- a/src/serialization/types/PaymentUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PaymentUpdatedEventData } from "./PaymentUpdatedEventData"; - -export const PaymentUpdatedEvent: core.serialization.ObjectSchema< - serializers.PaymentUpdatedEvent.Raw, - Square.PaymentUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: PaymentUpdatedEventData.optional(), -}); - -export declare namespace PaymentUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: PaymentUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/PaymentUpdatedEventData.ts b/src/serialization/types/PaymentUpdatedEventData.ts deleted file mode 100644 index 03fd0f3c0..000000000 --- a/src/serialization/types/PaymentUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PaymentUpdatedEventObject } from "./PaymentUpdatedEventObject"; - -export const PaymentUpdatedEventData: core.serialization.ObjectSchema< - serializers.PaymentUpdatedEventData.Raw, - Square.PaymentUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: PaymentUpdatedEventObject.optional(), -}); - -export declare namespace PaymentUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: PaymentUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/PaymentUpdatedEventObject.ts b/src/serialization/types/PaymentUpdatedEventObject.ts deleted file mode 100644 index 5f4ddedfa..000000000 --- a/src/serialization/types/PaymentUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./Payment"; - -export const PaymentUpdatedEventObject: core.serialization.ObjectSchema< - serializers.PaymentUpdatedEventObject.Raw, - Square.PaymentUpdatedEventObject -> = core.serialization.object({ - payment: Payment.optional(), -}); - -export declare namespace PaymentUpdatedEventObject { - export interface Raw { - payment?: Payment.Raw | null; - } -} diff --git a/src/serialization/types/Payout.ts b/src/serialization/types/Payout.ts deleted file mode 100644 index e0517b2ad..000000000 --- a/src/serialization/types/Payout.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index be6a53eed..000000000 --- a/src/serialization/types/PayoutEntry.ts +++ /dev/null @@ -1,179 +0,0 @@ -/** - * This file was auto-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/PayoutFailedEvent.ts b/src/serialization/types/PayoutFailedEvent.ts deleted file mode 100644 index 52458cb33..000000000 --- a/src/serialization/types/PayoutFailedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PayoutFailedEventData } from "./PayoutFailedEventData"; - -export const PayoutFailedEvent: core.serialization.ObjectSchema< - serializers.PayoutFailedEvent.Raw, - Square.PayoutFailedEvent -> = 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: PayoutFailedEventData.optional(), -}); - -export declare namespace PayoutFailedEvent { - 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?: PayoutFailedEventData.Raw | null; - } -} diff --git a/src/serialization/types/PayoutFailedEventData.ts b/src/serialization/types/PayoutFailedEventData.ts deleted file mode 100644 index d756875b8..000000000 --- a/src/serialization/types/PayoutFailedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PayoutFailedEventObject } from "./PayoutFailedEventObject"; - -export const PayoutFailedEventData: core.serialization.ObjectSchema< - serializers.PayoutFailedEventData.Raw, - Square.PayoutFailedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: PayoutFailedEventObject.optional(), -}); - -export declare namespace PayoutFailedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: PayoutFailedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/PayoutFailedEventObject.ts b/src/serialization/types/PayoutFailedEventObject.ts deleted file mode 100644 index f6793cbca..000000000 --- a/src/serialization/types/PayoutFailedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const PayoutFailedEventObject: core.serialization.ObjectSchema< - serializers.PayoutFailedEventObject.Raw, - Square.PayoutFailedEventObject -> = core.serialization.object({ - payout: Payout.optional(), -}); - -export declare namespace PayoutFailedEventObject { - export interface Raw { - payout?: Payout.Raw | null; - } -} diff --git a/src/serialization/types/PayoutFee.ts b/src/serialization/types/PayoutFee.ts deleted file mode 100644 index 336dee4cb..000000000 --- a/src/serialization/types/PayoutFee.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9a1a80a65..000000000 --- a/src/serialization/types/PayoutFeeType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/PayoutPaidEvent.ts b/src/serialization/types/PayoutPaidEvent.ts deleted file mode 100644 index 77f175062..000000000 --- a/src/serialization/types/PayoutPaidEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PayoutPaidEventData } from "./PayoutPaidEventData"; - -export const PayoutPaidEvent: 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: PayoutPaidEventData.optional(), - }); - -export declare namespace PayoutPaidEvent { - 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?: PayoutPaidEventData.Raw | null; - } -} diff --git a/src/serialization/types/PayoutPaidEventData.ts b/src/serialization/types/PayoutPaidEventData.ts deleted file mode 100644 index 4206749ad..000000000 --- a/src/serialization/types/PayoutPaidEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PayoutPaidEventObject } from "./PayoutPaidEventObject"; - -export const PayoutPaidEventData: core.serialization.ObjectSchema< - serializers.PayoutPaidEventData.Raw, - Square.PayoutPaidEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: PayoutPaidEventObject.optional(), -}); - -export declare namespace PayoutPaidEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: PayoutPaidEventObject.Raw | null; - } -} diff --git a/src/serialization/types/PayoutPaidEventObject.ts b/src/serialization/types/PayoutPaidEventObject.ts deleted file mode 100644 index fe07e5231..000000000 --- a/src/serialization/types/PayoutPaidEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const PayoutPaidEventObject: core.serialization.ObjectSchema< - serializers.PayoutPaidEventObject.Raw, - Square.PayoutPaidEventObject -> = core.serialization.object({ - payout: Payout.optional(), -}); - -export declare namespace PayoutPaidEventObject { - export interface Raw { - payout?: Payout.Raw | null; - } -} diff --git a/src/serialization/types/PayoutSentEvent.ts b/src/serialization/types/PayoutSentEvent.ts deleted file mode 100644 index fe68fd341..000000000 --- a/src/serialization/types/PayoutSentEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PayoutSentEventData } from "./PayoutSentEventData"; - -export const PayoutSentEvent: 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: PayoutSentEventData.optional(), - }); - -export declare namespace PayoutSentEvent { - 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?: PayoutSentEventData.Raw | null; - } -} diff --git a/src/serialization/types/PayoutSentEventData.ts b/src/serialization/types/PayoutSentEventData.ts deleted file mode 100644 index 6ff99f720..000000000 --- a/src/serialization/types/PayoutSentEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PayoutSentEventObject } from "./PayoutSentEventObject"; - -export const PayoutSentEventData: core.serialization.ObjectSchema< - serializers.PayoutSentEventData.Raw, - Square.PayoutSentEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: PayoutSentEventObject.optional(), -}); - -export declare namespace PayoutSentEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: PayoutSentEventObject.Raw | null; - } -} diff --git a/src/serialization/types/PayoutSentEventObject.ts b/src/serialization/types/PayoutSentEventObject.ts deleted file mode 100644 index e85b3187d..000000000 --- a/src/serialization/types/PayoutSentEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const PayoutSentEventObject: core.serialization.ObjectSchema< - serializers.PayoutSentEventObject.Raw, - Square.PayoutSentEventObject -> = core.serialization.object({ - payout: Payout.optional(), -}); - -export declare namespace PayoutSentEventObject { - export interface Raw { - payout?: Payout.Raw | null; - } -} diff --git a/src/serialization/types/PayoutStatus.ts b/src/serialization/types/PayoutStatus.ts deleted file mode 100644 index 9754f341e..000000000 --- a/src/serialization/types/PayoutStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b098f055b..000000000 --- a/src/serialization/types/PayoutType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 729c46185..000000000 --- a/src/serialization/types/Phase.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index dc5014d6e..000000000 --- a/src/serialization/types/PhaseInput.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ec9a1c623..000000000 --- a/src/serialization/types/PrePopulatedData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0be927813..000000000 --- a/src/serialization/types/ProcessingFee.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ae4f181c8..000000000 --- a/src/serialization/types/Product.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4c34c70bf..000000000 --- a/src/serialization/types/ProductType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 7158bd895..000000000 --- a/src/serialization/types/PublishInvoiceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/PublishScheduledShiftResponse.ts b/src/serialization/types/PublishScheduledShiftResponse.ts deleted file mode 100644 index 4c83f8eda..000000000 --- a/src/serialization/types/PublishScheduledShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; -import { Error_ } from "./Error_"; - -export const PublishScheduledShiftResponse: core.serialization.ObjectSchema< - serializers.PublishScheduledShiftResponse.Raw, - Square.PublishScheduledShiftResponse -> = core.serialization.object({ - scheduledShift: core.serialization.property("scheduled_shift", ScheduledShift.optional()), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace PublishScheduledShiftResponse { - export interface Raw { - scheduled_shift?: ScheduledShift.Raw | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/QrCodeOptions.ts b/src/serialization/types/QrCodeOptions.ts deleted file mode 100644 index 441b168c5..000000000 --- a/src/serialization/types/QrCodeOptions.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d2b0867ae..000000000 --- a/src/serialization/types/QuickPay.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a77159731..000000000 --- a/src/serialization/types/Range.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index d47ea2d70..000000000 --- a/src/serialization/types/ReceiptOptions.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b73aec760..000000000 --- a/src/serialization/types/RedeemLoyaltyRewardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2a1c441ae..000000000 --- a/src/serialization/types/Refund.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-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().optionalNullable()), - 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 | null) | null; - 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/RefundCreatedEvent.ts b/src/serialization/types/RefundCreatedEvent.ts deleted file mode 100644 index 7e67ab7ad..000000000 --- a/src/serialization/types/RefundCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { RefundCreatedEventData } from "./RefundCreatedEventData"; - -export const RefundCreatedEvent: core.serialization.ObjectSchema< - serializers.RefundCreatedEvent.Raw, - Square.RefundCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: RefundCreatedEventData.optional(), -}); - -export declare namespace RefundCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: RefundCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/RefundCreatedEventData.ts b/src/serialization/types/RefundCreatedEventData.ts deleted file mode 100644 index 5ee47cede..000000000 --- a/src/serialization/types/RefundCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { RefundCreatedEventObject } from "./RefundCreatedEventObject"; - -export const RefundCreatedEventData: core.serialization.ObjectSchema< - serializers.RefundCreatedEventData.Raw, - Square.RefundCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: RefundCreatedEventObject.optional(), -}); - -export declare namespace RefundCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: RefundCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/RefundCreatedEventObject.ts b/src/serialization/types/RefundCreatedEventObject.ts deleted file mode 100644 index 1a182a238..000000000 --- a/src/serialization/types/RefundCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PaymentRefund } from "./PaymentRefund"; - -export const RefundCreatedEventObject: core.serialization.ObjectSchema< - serializers.RefundCreatedEventObject.Raw, - Square.RefundCreatedEventObject -> = core.serialization.object({ - refund: PaymentRefund.optional(), -}); - -export declare namespace RefundCreatedEventObject { - export interface Raw { - refund?: PaymentRefund.Raw | null; - } -} diff --git a/src/serialization/types/RefundPaymentResponse.ts b/src/serialization/types/RefundPaymentResponse.ts deleted file mode 100644 index d76298edc..000000000 --- a/src/serialization/types/RefundPaymentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1578265c9..000000000 --- a/src/serialization/types/RefundStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/RefundUpdatedEvent.ts b/src/serialization/types/RefundUpdatedEvent.ts deleted file mode 100644 index 9d62c27c5..000000000 --- a/src/serialization/types/RefundUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { RefundUpdatedEventData } from "./RefundUpdatedEventData"; - -export const RefundUpdatedEvent: core.serialization.ObjectSchema< - serializers.RefundUpdatedEvent.Raw, - Square.RefundUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: RefundUpdatedEventData.optional(), -}); - -export declare namespace RefundUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: RefundUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/RefundUpdatedEventData.ts b/src/serialization/types/RefundUpdatedEventData.ts deleted file mode 100644 index 3e394667b..000000000 --- a/src/serialization/types/RefundUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { RefundUpdatedEventObject } from "./RefundUpdatedEventObject"; - -export const RefundUpdatedEventData: core.serialization.ObjectSchema< - serializers.RefundUpdatedEventData.Raw, - Square.RefundUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: RefundUpdatedEventObject.optional(), -}); - -export declare namespace RefundUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: RefundUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/RefundUpdatedEventObject.ts b/src/serialization/types/RefundUpdatedEventObject.ts deleted file mode 100644 index 297396ffd..000000000 --- a/src/serialization/types/RefundUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { PaymentRefund } from "./PaymentRefund"; - -export const RefundUpdatedEventObject: core.serialization.ObjectSchema< - serializers.RefundUpdatedEventObject.Raw, - Square.RefundUpdatedEventObject -> = core.serialization.object({ - refund: PaymentRefund.optional(), -}); - -export declare namespace RefundUpdatedEventObject { - export interface Raw { - refund?: PaymentRefund.Raw | null; - } -} diff --git a/src/serialization/types/RegisterDomainResponse.ts b/src/serialization/types/RegisterDomainResponse.ts deleted file mode 100644 index 87699cee4..000000000 --- a/src/serialization/types/RegisterDomainResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 77fd34696..000000000 --- a/src/serialization/types/RegisterDomainResponseStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index a401b3884..000000000 --- a/src/serialization/types/RemoveGroupFromCustomerResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b4713acf3..000000000 --- a/src/serialization/types/ResumeSubscriptionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6a4a3f8ed..000000000 --- a/src/serialization/types/RetrieveBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 31e84710a..000000000 --- a/src/serialization/types/RetrieveBookingCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a4b98803c..000000000 --- a/src/serialization/types/RetrieveJobResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2ad615460..000000000 --- a/src/serialization/types/RetrieveLocationBookingProfileResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 01ddfc6db..000000000 --- a/src/serialization/types/RetrieveLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7bf3b30d3..000000000 --- a/src/serialization/types/RetrieveLocationCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 49d846137..000000000 --- a/src/serialization/types/RetrieveLocationSettingsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 7eaf410a2..000000000 --- a/src/serialization/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9f8d1d506..000000000 --- a/src/serialization/types/RetrieveMerchantCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c8150ff50..000000000 --- a/src/serialization/types/RetrieveMerchantSettingsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e783fa6b5..000000000 --- a/src/serialization/types/RetrieveOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 29ece41ae..000000000 --- a/src/serialization/types/RetrieveOrderCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/RetrieveScheduledShiftResponse.ts b/src/serialization/types/RetrieveScheduledShiftResponse.ts deleted file mode 100644 index 06799d906..000000000 --- a/src/serialization/types/RetrieveScheduledShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; -import { Error_ } from "./Error_"; - -export const RetrieveScheduledShiftResponse: core.serialization.ObjectSchema< - serializers.RetrieveScheduledShiftResponse.Raw, - Square.RetrieveScheduledShiftResponse -> = core.serialization.object({ - scheduledShift: core.serialization.property("scheduled_shift", ScheduledShift.optional()), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace RetrieveScheduledShiftResponse { - export interface Raw { - scheduled_shift?: ScheduledShift.Raw | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/RetrieveTimecardResponse.ts b/src/serialization/types/RetrieveTimecardResponse.ts deleted file mode 100644 index f47bc2661..000000000 --- a/src/serialization/types/RetrieveTimecardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Timecard } from "./Timecard"; -import { Error_ } from "./Error_"; - -export const RetrieveTimecardResponse: core.serialization.ObjectSchema< - serializers.RetrieveTimecardResponse.Raw, - Square.RetrieveTimecardResponse -> = core.serialization.object({ - timecard: Timecard.optional(), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace RetrieveTimecardResponse { - export interface Raw { - timecard?: Timecard.Raw | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/RetrieveTokenStatusResponse.ts b/src/serialization/types/RetrieveTokenStatusResponse.ts deleted file mode 100644 index c5dfd9b72..000000000 --- a/src/serialization/types/RetrieveTokenStatusResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 28ebe9146..000000000 --- a/src/serialization/types/RevokeTokenResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d2c707c06..000000000 --- a/src/serialization/types/RiskEvaluation.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 25df8b767..000000000 --- a/src/serialization/types/RiskEvaluationRiskLevel.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 21e0e6b9e..000000000 --- a/src/serialization/types/SaveCardOptions.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated 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/ScheduledShift.ts b/src/serialization/types/ScheduledShift.ts deleted file mode 100644 index 0bab018f7..000000000 --- a/src/serialization/types/ScheduledShift.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShiftDetails } from "./ScheduledShiftDetails"; - -export const ScheduledShift: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string().optional(), - draftShiftDetails: core.serialization.property("draft_shift_details", ScheduledShiftDetails.optional()), - publishedShiftDetails: core.serialization.property("published_shift_details", ScheduledShiftDetails.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()), - }); - -export declare namespace ScheduledShift { - export interface Raw { - id?: string | null; - draft_shift_details?: ScheduledShiftDetails.Raw | null; - published_shift_details?: ScheduledShiftDetails.Raw | null; - version?: number | null; - created_at?: string | null; - updated_at?: string | null; - } -} diff --git a/src/serialization/types/ScheduledShiftDetails.ts b/src/serialization/types/ScheduledShiftDetails.ts deleted file mode 100644 index 9e6e3dca7..000000000 --- a/src/serialization/types/ScheduledShiftDetails.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ScheduledShiftDetails: core.serialization.ObjectSchema< - serializers.ScheduledShiftDetails.Raw, - Square.ScheduledShiftDetails -> = core.serialization.object({ - teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), - locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), - jobId: core.serialization.property("job_id", core.serialization.string().optionalNullable()), - startAt: core.serialization.property("start_at", core.serialization.string().optionalNullable()), - endAt: core.serialization.property("end_at", core.serialization.string().optionalNullable()), - notes: core.serialization.string().optionalNullable(), - isDeleted: core.serialization.property("is_deleted", core.serialization.boolean().optionalNullable()), - timezone: core.serialization.string().optional(), -}); - -export declare namespace ScheduledShiftDetails { - export interface Raw { - team_member_id?: (string | null) | null; - location_id?: (string | null) | null; - job_id?: (string | null) | null; - start_at?: (string | null) | null; - end_at?: (string | null) | null; - notes?: (string | null) | null; - is_deleted?: (boolean | null) | null; - timezone?: string | null; - } -} diff --git a/src/serialization/types/ScheduledShiftFilter.ts b/src/serialization/types/ScheduledShiftFilter.ts deleted file mode 100644 index 32cbeb75d..000000000 --- a/src/serialization/types/ScheduledShiftFilter.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This file was auto-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 { ScheduledShiftWorkday } from "./ScheduledShiftWorkday"; -import { ScheduledShiftFilterAssignmentStatus } from "./ScheduledShiftFilterAssignmentStatus"; -import { ScheduledShiftFilterScheduledShiftStatus } from "./ScheduledShiftFilterScheduledShiftStatus"; - -export const ScheduledShiftFilter: core.serialization.ObjectSchema< - serializers.ScheduledShiftFilter.Raw, - Square.ScheduledShiftFilter -> = core.serialization.object({ - locationIds: core.serialization.property( - "location_ids", - core.serialization.list(core.serialization.string()).optionalNullable(), - ), - start: TimeRange.optional(), - end: TimeRange.optional(), - workday: ScheduledShiftWorkday.optional(), - teamMemberIds: core.serialization.property( - "team_member_ids", - core.serialization.list(core.serialization.string()).optionalNullable(), - ), - assignmentStatus: core.serialization.property("assignment_status", ScheduledShiftFilterAssignmentStatus.optional()), - scheduledShiftStatuses: core.serialization.property( - "scheduled_shift_statuses", - core.serialization.list(ScheduledShiftFilterScheduledShiftStatus).optionalNullable(), - ), -}); - -export declare namespace ScheduledShiftFilter { - export interface Raw { - location_ids?: (string[] | null) | null; - start?: TimeRange.Raw | null; - end?: TimeRange.Raw | null; - workday?: ScheduledShiftWorkday.Raw | null; - team_member_ids?: (string[] | null) | null; - assignment_status?: ScheduledShiftFilterAssignmentStatus.Raw | null; - scheduled_shift_statuses?: (ScheduledShiftFilterScheduledShiftStatus.Raw[] | null) | null; - } -} diff --git a/src/serialization/types/ScheduledShiftFilterAssignmentStatus.ts b/src/serialization/types/ScheduledShiftFilterAssignmentStatus.ts deleted file mode 100644 index 08a43d855..000000000 --- a/src/serialization/types/ScheduledShiftFilterAssignmentStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ScheduledShiftFilterAssignmentStatus: core.serialization.Schema< - serializers.ScheduledShiftFilterAssignmentStatus.Raw, - Square.ScheduledShiftFilterAssignmentStatus -> = core.serialization.enum_(["ASSIGNED", "UNASSIGNED"]); - -export declare namespace ScheduledShiftFilterAssignmentStatus { - export type Raw = "ASSIGNED" | "UNASSIGNED"; -} diff --git a/src/serialization/types/ScheduledShiftFilterScheduledShiftStatus.ts b/src/serialization/types/ScheduledShiftFilterScheduledShiftStatus.ts deleted file mode 100644 index 69c5f442d..000000000 --- a/src/serialization/types/ScheduledShiftFilterScheduledShiftStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ScheduledShiftFilterScheduledShiftStatus: core.serialization.Schema< - serializers.ScheduledShiftFilterScheduledShiftStatus.Raw, - Square.ScheduledShiftFilterScheduledShiftStatus -> = core.serialization.enum_(["DRAFT", "PUBLISHED"]); - -export declare namespace ScheduledShiftFilterScheduledShiftStatus { - export type Raw = "DRAFT" | "PUBLISHED"; -} diff --git a/src/serialization/types/ScheduledShiftNotificationAudience.ts b/src/serialization/types/ScheduledShiftNotificationAudience.ts deleted file mode 100644 index a67c0d674..000000000 --- a/src/serialization/types/ScheduledShiftNotificationAudience.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ScheduledShiftNotificationAudience: core.serialization.Schema< - serializers.ScheduledShiftNotificationAudience.Raw, - Square.ScheduledShiftNotificationAudience -> = core.serialization.enum_(["ALL", "AFFECTED", "NONE"]); - -export declare namespace ScheduledShiftNotificationAudience { - export type Raw = "ALL" | "AFFECTED" | "NONE"; -} diff --git a/src/serialization/types/ScheduledShiftQuery.ts b/src/serialization/types/ScheduledShiftQuery.ts deleted file mode 100644 index 90a349994..000000000 --- a/src/serialization/types/ScheduledShiftQuery.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShiftFilter } from "./ScheduledShiftFilter"; -import { ScheduledShiftSort } from "./ScheduledShiftSort"; - -export const ScheduledShiftQuery: core.serialization.ObjectSchema< - serializers.ScheduledShiftQuery.Raw, - Square.ScheduledShiftQuery -> = core.serialization.object({ - filter: ScheduledShiftFilter.optional(), - sort: ScheduledShiftSort.optional(), -}); - -export declare namespace ScheduledShiftQuery { - export interface Raw { - filter?: ScheduledShiftFilter.Raw | null; - sort?: ScheduledShiftSort.Raw | null; - } -} diff --git a/src/serialization/types/ScheduledShiftSort.ts b/src/serialization/types/ScheduledShiftSort.ts deleted file mode 100644 index a3cf63bc2..000000000 --- a/src/serialization/types/ScheduledShiftSort.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShiftSortField } from "./ScheduledShiftSortField"; -import { SortOrder } from "./SortOrder"; - -export const ScheduledShiftSort: core.serialization.ObjectSchema< - serializers.ScheduledShiftSort.Raw, - Square.ScheduledShiftSort -> = core.serialization.object({ - field: ScheduledShiftSortField.optional(), - order: SortOrder.optional(), -}); - -export declare namespace ScheduledShiftSort { - export interface Raw { - field?: ScheduledShiftSortField.Raw | null; - order?: SortOrder.Raw | null; - } -} diff --git a/src/serialization/types/ScheduledShiftSortField.ts b/src/serialization/types/ScheduledShiftSortField.ts deleted file mode 100644 index 0328dd47d..000000000 --- a/src/serialization/types/ScheduledShiftSortField.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ScheduledShiftSortField: core.serialization.Schema< - serializers.ScheduledShiftSortField.Raw, - Square.ScheduledShiftSortField -> = core.serialization.enum_(["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"]); - -export declare namespace ScheduledShiftSortField { - export type Raw = "START_AT" | "END_AT" | "CREATED_AT" | "UPDATED_AT"; -} diff --git a/src/serialization/types/ScheduledShiftWorkday.ts b/src/serialization/types/ScheduledShiftWorkday.ts deleted file mode 100644 index 47c89309f..000000000 --- a/src/serialization/types/ScheduledShiftWorkday.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 { ScheduledShiftWorkdayMatcher } from "./ScheduledShiftWorkdayMatcher"; - -export const ScheduledShiftWorkday: core.serialization.ObjectSchema< - serializers.ScheduledShiftWorkday.Raw, - Square.ScheduledShiftWorkday -> = core.serialization.object({ - dateRange: core.serialization.property("date_range", DateRange.optional()), - matchScheduledShiftsBy: core.serialization.property( - "match_scheduled_shifts_by", - ScheduledShiftWorkdayMatcher.optional(), - ), - defaultTimezone: core.serialization.property("default_timezone", core.serialization.string().optionalNullable()), -}); - -export declare namespace ScheduledShiftWorkday { - export interface Raw { - date_range?: DateRange.Raw | null; - match_scheduled_shifts_by?: ScheduledShiftWorkdayMatcher.Raw | null; - default_timezone?: (string | null) | null; - } -} diff --git a/src/serialization/types/ScheduledShiftWorkdayMatcher.ts b/src/serialization/types/ScheduledShiftWorkdayMatcher.ts deleted file mode 100644 index 659056087..000000000 --- a/src/serialization/types/ScheduledShiftWorkdayMatcher.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const ScheduledShiftWorkdayMatcher: core.serialization.Schema< - serializers.ScheduledShiftWorkdayMatcher.Raw, - Square.ScheduledShiftWorkdayMatcher -> = core.serialization.enum_(["START_AT", "END_AT", "INTERSECTION"]); - -export declare namespace ScheduledShiftWorkdayMatcher { - export type Raw = "START_AT" | "END_AT" | "INTERSECTION"; -} diff --git a/src/serialization/types/SearchAvailabilityFilter.ts b/src/serialization/types/SearchAvailabilityFilter.ts deleted file mode 100644 index 14717622e..000000000 --- a/src/serialization/types/SearchAvailabilityFilter.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a3166bbb3..000000000 --- a/src/serialization/types/SearchAvailabilityQuery.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e2ccb73f4..000000000 --- a/src/serialization/types/SearchAvailabilityResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2f39d5598..000000000 --- a/src/serialization/types/SearchCatalogItemsRequestStockLevel.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 159714d35..000000000 --- a/src/serialization/types/SearchCatalogItemsResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 44f718830..000000000 --- a/src/serialization/types/SearchCatalogObjectsResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 75a06ffd6..000000000 --- a/src/serialization/types/SearchCustomersResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d146b9ba2..000000000 --- a/src/serialization/types/SearchEventsFilter.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b0bfbfc25..000000000 --- a/src/serialization/types/SearchEventsQuery.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1d600deda..000000000 --- a/src/serialization/types/SearchEventsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 65685abf8..000000000 --- a/src/serialization/types/SearchEventsSort.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4ec6be9fb..000000000 --- a/src/serialization/types/SearchEventsSortField.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e0a13eeb9..000000000 --- a/src/serialization/types/SearchInvoicesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3c4301a0c..000000000 --- a/src/serialization/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 17f71231b..000000000 --- a/src/serialization/types/SearchLoyaltyAccountsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 918c6f772..000000000 --- a/src/serialization/types/SearchLoyaltyEventsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 209f11035..000000000 --- a/src/serialization/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e0533042c..000000000 --- a/src/serialization/types/SearchLoyaltyRewardsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d66b8fd5c..000000000 --- a/src/serialization/types/SearchOrdersCustomerFilter.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e84e1ab47..000000000 --- a/src/serialization/types/SearchOrdersDateTimeFilter.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index dd1ee309e..000000000 --- a/src/serialization/types/SearchOrdersFilter.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4fe610b63..000000000 --- a/src/serialization/types/SearchOrdersFulfillmentFilter.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 633eb35ff..000000000 --- a/src/serialization/types/SearchOrdersQuery.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 87a447147..000000000 --- a/src/serialization/types/SearchOrdersResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d8a7509d8..000000000 --- a/src/serialization/types/SearchOrdersSort.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d8e9d878f..000000000 --- a/src/serialization/types/SearchOrdersSortField.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ea863d6ca..000000000 --- a/src/serialization/types/SearchOrdersSourceFilter.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 351210688..000000000 --- a/src/serialization/types/SearchOrdersStateFilter.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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/SearchScheduledShiftsResponse.ts b/src/serialization/types/SearchScheduledShiftsResponse.ts deleted file mode 100644 index 423bf4333..000000000 --- a/src/serialization/types/SearchScheduledShiftsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; -import { Error_ } from "./Error_"; - -export const SearchScheduledShiftsResponse: core.serialization.ObjectSchema< - serializers.SearchScheduledShiftsResponse.Raw, - Square.SearchScheduledShiftsResponse -> = core.serialization.object({ - scheduledShifts: core.serialization.property( - "scheduled_shifts", - core.serialization.list(ScheduledShift).optional(), - ), - cursor: core.serialization.string().optional(), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace SearchScheduledShiftsResponse { - export interface Raw { - scheduled_shifts?: ScheduledShift.Raw[] | null; - cursor?: string | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/SearchShiftsResponse.ts b/src/serialization/types/SearchShiftsResponse.ts deleted file mode 100644 index dfa97e639..000000000 --- a/src/serialization/types/SearchShiftsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index aaae83cad..000000000 --- a/src/serialization/types/SearchSubscriptionsFilter.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4a85e5009..000000000 --- a/src/serialization/types/SearchSubscriptionsQuery.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d223f1998..000000000 --- a/src/serialization/types/SearchSubscriptionsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d69ba09d6..000000000 --- a/src/serialization/types/SearchTeamMembersFilter.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 742fe9f15..000000000 --- a/src/serialization/types/SearchTeamMembersQuery.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e0f67291f..000000000 --- a/src/serialization/types/SearchTeamMembersResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3ee9cea3c..000000000 --- a/src/serialization/types/SearchTerminalActionsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 47691c7c8..000000000 --- a/src/serialization/types/SearchTerminalCheckoutsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cb7ed1e47..000000000 --- a/src/serialization/types/SearchTerminalRefundsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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/SearchTimecardsResponse.ts b/src/serialization/types/SearchTimecardsResponse.ts deleted file mode 100644 index 85bf7cdef..000000000 --- a/src/serialization/types/SearchTimecardsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Timecard } from "./Timecard"; -import { Error_ } from "./Error_"; - -export const SearchTimecardsResponse: core.serialization.ObjectSchema< - serializers.SearchTimecardsResponse.Raw, - Square.SearchTimecardsResponse -> = core.serialization.object({ - timecards: core.serialization.list(Timecard).optional(), - cursor: core.serialization.string().optional(), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace SearchTimecardsResponse { - export interface Raw { - timecards?: Timecard.Raw[] | null; - cursor?: string | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/SearchVendorsRequestFilter.ts b/src/serialization/types/SearchVendorsRequestFilter.ts deleted file mode 100644 index 1c68be2e6..000000000 --- a/src/serialization/types/SearchVendorsRequestFilter.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ced89af2d..000000000 --- a/src/serialization/types/SearchVendorsRequestSort.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 123d35513..000000000 --- a/src/serialization/types/SearchVendorsRequestSortField.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 520e5eb14..000000000 --- a/src/serialization/types/SearchVendorsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 2b990803b..000000000 --- a/src/serialization/types/SegmentFilter.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index eba451cac..000000000 --- a/src/serialization/types/SelectOption.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 077fa48ec..000000000 --- a/src/serialization/types/SelectOptions.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 57b048af6..000000000 --- a/src/serialization/types/Shift.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 25e469ef9..000000000 --- a/src/serialization/types/ShiftFilter.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e127b4470..000000000 --- a/src/serialization/types/ShiftFilterStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 28823f111..000000000 --- a/src/serialization/types/ShiftQuery.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 60d726363..000000000 --- a/src/serialization/types/ShiftSort.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 096579bad..000000000 --- a/src/serialization/types/ShiftSortField.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4cc8e7274..000000000 --- a/src/serialization/types/ShiftStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 71fc0893e..000000000 --- a/src/serialization/types/ShiftWage.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 883537a23..000000000 --- a/src/serialization/types/ShiftWorkday.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3db2c88b4..000000000 --- a/src/serialization/types/ShiftWorkdayMatcher.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index c47e302c7..000000000 --- a/src/serialization/types/ShippingFee.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 9ac87e967..000000000 --- a/src/serialization/types/SignatureImage.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4c6e23be4..000000000 --- a/src/serialization/types/SignatureOptions.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e464ae935..000000000 --- a/src/serialization/types/Site.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 09ca1c1a8..000000000 --- a/src/serialization/types/Snippet.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 4e735a24e..000000000 --- a/src/serialization/types/SortOrder.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ae209bc91..000000000 --- a/src/serialization/types/SourceApplication.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 0fe060eb8..000000000 --- a/src/serialization/types/SquareAccountDetails.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6a1bf19a5..000000000 --- a/src/serialization/types/StandardUnitDescription.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 583900eff..000000000 --- a/src/serialization/types/StandardUnitDescriptionGroup.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 424f1d059..000000000 --- a/src/serialization/types/SubmitEvidenceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index b72d3d9bd..000000000 --- a/src/serialization/types/Subscription.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 82deb1d64..000000000 --- a/src/serialization/types/SubscriptionAction.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6926eaf81..000000000 --- a/src/serialization/types/SubscriptionActionType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3554022c0..000000000 --- a/src/serialization/types/SubscriptionCadence.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-generated 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/SubscriptionCreatedEvent.ts b/src/serialization/types/SubscriptionCreatedEvent.ts deleted file mode 100644 index 2dac5674e..000000000 --- a/src/serialization/types/SubscriptionCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { SubscriptionCreatedEventData } from "./SubscriptionCreatedEventData"; - -export const SubscriptionCreatedEvent: core.serialization.ObjectSchema< - serializers.SubscriptionCreatedEvent.Raw, - Square.SubscriptionCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: SubscriptionCreatedEventData.optional(), -}); - -export declare namespace SubscriptionCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: SubscriptionCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/SubscriptionCreatedEventData.ts b/src/serialization/types/SubscriptionCreatedEventData.ts deleted file mode 100644 index c382b55f0..000000000 --- a/src/serialization/types/SubscriptionCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { SubscriptionCreatedEventObject } from "./SubscriptionCreatedEventObject"; - -export const SubscriptionCreatedEventData: core.serialization.ObjectSchema< - serializers.SubscriptionCreatedEventData.Raw, - Square.SubscriptionCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: SubscriptionCreatedEventObject.optional(), -}); - -export declare namespace SubscriptionCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: SubscriptionCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/SubscriptionCreatedEventObject.ts b/src/serialization/types/SubscriptionCreatedEventObject.ts deleted file mode 100644 index a1e2eed63..000000000 --- a/src/serialization/types/SubscriptionCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./Subscription"; - -export const SubscriptionCreatedEventObject: core.serialization.ObjectSchema< - serializers.SubscriptionCreatedEventObject.Raw, - Square.SubscriptionCreatedEventObject -> = core.serialization.object({ - subscription: Subscription.optional(), -}); - -export declare namespace SubscriptionCreatedEventObject { - export interface Raw { - subscription?: Subscription.Raw | null; - } -} diff --git a/src/serialization/types/SubscriptionEvent.ts b/src/serialization/types/SubscriptionEvent.ts deleted file mode 100644 index 94071625b..000000000 --- a/src/serialization/types/SubscriptionEvent.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1213901c6..000000000 --- a/src/serialization/types/SubscriptionEventInfo.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e435d9eb3..000000000 --- a/src/serialization/types/SubscriptionEventInfoCode.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 62b7fc660..000000000 --- a/src/serialization/types/SubscriptionEventSubscriptionEventType.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 3bb6e311f..000000000 --- a/src/serialization/types/SubscriptionPhase.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6fa511e8c..000000000 --- a/src/serialization/types/SubscriptionPricing.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e9f81a66d..000000000 --- a/src/serialization/types/SubscriptionPricingType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 9024e0fb7..000000000 --- a/src/serialization/types/SubscriptionSource.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b7b49f13c..000000000 --- a/src/serialization/types/SubscriptionStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 48676804e..000000000 --- a/src/serialization/types/SubscriptionTestResult.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated 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/SubscriptionUpdatedEvent.ts b/src/serialization/types/SubscriptionUpdatedEvent.ts deleted file mode 100644 index 2a83a0412..000000000 --- a/src/serialization/types/SubscriptionUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { SubscriptionUpdatedEventData } from "./SubscriptionUpdatedEventData"; - -export const SubscriptionUpdatedEvent: core.serialization.ObjectSchema< - serializers.SubscriptionUpdatedEvent.Raw, - Square.SubscriptionUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: SubscriptionUpdatedEventData.optional(), -}); - -export declare namespace SubscriptionUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: SubscriptionUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/SubscriptionUpdatedEventData.ts b/src/serialization/types/SubscriptionUpdatedEventData.ts deleted file mode 100644 index cfef2da95..000000000 --- a/src/serialization/types/SubscriptionUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { SubscriptionUpdatedEventObject } from "./SubscriptionUpdatedEventObject"; - -export const SubscriptionUpdatedEventData: core.serialization.ObjectSchema< - serializers.SubscriptionUpdatedEventData.Raw, - Square.SubscriptionUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: SubscriptionUpdatedEventObject.optional(), -}); - -export declare namespace SubscriptionUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: SubscriptionUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/SubscriptionUpdatedEventObject.ts b/src/serialization/types/SubscriptionUpdatedEventObject.ts deleted file mode 100644 index 54055b67a..000000000 --- a/src/serialization/types/SubscriptionUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./Subscription"; - -export const SubscriptionUpdatedEventObject: core.serialization.ObjectSchema< - serializers.SubscriptionUpdatedEventObject.Raw, - Square.SubscriptionUpdatedEventObject -> = core.serialization.object({ - subscription: Subscription.optional(), -}); - -export declare namespace SubscriptionUpdatedEventObject { - export interface Raw { - subscription?: Subscription.Raw | null; - } -} diff --git a/src/serialization/types/SwapPlanResponse.ts b/src/serialization/types/SwapPlanResponse.ts deleted file mode 100644 index dd9d5c3e6..000000000 --- a/src/serialization/types/SwapPlanResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5f58c7c01..000000000 --- a/src/serialization/types/TaxCalculationPhase.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 6ac0e13c6..000000000 --- a/src/serialization/types/TaxIds.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b48dcfa51..000000000 --- a/src/serialization/types/TaxInclusionType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e3f666d99..000000000 --- a/src/serialization/types/TeamMember.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3e8b93c5b..000000000 --- a/src/serialization/types/TeamMemberAssignedLocations.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 97bbc383f..000000000 --- a/src/serialization/types/TeamMemberAssignedLocationsAssignmentType.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 584f4029d..000000000 --- a/src/serialization/types/TeamMemberBookingProfile.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated 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/TeamMemberCreatedEvent.ts b/src/serialization/types/TeamMemberCreatedEvent.ts deleted file mode 100644 index 07c26512d..000000000 --- a/src/serialization/types/TeamMemberCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TeamMemberCreatedEventData } from "./TeamMemberCreatedEventData"; - -export const TeamMemberCreatedEvent: core.serialization.ObjectSchema< - serializers.TeamMemberCreatedEvent.Raw, - Square.TeamMemberCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TeamMemberCreatedEventData.optional(), -}); - -export declare namespace TeamMemberCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TeamMemberCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberCreatedEventData.ts b/src/serialization/types/TeamMemberCreatedEventData.ts deleted file mode 100644 index 2a37cc4b5..000000000 --- a/src/serialization/types/TeamMemberCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TeamMemberCreatedEventObject } from "./TeamMemberCreatedEventObject"; - -export const TeamMemberCreatedEventData: core.serialization.ObjectSchema< - serializers.TeamMemberCreatedEventData.Raw, - Square.TeamMemberCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TeamMemberCreatedEventObject.optional(), -}); - -export declare namespace TeamMemberCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TeamMemberCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberCreatedEventObject.ts b/src/serialization/types/TeamMemberCreatedEventObject.ts deleted file mode 100644 index a70f94441..000000000 --- a/src/serialization/types/TeamMemberCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 TeamMemberCreatedEventObject: core.serialization.ObjectSchema< - serializers.TeamMemberCreatedEventObject.Raw, - Square.TeamMemberCreatedEventObject -> = core.serialization.object({ - teamMember: core.serialization.property("team_member", TeamMember.optional()), -}); - -export declare namespace TeamMemberCreatedEventObject { - export interface Raw { - team_member?: TeamMember.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberInvitationStatus.ts b/src/serialization/types/TeamMemberInvitationStatus.ts deleted file mode 100644 index 4239af1bd..000000000 --- a/src/serialization/types/TeamMemberInvitationStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const TeamMemberInvitationStatus: core.serialization.Schema< - serializers.TeamMemberInvitationStatus.Raw, - Square.TeamMemberInvitationStatus -> = core.serialization.enum_(["UNINVITED", "PENDING", "ACCEPTED"]); - -export declare namespace TeamMemberInvitationStatus { - export type Raw = "UNINVITED" | "PENDING" | "ACCEPTED"; -} diff --git a/src/serialization/types/TeamMemberStatus.ts b/src/serialization/types/TeamMemberStatus.ts deleted file mode 100644 index 417fd5c05..000000000 --- a/src/serialization/types/TeamMemberStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/TeamMemberUpdatedEvent.ts b/src/serialization/types/TeamMemberUpdatedEvent.ts deleted file mode 100644 index e3b71a51d..000000000 --- a/src/serialization/types/TeamMemberUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TeamMemberUpdatedEventData } from "./TeamMemberUpdatedEventData"; - -export const TeamMemberUpdatedEvent: core.serialization.ObjectSchema< - serializers.TeamMemberUpdatedEvent.Raw, - Square.TeamMemberUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TeamMemberUpdatedEventData.optional(), -}); - -export declare namespace TeamMemberUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TeamMemberUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberUpdatedEventData.ts b/src/serialization/types/TeamMemberUpdatedEventData.ts deleted file mode 100644 index fa9441cbf..000000000 --- a/src/serialization/types/TeamMemberUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TeamMemberUpdatedEventObject } from "./TeamMemberUpdatedEventObject"; - -export const TeamMemberUpdatedEventData: core.serialization.ObjectSchema< - serializers.TeamMemberUpdatedEventData.Raw, - Square.TeamMemberUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TeamMemberUpdatedEventObject.optional(), -}); - -export declare namespace TeamMemberUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TeamMemberUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberUpdatedEventObject.ts b/src/serialization/types/TeamMemberUpdatedEventObject.ts deleted file mode 100644 index 3f32f568d..000000000 --- a/src/serialization/types/TeamMemberUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 TeamMemberUpdatedEventObject: core.serialization.ObjectSchema< - serializers.TeamMemberUpdatedEventObject.Raw, - Square.TeamMemberUpdatedEventObject -> = core.serialization.object({ - teamMember: core.serialization.property("team_member", TeamMember.optional()), -}); - -export declare namespace TeamMemberUpdatedEventObject { - export interface Raw { - team_member?: TeamMember.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberWage.ts b/src/serialization/types/TeamMemberWage.ts deleted file mode 100644 index c79f7fa98..000000000 --- a/src/serialization/types/TeamMemberWage.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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/TeamMemberWageSettingUpdatedEvent.ts b/src/serialization/types/TeamMemberWageSettingUpdatedEvent.ts deleted file mode 100644 index db5c5fffb..000000000 --- a/src/serialization/types/TeamMemberWageSettingUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TeamMemberWageSettingUpdatedEventData } from "./TeamMemberWageSettingUpdatedEventData"; - -export const TeamMemberWageSettingUpdatedEvent: core.serialization.ObjectSchema< - serializers.TeamMemberWageSettingUpdatedEvent.Raw, - Square.TeamMemberWageSettingUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TeamMemberWageSettingUpdatedEventData.optional(), -}); - -export declare namespace TeamMemberWageSettingUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TeamMemberWageSettingUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberWageSettingUpdatedEventData.ts b/src/serialization/types/TeamMemberWageSettingUpdatedEventData.ts deleted file mode 100644 index 1f53e9457..000000000 --- a/src/serialization/types/TeamMemberWageSettingUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TeamMemberWageSettingUpdatedEventObject } from "./TeamMemberWageSettingUpdatedEventObject"; - -export const TeamMemberWageSettingUpdatedEventData: core.serialization.ObjectSchema< - serializers.TeamMemberWageSettingUpdatedEventData.Raw, - Square.TeamMemberWageSettingUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TeamMemberWageSettingUpdatedEventObject.optional(), -}); - -export declare namespace TeamMemberWageSettingUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TeamMemberWageSettingUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TeamMemberWageSettingUpdatedEventObject.ts b/src/serialization/types/TeamMemberWageSettingUpdatedEventObject.ts deleted file mode 100644 index 64044a0f7..000000000 --- a/src/serialization/types/TeamMemberWageSettingUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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"; - -export const TeamMemberWageSettingUpdatedEventObject: core.serialization.ObjectSchema< - serializers.TeamMemberWageSettingUpdatedEventObject.Raw, - Square.TeamMemberWageSettingUpdatedEventObject -> = core.serialization.object({ - wageSetting: core.serialization.property("wage_setting", WageSetting.optional()), -}); - -export declare namespace TeamMemberWageSettingUpdatedEventObject { - export interface Raw { - wage_setting?: WageSetting.Raw | null; - } -} diff --git a/src/serialization/types/Tender.ts b/src/serialization/types/Tender.ts deleted file mode 100644 index c30875d12..000000000 --- a/src/serialization/types/Tender.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 1d3f14ded..000000000 --- a/src/serialization/types/TenderBankAccountDetails.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5b554fbff..000000000 --- a/src/serialization/types/TenderBankAccountDetailsStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index b3ef06e94..000000000 --- a/src/serialization/types/TenderBuyNowPayLaterDetails.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 95ccb3e4d..000000000 --- a/src/serialization/types/TenderBuyNowPayLaterDetailsBrand.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 89dfff83e..000000000 --- a/src/serialization/types/TenderBuyNowPayLaterDetailsStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 2a9b53e02..000000000 --- a/src/serialization/types/TenderCardDetails.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e03397c18..000000000 --- a/src/serialization/types/TenderCardDetailsEntryMethod.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 994ea1c25..000000000 --- a/src/serialization/types/TenderCardDetailsStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 555c8f3a1..000000000 --- a/src/serialization/types/TenderCashDetails.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 703528170..000000000 --- a/src/serialization/types/TenderSquareAccountDetails.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 79af0af04..000000000 --- a/src/serialization/types/TenderSquareAccountDetailsStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 430fde4a6..000000000 --- a/src/serialization/types/TenderType.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index cd94a74c5..000000000 --- a/src/serialization/types/TerminalAction.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c8dd2cea8..000000000 --- a/src/serialization/types/TerminalActionActionType.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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/TerminalActionCreatedEvent.ts b/src/serialization/types/TerminalActionCreatedEvent.ts deleted file mode 100644 index 87efdb7f1..000000000 --- a/src/serialization/types/TerminalActionCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalActionCreatedEventData } from "./TerminalActionCreatedEventData"; - -export const TerminalActionCreatedEvent: core.serialization.ObjectSchema< - serializers.TerminalActionCreatedEvent.Raw, - Square.TerminalActionCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TerminalActionCreatedEventData.optional(), -}); - -export declare namespace TerminalActionCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TerminalActionCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TerminalActionCreatedEventData.ts b/src/serialization/types/TerminalActionCreatedEventData.ts deleted file mode 100644 index 54da6c3c3..000000000 --- a/src/serialization/types/TerminalActionCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalActionCreatedEventObject } from "./TerminalActionCreatedEventObject"; - -export const TerminalActionCreatedEventData: core.serialization.ObjectSchema< - serializers.TerminalActionCreatedEventData.Raw, - Square.TerminalActionCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TerminalActionCreatedEventObject.optional(), -}); - -export declare namespace TerminalActionCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TerminalActionCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TerminalActionCreatedEventObject.ts b/src/serialization/types/TerminalActionCreatedEventObject.ts deleted file mode 100644 index b3d30073c..000000000 --- a/src/serialization/types/TerminalActionCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./TerminalAction"; - -export const TerminalActionCreatedEventObject: core.serialization.ObjectSchema< - serializers.TerminalActionCreatedEventObject.Raw, - Square.TerminalActionCreatedEventObject -> = core.serialization.object({ - action: TerminalAction.optional(), -}); - -export declare namespace TerminalActionCreatedEventObject { - export interface Raw { - action?: TerminalAction.Raw | null; - } -} diff --git a/src/serialization/types/TerminalActionQuery.ts b/src/serialization/types/TerminalActionQuery.ts deleted file mode 100644 index c6d8edfb9..000000000 --- a/src/serialization/types/TerminalActionQuery.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a7a4fc640..000000000 --- a/src/serialization/types/TerminalActionQueryFilter.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a42b30172..000000000 --- a/src/serialization/types/TerminalActionQuerySort.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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/TerminalActionUpdatedEvent.ts b/src/serialization/types/TerminalActionUpdatedEvent.ts deleted file mode 100644 index 639334382..000000000 --- a/src/serialization/types/TerminalActionUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalActionUpdatedEventData } from "./TerminalActionUpdatedEventData"; - -export const TerminalActionUpdatedEvent: core.serialization.ObjectSchema< - serializers.TerminalActionUpdatedEvent.Raw, - Square.TerminalActionUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TerminalActionUpdatedEventData.optional(), -}); - -export declare namespace TerminalActionUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TerminalActionUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TerminalActionUpdatedEventData.ts b/src/serialization/types/TerminalActionUpdatedEventData.ts deleted file mode 100644 index 7df971d31..000000000 --- a/src/serialization/types/TerminalActionUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalActionUpdatedEventObject } from "./TerminalActionUpdatedEventObject"; - -export const TerminalActionUpdatedEventData: core.serialization.ObjectSchema< - serializers.TerminalActionUpdatedEventData.Raw, - Square.TerminalActionUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TerminalActionUpdatedEventObject.optional(), -}); - -export declare namespace TerminalActionUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TerminalActionUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TerminalActionUpdatedEventObject.ts b/src/serialization/types/TerminalActionUpdatedEventObject.ts deleted file mode 100644 index 27a3f6e2d..000000000 --- a/src/serialization/types/TerminalActionUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./TerminalAction"; - -export const TerminalActionUpdatedEventObject: core.serialization.ObjectSchema< - serializers.TerminalActionUpdatedEventObject.Raw, - Square.TerminalActionUpdatedEventObject -> = core.serialization.object({ - action: TerminalAction.optional(), -}); - -export declare namespace TerminalActionUpdatedEventObject { - export interface Raw { - action?: TerminalAction.Raw | null; - } -} diff --git a/src/serialization/types/TerminalCheckout.ts b/src/serialization/types/TerminalCheckout.ts deleted file mode 100644 index 995a2052c..000000000 --- a/src/serialization/types/TerminalCheckout.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * This file was auto-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/TerminalCheckoutCreatedEvent.ts b/src/serialization/types/TerminalCheckoutCreatedEvent.ts deleted file mode 100644 index 4917812d3..000000000 --- a/src/serialization/types/TerminalCheckoutCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalCheckoutCreatedEventData } from "./TerminalCheckoutCreatedEventData"; - -export const TerminalCheckoutCreatedEvent: core.serialization.ObjectSchema< - serializers.TerminalCheckoutCreatedEvent.Raw, - Square.TerminalCheckoutCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TerminalCheckoutCreatedEventData.optional(), -}); - -export declare namespace TerminalCheckoutCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TerminalCheckoutCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TerminalCheckoutCreatedEventData.ts b/src/serialization/types/TerminalCheckoutCreatedEventData.ts deleted file mode 100644 index 5032927b1..000000000 --- a/src/serialization/types/TerminalCheckoutCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalCheckoutCreatedEventObject } from "./TerminalCheckoutCreatedEventObject"; - -export const TerminalCheckoutCreatedEventData: core.serialization.ObjectSchema< - serializers.TerminalCheckoutCreatedEventData.Raw, - Square.TerminalCheckoutCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TerminalCheckoutCreatedEventObject.optional(), -}); - -export declare namespace TerminalCheckoutCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TerminalCheckoutCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TerminalCheckoutCreatedEventObject.ts b/src/serialization/types/TerminalCheckoutCreatedEventObject.ts deleted file mode 100644 index 0bb00b6e7..000000000 --- a/src/serialization/types/TerminalCheckoutCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./TerminalCheckout"; - -export const TerminalCheckoutCreatedEventObject: core.serialization.ObjectSchema< - serializers.TerminalCheckoutCreatedEventObject.Raw, - Square.TerminalCheckoutCreatedEventObject -> = core.serialization.object({ - checkout: TerminalCheckout.optional(), -}); - -export declare namespace TerminalCheckoutCreatedEventObject { - export interface Raw { - checkout?: TerminalCheckout.Raw | null; - } -} diff --git a/src/serialization/types/TerminalCheckoutQuery.ts b/src/serialization/types/TerminalCheckoutQuery.ts deleted file mode 100644 index 129088d2e..000000000 --- a/src/serialization/types/TerminalCheckoutQuery.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 4b79c98e7..000000000 --- a/src/serialization/types/TerminalCheckoutQueryFilter.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 31c4738f9..000000000 --- a/src/serialization/types/TerminalCheckoutQuerySort.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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/TerminalCheckoutUpdatedEvent.ts b/src/serialization/types/TerminalCheckoutUpdatedEvent.ts deleted file mode 100644 index 55aca6715..000000000 --- a/src/serialization/types/TerminalCheckoutUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalCheckoutUpdatedEventData } from "./TerminalCheckoutUpdatedEventData"; - -export const TerminalCheckoutUpdatedEvent: core.serialization.ObjectSchema< - serializers.TerminalCheckoutUpdatedEvent.Raw, - Square.TerminalCheckoutUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TerminalCheckoutUpdatedEventData.optional(), -}); - -export declare namespace TerminalCheckoutUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TerminalCheckoutUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TerminalCheckoutUpdatedEventData.ts b/src/serialization/types/TerminalCheckoutUpdatedEventData.ts deleted file mode 100644 index 3481fd0a8..000000000 --- a/src/serialization/types/TerminalCheckoutUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalCheckoutUpdatedEventObject } from "./TerminalCheckoutUpdatedEventObject"; - -export const TerminalCheckoutUpdatedEventData: core.serialization.ObjectSchema< - serializers.TerminalCheckoutUpdatedEventData.Raw, - Square.TerminalCheckoutUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TerminalCheckoutUpdatedEventObject.optional(), -}); - -export declare namespace TerminalCheckoutUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TerminalCheckoutUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TerminalCheckoutUpdatedEventObject.ts b/src/serialization/types/TerminalCheckoutUpdatedEventObject.ts deleted file mode 100644 index 776f45bf3..000000000 --- a/src/serialization/types/TerminalCheckoutUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./TerminalCheckout"; - -export const TerminalCheckoutUpdatedEventObject: core.serialization.ObjectSchema< - serializers.TerminalCheckoutUpdatedEventObject.Raw, - Square.TerminalCheckoutUpdatedEventObject -> = core.serialization.object({ - checkout: TerminalCheckout.optional(), -}); - -export declare namespace TerminalCheckoutUpdatedEventObject { - export interface Raw { - checkout?: TerminalCheckout.Raw | null; - } -} diff --git a/src/serialization/types/TerminalRefund.ts b/src/serialization/types/TerminalRefund.ts deleted file mode 100644 index 378ce0eb7..000000000 --- a/src/serialization/types/TerminalRefund.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * This file was auto-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/TerminalRefundCreatedEvent.ts b/src/serialization/types/TerminalRefundCreatedEvent.ts deleted file mode 100644 index ab2cd1d99..000000000 --- a/src/serialization/types/TerminalRefundCreatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalRefundCreatedEventData } from "./TerminalRefundCreatedEventData"; - -export const TerminalRefundCreatedEvent: core.serialization.ObjectSchema< - serializers.TerminalRefundCreatedEvent.Raw, - Square.TerminalRefundCreatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TerminalRefundCreatedEventData.optional(), -}); - -export declare namespace TerminalRefundCreatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TerminalRefundCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TerminalRefundCreatedEventData.ts b/src/serialization/types/TerminalRefundCreatedEventData.ts deleted file mode 100644 index be8fdfc75..000000000 --- a/src/serialization/types/TerminalRefundCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalRefundCreatedEventObject } from "./TerminalRefundCreatedEventObject"; - -export const TerminalRefundCreatedEventData: core.serialization.ObjectSchema< - serializers.TerminalRefundCreatedEventData.Raw, - Square.TerminalRefundCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TerminalRefundCreatedEventObject.optional(), -}); - -export declare namespace TerminalRefundCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TerminalRefundCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TerminalRefundCreatedEventObject.ts b/src/serialization/types/TerminalRefundCreatedEventObject.ts deleted file mode 100644 index 02e35f1fa..000000000 --- a/src/serialization/types/TerminalRefundCreatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./TerminalRefund"; - -export const TerminalRefundCreatedEventObject: core.serialization.ObjectSchema< - serializers.TerminalRefundCreatedEventObject.Raw, - Square.TerminalRefundCreatedEventObject -> = core.serialization.object({ - refund: TerminalRefund.optional(), -}); - -export declare namespace TerminalRefundCreatedEventObject { - export interface Raw { - refund?: TerminalRefund.Raw | null; - } -} diff --git a/src/serialization/types/TerminalRefundQuery.ts b/src/serialization/types/TerminalRefundQuery.ts deleted file mode 100644 index 40119b8ed..000000000 --- a/src/serialization/types/TerminalRefundQuery.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c8ff1d3a9..000000000 --- a/src/serialization/types/TerminalRefundQueryFilter.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5a9eacc0b..000000000 --- a/src/serialization/types/TerminalRefundQuerySort.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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/TerminalRefundUpdatedEvent.ts b/src/serialization/types/TerminalRefundUpdatedEvent.ts deleted file mode 100644 index cc5994403..000000000 --- a/src/serialization/types/TerminalRefundUpdatedEvent.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalRefundUpdatedEventData } from "./TerminalRefundUpdatedEventData"; - -export const TerminalRefundUpdatedEvent: core.serialization.ObjectSchema< - serializers.TerminalRefundUpdatedEvent.Raw, - Square.TerminalRefundUpdatedEvent -> = core.serialization.object({ - merchantId: core.serialization.property("merchant_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: TerminalRefundUpdatedEventData.optional(), -}); - -export declare namespace TerminalRefundUpdatedEvent { - export interface Raw { - merchant_id?: (string | null) | null; - type?: (string | null) | null; - event_id?: (string | null) | null; - created_at?: string | null; - data?: TerminalRefundUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/TerminalRefundUpdatedEventData.ts b/src/serialization/types/TerminalRefundUpdatedEventData.ts deleted file mode 100644 index 86349c240..000000000 --- a/src/serialization/types/TerminalRefundUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TerminalRefundUpdatedEventObject } from "./TerminalRefundUpdatedEventObject"; - -export const TerminalRefundUpdatedEventData: core.serialization.ObjectSchema< - serializers.TerminalRefundUpdatedEventData.Raw, - Square.TerminalRefundUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: TerminalRefundUpdatedEventObject.optional(), -}); - -export declare namespace TerminalRefundUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: TerminalRefundUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/TerminalRefundUpdatedEventObject.ts b/src/serialization/types/TerminalRefundUpdatedEventObject.ts deleted file mode 100644 index 955dbdb16..000000000 --- a/src/serialization/types/TerminalRefundUpdatedEventObject.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 "./TerminalRefund"; - -export const TerminalRefundUpdatedEventObject: core.serialization.ObjectSchema< - serializers.TerminalRefundUpdatedEventObject.Raw, - Square.TerminalRefundUpdatedEventObject -> = core.serialization.object({ - refund: TerminalRefund.optional(), -}); - -export declare namespace TerminalRefundUpdatedEventObject { - export interface Raw { - refund?: TerminalRefund.Raw | null; - } -} diff --git a/src/serialization/types/TestWebhookSubscriptionResponse.ts b/src/serialization/types/TestWebhookSubscriptionResponse.ts deleted file mode 100644 index d768ff030..000000000 --- a/src/serialization/types/TestWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 28845f302..000000000 --- a/src/serialization/types/TimeRange.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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/Timecard.ts b/src/serialization/types/Timecard.ts deleted file mode 100644 index 85f57ff7c..000000000 --- a/src/serialization/types/Timecard.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TimecardWage } from "./TimecardWage"; -import { Break } from "./Break"; -import { TimecardStatus } from "./TimecardStatus"; -import { Money } from "./Money"; - -export const Timecard: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string().optional(), - 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: TimecardWage.optional(), - breaks: core.serialization.list(Break).optionalNullable(), - status: TimecardStatus.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()), - declaredCashTipMoney: core.serialization.property("declared_cash_tip_money", Money.optional()), - }); - -export declare namespace Timecard { - export interface Raw { - id?: string | null; - location_id: string; - timezone?: (string | null) | null; - start_at: string; - end_at?: (string | null) | null; - wage?: TimecardWage.Raw | null; - breaks?: (Break.Raw[] | null) | null; - status?: TimecardStatus.Raw | null; - version?: number | null; - created_at?: string | null; - updated_at?: string | null; - team_member_id: string; - declared_cash_tip_money?: Money.Raw | null; - } -} diff --git a/src/serialization/types/TimecardFilter.ts b/src/serialization/types/TimecardFilter.ts deleted file mode 100644 index f2b671f08..000000000 --- a/src/serialization/types/TimecardFilter.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TimecardFilterStatus } from "./TimecardFilterStatus"; -import { TimeRange } from "./TimeRange"; -import { TimecardWorkday } from "./TimecardWorkday"; - -export const TimecardFilter: core.serialization.ObjectSchema = - core.serialization.object({ - locationIds: core.serialization.property( - "location_ids", - core.serialization.list(core.serialization.string()).optionalNullable(), - ), - status: TimecardFilterStatus.optional(), - start: TimeRange.optional(), - end: TimeRange.optional(), - workday: TimecardWorkday.optional(), - teamMemberIds: core.serialization.property( - "team_member_ids", - core.serialization.list(core.serialization.string()).optionalNullable(), - ), - }); - -export declare namespace TimecardFilter { - export interface Raw { - location_ids?: (string[] | null) | null; - status?: TimecardFilterStatus.Raw | null; - start?: TimeRange.Raw | null; - end?: TimeRange.Raw | null; - workday?: TimecardWorkday.Raw | null; - team_member_ids?: (string[] | null) | null; - } -} diff --git a/src/serialization/types/TimecardFilterStatus.ts b/src/serialization/types/TimecardFilterStatus.ts deleted file mode 100644 index 5600dbd7b..000000000 --- a/src/serialization/types/TimecardFilterStatus.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const TimecardFilterStatus: core.serialization.Schema< - serializers.TimecardFilterStatus.Raw, - Square.TimecardFilterStatus -> = core.serialization.enum_(["OPEN", "CLOSED"]); - -export declare namespace TimecardFilterStatus { - export type Raw = "OPEN" | "CLOSED"; -} diff --git a/src/serialization/types/TimecardQuery.ts b/src/serialization/types/TimecardQuery.ts deleted file mode 100644 index 110135e05..000000000 --- a/src/serialization/types/TimecardQuery.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TimecardFilter } from "./TimecardFilter"; -import { TimecardSort } from "./TimecardSort"; - -export const TimecardQuery: core.serialization.ObjectSchema = - core.serialization.object({ - filter: TimecardFilter.optional(), - sort: TimecardSort.optional(), - }); - -export declare namespace TimecardQuery { - export interface Raw { - filter?: TimecardFilter.Raw | null; - sort?: TimecardSort.Raw | null; - } -} diff --git a/src/serialization/types/TimecardSort.ts b/src/serialization/types/TimecardSort.ts deleted file mode 100644 index a19e3ce3b..000000000 --- a/src/serialization/types/TimecardSort.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { TimecardSortField } from "./TimecardSortField"; -import { SortOrder } from "./SortOrder"; - -export const TimecardSort: core.serialization.ObjectSchema = - core.serialization.object({ - field: TimecardSortField.optional(), - order: SortOrder.optional(), - }); - -export declare namespace TimecardSort { - export interface Raw { - field?: TimecardSortField.Raw | null; - order?: SortOrder.Raw | null; - } -} diff --git a/src/serialization/types/TimecardSortField.ts b/src/serialization/types/TimecardSortField.ts deleted file mode 100644 index 44306fb9e..000000000 --- a/src/serialization/types/TimecardSortField.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const TimecardSortField: core.serialization.Schema = - core.serialization.enum_(["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"]); - -export declare namespace TimecardSortField { - export type Raw = "START_AT" | "END_AT" | "CREATED_AT" | "UPDATED_AT"; -} diff --git a/src/serialization/types/TimecardStatus.ts b/src/serialization/types/TimecardStatus.ts deleted file mode 100644 index 4dc25427d..000000000 --- a/src/serialization/types/TimecardStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const TimecardStatus: core.serialization.Schema = - core.serialization.enum_(["OPEN", "CLOSED"]); - -export declare namespace TimecardStatus { - export type Raw = "OPEN" | "CLOSED"; -} diff --git a/src/serialization/types/TimecardWage.ts b/src/serialization/types/TimecardWage.ts deleted file mode 100644 index cd525d907..000000000 --- a/src/serialization/types/TimecardWage.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-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 TimecardWage: 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 TimecardWage { - 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/TimecardWorkday.ts b/src/serialization/types/TimecardWorkday.ts deleted file mode 100644 index 4f6f88183..000000000 --- a/src/serialization/types/TimecardWorkday.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 { TimecardWorkdayMatcher } from "./TimecardWorkdayMatcher"; - -export const TimecardWorkday: core.serialization.ObjectSchema = - core.serialization.object({ - dateRange: core.serialization.property("date_range", DateRange.optional()), - matchTimecardsBy: core.serialization.property("match_timecards_by", TimecardWorkdayMatcher.optional()), - defaultTimezone: core.serialization.property( - "default_timezone", - core.serialization.string().optionalNullable(), - ), - }); - -export declare namespace TimecardWorkday { - export interface Raw { - date_range?: DateRange.Raw | null; - match_timecards_by?: TimecardWorkdayMatcher.Raw | null; - default_timezone?: (string | null) | null; - } -} diff --git a/src/serialization/types/TimecardWorkdayMatcher.ts b/src/serialization/types/TimecardWorkdayMatcher.ts deleted file mode 100644 index fce87aebf..000000000 --- a/src/serialization/types/TimecardWorkdayMatcher.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const TimecardWorkdayMatcher: core.serialization.Schema< - serializers.TimecardWorkdayMatcher.Raw, - Square.TimecardWorkdayMatcher -> = core.serialization.enum_(["START_AT", "END_AT", "INTERSECTION"]); - -export declare namespace TimecardWorkdayMatcher { - export type Raw = "START_AT" | "END_AT" | "INTERSECTION"; -} diff --git a/src/serialization/types/TipSettings.ts b/src/serialization/types/TipSettings.ts deleted file mode 100644 index 681b122fa..000000000 --- a/src/serialization/types/TipSettings.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e2dea2b54..000000000 --- a/src/serialization/types/Transaction.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 681f59456..000000000 --- a/src/serialization/types/TransactionProduct.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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/TransactionType.ts b/src/serialization/types/TransactionType.ts deleted file mode 100644 index 6c3917ad2..000000000 --- a/src/serialization/types/TransactionType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const TransactionType: core.serialization.Schema = - core.serialization.enum_(["DEBIT", "CREDIT"]); - -export declare namespace TransactionType { - export type Raw = "DEBIT" | "CREDIT"; -} diff --git a/src/serialization/types/UnlinkCustomerFromGiftCardResponse.ts b/src/serialization/types/UnlinkCustomerFromGiftCardResponse.ts deleted file mode 100644 index 0314b5829..000000000 --- a/src/serialization/types/UnlinkCustomerFromGiftCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 06659cf5b..000000000 --- a/src/serialization/types/UpdateBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 864c93f81..000000000 --- a/src/serialization/types/UpdateBookingResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 28bd76133..000000000 --- a/src/serialization/types/UpdateBreakTypeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bab461bbd..000000000 --- a/src/serialization/types/UpdateCatalogImageRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e51a1c853..000000000 --- a/src/serialization/types/UpdateCatalogImageResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bff994b91..000000000 --- a/src/serialization/types/UpdateCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 01d38d9d3..000000000 --- a/src/serialization/types/UpdateCustomerGroupResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 8de103282..000000000 --- a/src/serialization/types/UpdateCustomerResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3de8309ef..000000000 --- a/src/serialization/types/UpdateInvoiceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 19e63ec7e..000000000 --- a/src/serialization/types/UpdateItemModifierListsResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 400178bb0..000000000 --- a/src/serialization/types/UpdateItemTaxesResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 43ad59fa7..000000000 --- a/src/serialization/types/UpdateJobResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 946412d40..000000000 --- a/src/serialization/types/UpdateLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 36409929b..000000000 --- a/src/serialization/types/UpdateLocationResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 25467d2b6..000000000 --- a/src/serialization/types/UpdateLocationSettingsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 747cc108f..000000000 --- a/src/serialization/types/UpdateMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index e474798e0..000000000 --- a/src/serialization/types/UpdateMerchantSettingsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5054f4374..000000000 --- a/src/serialization/types/UpdateOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3d8fc8385..000000000 --- a/src/serialization/types/UpdateOrderResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a8e948ea5..000000000 --- a/src/serialization/types/UpdatePaymentLinkResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a5c33178b..000000000 --- a/src/serialization/types/UpdatePaymentResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/UpdateScheduledShiftResponse.ts b/src/serialization/types/UpdateScheduledShiftResponse.ts deleted file mode 100644 index 39117500c..000000000 --- a/src/serialization/types/UpdateScheduledShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { ScheduledShift } from "./ScheduledShift"; -import { Error_ } from "./Error_"; - -export const UpdateScheduledShiftResponse: core.serialization.ObjectSchema< - serializers.UpdateScheduledShiftResponse.Raw, - Square.UpdateScheduledShiftResponse -> = core.serialization.object({ - scheduledShift: core.serialization.property("scheduled_shift", ScheduledShift.optional()), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace UpdateScheduledShiftResponse { - export interface Raw { - scheduled_shift?: ScheduledShift.Raw | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/UpdateShiftResponse.ts b/src/serialization/types/UpdateShiftResponse.ts deleted file mode 100644 index fa63dd4eb..000000000 --- a/src/serialization/types/UpdateShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3e7bc8d78..000000000 --- a/src/serialization/types/UpdateSubscriptionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 90f379625..000000000 --- a/src/serialization/types/UpdateTeamMemberRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5be3fd748..000000000 --- a/src/serialization/types/UpdateTeamMemberResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/UpdateTimecardResponse.ts b/src/serialization/types/UpdateTimecardResponse.ts deleted file mode 100644 index 15c266e59..000000000 --- a/src/serialization/types/UpdateTimecardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { Timecard } from "./Timecard"; -import { Error_ } from "./Error_"; - -export const UpdateTimecardResponse: core.serialization.ObjectSchema< - serializers.UpdateTimecardResponse.Raw, - Square.UpdateTimecardResponse -> = core.serialization.object({ - timecard: Timecard.optional(), - errors: core.serialization.list(Error_).optional(), -}); - -export declare namespace UpdateTimecardResponse { - export interface Raw { - timecard?: Timecard.Raw | null; - errors?: Error_.Raw[] | null; - } -} diff --git a/src/serialization/types/UpdateVendorRequest.ts b/src/serialization/types/UpdateVendorRequest.ts deleted file mode 100644 index 1517797f5..000000000 --- a/src/serialization/types/UpdateVendorRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index ee6505e5e..000000000 --- a/src/serialization/types/UpdateVendorResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index c7c16b35a..000000000 --- a/src/serialization/types/UpdateWageSettingResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index a15ce6e6f..000000000 --- a/src/serialization/types/UpdateWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 38ac5a31e..000000000 --- a/src/serialization/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 552811bb0..000000000 --- a/src/serialization/types/UpdateWorkweekConfigResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 50e3aefaa..000000000 --- a/src/serialization/types/UpsertBookingCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3b4dced9c..000000000 --- a/src/serialization/types/UpsertCatalogObjectResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d6706a9fe..000000000 --- a/src/serialization/types/UpsertCustomerCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6d03388b9..000000000 --- a/src/serialization/types/UpsertLocationCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 05a72a090..000000000 --- a/src/serialization/types/UpsertMerchantCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 5710d512a..000000000 --- a/src/serialization/types/UpsertOrderCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 637152d31..000000000 --- a/src/serialization/types/UpsertSnippetResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-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/V1GetPaymentRequest.ts b/src/serialization/types/V1GetPaymentRequest.ts deleted file mode 100644 index eb93bfcb7..000000000 --- a/src/serialization/types/V1GetPaymentRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const V1GetPaymentRequest: core.serialization.Schema< - serializers.V1GetPaymentRequest.Raw, - Square.V1GetPaymentRequest -> = core.serialization.unknown(); - -export declare namespace V1GetPaymentRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/V1GetSettlementRequest.ts b/src/serialization/types/V1GetSettlementRequest.ts deleted file mode 100644 index 1d2d826ba..000000000 --- a/src/serialization/types/V1GetSettlementRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const V1GetSettlementRequest: core.serialization.Schema< - serializers.V1GetSettlementRequest.Raw, - Square.V1GetSettlementRequest -> = core.serialization.unknown(); - -export declare namespace V1GetSettlementRequest { - export type Raw = unknown; -} diff --git a/src/serialization/types/V1Money.ts b/src/serialization/types/V1Money.ts deleted file mode 100644 index f3b326f32..000000000 --- a/src/serialization/types/V1Money.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index df12320f3..000000000 --- a/src/serialization/types/V1Order.ts +++ /dev/null @@ -1,84 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 689dd52e0..000000000 --- a/src/serialization/types/V1OrderHistoryEntry.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index bf3e246b9..000000000 --- a/src/serialization/types/V1OrderHistoryEntryAction.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 5c9de8c61..000000000 --- a/src/serialization/types/V1OrderState.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index ad0144d56..000000000 --- a/src/serialization/types/V1Tender.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index d66f19db3..000000000 --- a/src/serialization/types/V1TenderCardBrand.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 86ee07d8e..000000000 --- a/src/serialization/types/V1TenderEntryMethod.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 838d697b5..000000000 --- a/src/serialization/types/V1TenderType.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 34636e4f1..000000000 --- a/src/serialization/types/V1UpdateOrderRequestAction.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index bc4e3d0ae..000000000 --- a/src/serialization/types/Vendor.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 3ff4ff0e3..000000000 --- a/src/serialization/types/VendorContact.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated 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/VendorCreatedEvent.ts b/src/serialization/types/VendorCreatedEvent.ts deleted file mode 100644 index 3ee66b617..000000000 --- a/src/serialization/types/VendorCreatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { VendorCreatedEventData } from "./VendorCreatedEventData"; - -export const VendorCreatedEvent: core.serialization.ObjectSchema< - serializers.VendorCreatedEvent.Raw, - Square.VendorCreatedEvent -> = 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: VendorCreatedEventData.optional(), -}); - -export declare namespace VendorCreatedEvent { - 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?: VendorCreatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/VendorCreatedEventData.ts b/src/serialization/types/VendorCreatedEventData.ts deleted file mode 100644 index 1866c0e4a..000000000 --- a/src/serialization/types/VendorCreatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { VendorCreatedEventObject } from "./VendorCreatedEventObject"; - -export const VendorCreatedEventData: core.serialization.ObjectSchema< - serializers.VendorCreatedEventData.Raw, - Square.VendorCreatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: VendorCreatedEventObject.optional(), -}); - -export declare namespace VendorCreatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: VendorCreatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/VendorCreatedEventObject.ts b/src/serialization/types/VendorCreatedEventObject.ts deleted file mode 100644 index b0bd438a7..000000000 --- a/src/serialization/types/VendorCreatedEventObject.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { VendorCreatedEventObjectOperation } from "./VendorCreatedEventObjectOperation"; -import { Vendor } from "./Vendor"; - -export const VendorCreatedEventObject: core.serialization.ObjectSchema< - serializers.VendorCreatedEventObject.Raw, - Square.VendorCreatedEventObject -> = core.serialization.object({ - operation: VendorCreatedEventObjectOperation.optional(), - vendor: Vendor.optional(), -}); - -export declare namespace VendorCreatedEventObject { - export interface Raw { - operation?: VendorCreatedEventObjectOperation.Raw | null; - vendor?: Vendor.Raw | null; - } -} diff --git a/src/serialization/types/VendorCreatedEventObjectOperation.ts b/src/serialization/types/VendorCreatedEventObjectOperation.ts deleted file mode 100644 index d42f7a6a0..000000000 --- a/src/serialization/types/VendorCreatedEventObjectOperation.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const VendorCreatedEventObjectOperation: core.serialization.Schema< - serializers.VendorCreatedEventObjectOperation.Raw, - Square.VendorCreatedEventObjectOperation -> = core.serialization.stringLiteral("CREATED"); - -export declare namespace VendorCreatedEventObjectOperation { - export type Raw = "CREATED"; -} diff --git a/src/serialization/types/VendorStatus.ts b/src/serialization/types/VendorStatus.ts deleted file mode 100644 index 11711db8e..000000000 --- a/src/serialization/types/VendorStatus.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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/VendorUpdatedEvent.ts b/src/serialization/types/VendorUpdatedEvent.ts deleted file mode 100644 index ad39c7951..000000000 --- a/src/serialization/types/VendorUpdatedEvent.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { VendorUpdatedEventData } from "./VendorUpdatedEventData"; - -export const VendorUpdatedEvent: core.serialization.ObjectSchema< - serializers.VendorUpdatedEvent.Raw, - Square.VendorUpdatedEvent -> = 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: VendorUpdatedEventData.optional(), -}); - -export declare namespace VendorUpdatedEvent { - 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?: VendorUpdatedEventData.Raw | null; - } -} diff --git a/src/serialization/types/VendorUpdatedEventData.ts b/src/serialization/types/VendorUpdatedEventData.ts deleted file mode 100644 index 708e7f3eb..000000000 --- a/src/serialization/types/VendorUpdatedEventData.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { VendorUpdatedEventObject } from "./VendorUpdatedEventObject"; - -export const VendorUpdatedEventData: core.serialization.ObjectSchema< - serializers.VendorUpdatedEventData.Raw, - Square.VendorUpdatedEventData -> = core.serialization.object({ - type: core.serialization.string().optionalNullable(), - id: core.serialization.string().optional(), - object: VendorUpdatedEventObject.optional(), -}); - -export declare namespace VendorUpdatedEventData { - export interface Raw { - type?: (string | null) | null; - id?: string | null; - object?: VendorUpdatedEventObject.Raw | null; - } -} diff --git a/src/serialization/types/VendorUpdatedEventObject.ts b/src/serialization/types/VendorUpdatedEventObject.ts deleted file mode 100644 index f3df0ba59..000000000 --- a/src/serialization/types/VendorUpdatedEventObject.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; -import { VendorUpdatedEventObjectOperation } from "./VendorUpdatedEventObjectOperation"; -import { Vendor } from "./Vendor"; - -export const VendorUpdatedEventObject: core.serialization.ObjectSchema< - serializers.VendorUpdatedEventObject.Raw, - Square.VendorUpdatedEventObject -> = core.serialization.object({ - operation: VendorUpdatedEventObjectOperation.optional(), - vendor: Vendor.optional(), -}); - -export declare namespace VendorUpdatedEventObject { - export interface Raw { - operation?: VendorUpdatedEventObjectOperation.Raw | null; - vendor?: Vendor.Raw | null; - } -} diff --git a/src/serialization/types/VendorUpdatedEventObjectOperation.ts b/src/serialization/types/VendorUpdatedEventObjectOperation.ts deleted file mode 100644 index cbe3a8cae..000000000 --- a/src/serialization/types/VendorUpdatedEventObjectOperation.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Square from "../../api/index"; -import * as core from "../../core"; - -export const VendorUpdatedEventObjectOperation: core.serialization.Schema< - serializers.VendorUpdatedEventObjectOperation.Raw, - Square.VendorUpdatedEventObjectOperation -> = core.serialization.stringLiteral("UPDATED"); - -export declare namespace VendorUpdatedEventObjectOperation { - export type Raw = "UPDATED"; -} diff --git a/src/serialization/types/VisibilityFilter.ts b/src/serialization/types/VisibilityFilter.ts deleted file mode 100644 index c0ff5cf9e..000000000 --- a/src/serialization/types/VisibilityFilter.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index 963f7b427..000000000 --- a/src/serialization/types/VoidTransactionResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index cc5b4dcd4..000000000 --- a/src/serialization/types/WageSetting.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 6e8af5771..000000000 --- a/src/serialization/types/WebhookSubscription.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e7b024da9..000000000 --- a/src/serialization/types/Weekday.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated 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 deleted file mode 100644 index e566ce1c1..000000000 --- a/src/serialization/types/WorkweekConfig.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file was auto-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 deleted file mode 100644 index 58eb9f815..000000000 --- a/src/serialization/types/index.ts +++ /dev/null @@ -1,1310 +0,0 @@ -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 "./BankAccountCreatedEvent"; -export * from "./BankAccountCreatedEventData"; -export * from "./BankAccountCreatedEventObject"; -export * from "./BankAccountDisabledEvent"; -export * from "./BankAccountDisabledEventData"; -export * from "./BankAccountDisabledEventObject"; -export * from "./BankAccountPaymentDetails"; -export * from "./BankAccountStatus"; -export * from "./BankAccountType"; -export * from "./BankAccountVerifiedEvent"; -export * from "./BankAccountVerifiedEventData"; -export * from "./BankAccountVerifiedEventObject"; -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 "./BookingCreatedEvent"; -export * from "./BookingCreatedEventData"; -export * from "./BookingCreatedEventObject"; -export * from "./BookingCreatorDetails"; -export * from "./BookingCreatorDetailsCreatorType"; -export * from "./BookingCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./BookingCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./BookingCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./BookingCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./BookingCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./BookingCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./BookingCustomAttributeDeleteRequest"; -export * from "./BookingCustomAttributeDeleteResponse"; -export * from "./BookingCustomAttributeOwnedDeletedEvent"; -export * from "./BookingCustomAttributeOwnedUpdatedEvent"; -export * from "./BookingCustomAttributeUpsertRequest"; -export * from "./BookingCustomAttributeUpsertResponse"; -export * from "./BookingCustomAttributeVisibleDeletedEvent"; -export * from "./BookingCustomAttributeVisibleUpdatedEvent"; -export * from "./BookingStatus"; -export * from "./BookingUpdatedEvent"; -export * from "./BookingUpdatedEventData"; -export * from "./BookingUpdatedEventObject"; -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 "./BulkPublishScheduledShiftsData"; -export * from "./BulkPublishScheduledShiftsResponse"; -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 "./CardAutomaticallyUpdatedEvent"; -export * from "./CardAutomaticallyUpdatedEventData"; -export * from "./CardAutomaticallyUpdatedEventObject"; -export * from "./CardBrand"; -export * from "./CardCoBrand"; -export * from "./CardCreatedEvent"; -export * from "./CardCreatedEventData"; -export * from "./CardCreatedEventObject"; -export * from "./CardDisabledEvent"; -export * from "./CardDisabledEventData"; -export * from "./CardDisabledEventObject"; -export * from "./CardForgottenEvent"; -export * from "./CardForgottenEventCard"; -export * from "./CardForgottenEventData"; -export * from "./CardForgottenEventObject"; -export * from "./CardIssuerAlert"; -export * from "./CardPaymentDetails"; -export * from "./CardPaymentTimeline"; -export * from "./CardPrepaidType"; -export * from "./CardType"; -export * from "./CardUpdatedEvent"; -export * from "./CardUpdatedEventData"; -export * from "./CardUpdatedEventObject"; -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 "./CatalogAvailabilityPeriod"; -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 "./CatalogSubscriptionPlanVariation"; -export * from "./CatalogTax"; -export * from "./CatalogTimePeriod"; -export * from "./CatalogV1Id"; -export * from "./CatalogVersionUpdatedEvent"; -export * from "./CatalogVersionUpdatedEventCatalogVersion"; -export * from "./CatalogVersionUpdatedEventData"; -export * from "./CatalogVersionUpdatedEventObject"; -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 "./CreateInvoiceAttachmentRequestData"; -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 "./CreateScheduledShiftResponse"; -export * from "./CreateShiftResponse"; -export * from "./CreateSubscriptionResponse"; -export * from "./CreateTeamMemberRequest"; -export * from "./CreateTeamMemberResponse"; -export * from "./CreateTerminalActionResponse"; -export * from "./CreateTerminalCheckoutResponse"; -export * from "./CreateTerminalRefundResponse"; -export * from "./CreateTimecardResponse"; -export * from "./CreateVendorResponse"; -export * from "./CreateWebhookSubscriptionResponse"; -export * from "./Currency"; -export * from "./CustomAttribute"; -export * from "./CustomAttributeDefinition"; -export * from "./CustomAttributeDefinitionEventData"; -export * from "./CustomAttributeDefinitionEventDataObject"; -export * from "./CustomAttributeDefinitionVisibility"; -export * from "./CustomAttributeEventData"; -export * from "./CustomAttributeEventDataObject"; -export * from "./CustomAttributeFilter"; -export * from "./CustomField"; -export * from "./Customer"; -export * from "./CustomerAddressFilter"; -export * from "./CustomerCreatedEvent"; -export * from "./CustomerCreatedEventData"; -export * from "./CustomerCreatedEventEventContext"; -export * from "./CustomerCreatedEventEventContextMerge"; -export * from "./CustomerCreatedEventObject"; -export * from "./CustomerCreationSource"; -export * from "./CustomerCreationSourceFilter"; -export * from "./CustomerCustomAttributeDefinitionCreatedEvent"; -export * from "./CustomerCustomAttributeDefinitionCreatedPublicEvent"; -export * from "./CustomerCustomAttributeDefinitionDeletedEvent"; -export * from "./CustomerCustomAttributeDefinitionDeletedPublicEvent"; -export * from "./CustomerCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./CustomerCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./CustomerCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./CustomerCustomAttributeDefinitionUpdatedEvent"; -export * from "./CustomerCustomAttributeDefinitionUpdatedPublicEvent"; -export * from "./CustomerCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./CustomerCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./CustomerCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./CustomerCustomAttributeDeletedEvent"; -export * from "./CustomerCustomAttributeDeletedPublicEvent"; -export * from "./CustomerCustomAttributeFilter"; -export * from "./CustomerCustomAttributeFilterValue"; -export * from "./CustomerCustomAttributeFilters"; -export * from "./CustomerCustomAttributeOwnedDeletedEvent"; -export * from "./CustomerCustomAttributeOwnedUpdatedEvent"; -export * from "./CustomerCustomAttributeUpdatedEvent"; -export * from "./CustomerCustomAttributeUpdatedPublicEvent"; -export * from "./CustomerCustomAttributeVisibleDeletedEvent"; -export * from "./CustomerCustomAttributeVisibleUpdatedEvent"; -export * from "./CustomerDeletedEvent"; -export * from "./CustomerDeletedEventData"; -export * from "./CustomerDeletedEventEventContext"; -export * from "./CustomerDeletedEventEventContextMerge"; -export * from "./CustomerDeletedEventObject"; -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 "./CustomerUpdatedEvent"; -export * from "./CustomerUpdatedEventData"; -export * from "./CustomerUpdatedEventObject"; -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 "./DeleteTimecardResponse"; -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 "./DeviceCodePairedEvent"; -export * from "./DeviceCodePairedEventData"; -export * from "./DeviceCodePairedEventObject"; -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 "./DeviceCreatedEvent"; -export * from "./DeviceCreatedEventData"; -export * from "./DeviceCreatedEventObject"; -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 "./DisputeCreatedEvent"; -export * from "./DisputeCreatedEventData"; -export * from "./DisputeCreatedEventObject"; -export * from "./DisputeEvidence"; -export * from "./DisputeEvidenceAddedEvent"; -export * from "./DisputeEvidenceAddedEventData"; -export * from "./DisputeEvidenceAddedEventObject"; -export * from "./DisputeEvidenceCreatedEvent"; -export * from "./DisputeEvidenceCreatedEventData"; -export * from "./DisputeEvidenceCreatedEventObject"; -export * from "./DisputeEvidenceDeletedEvent"; -export * from "./DisputeEvidenceDeletedEventData"; -export * from "./DisputeEvidenceDeletedEventObject"; -export * from "./DisputeEvidenceFile"; -export * from "./DisputeEvidenceRemovedEvent"; -export * from "./DisputeEvidenceRemovedEventData"; -export * from "./DisputeEvidenceRemovedEventObject"; -export * from "./DisputeEvidenceType"; -export * from "./DisputeReason"; -export * from "./DisputeState"; -export * from "./DisputeStateChangedEvent"; -export * from "./DisputeStateChangedEventData"; -export * from "./DisputeStateChangedEventObject"; -export * from "./DisputeStateUpdatedEvent"; -export * from "./DisputeStateUpdatedEventData"; -export * from "./DisputeStateUpdatedEventObject"; -export * from "./DisputedPayment"; -export * from "./EcomVisibility"; -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 "./GiftCardActivityCreatedEvent"; -export * from "./GiftCardActivityCreatedEventData"; -export * from "./GiftCardActivityCreatedEventObject"; -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 "./GiftCardActivityUpdatedEvent"; -export * from "./GiftCardActivityUpdatedEventData"; -export * from "./GiftCardActivityUpdatedEventObject"; -export * from "./GiftCardCreatedEvent"; -export * from "./GiftCardCreatedEventData"; -export * from "./GiftCardCreatedEventObject"; -export * from "./GiftCardCustomerLinkedEvent"; -export * from "./GiftCardCustomerLinkedEventData"; -export * from "./GiftCardCustomerLinkedEventObject"; -export * from "./GiftCardCustomerUnlinkedEvent"; -export * from "./GiftCardCustomerUnlinkedEventData"; -export * from "./GiftCardCustomerUnlinkedEventObject"; -export * from "./GiftCardGanSource"; -export * from "./GiftCardStatus"; -export * from "./GiftCardType"; -export * from "./GiftCardUpdatedEvent"; -export * from "./GiftCardUpdatedEventData"; -export * from "./GiftCardUpdatedEventObject"; -export * from "./InventoryAdjustment"; -export * from "./InventoryAdjustmentGroup"; -export * from "./InventoryAlertType"; -export * from "./InventoryChange"; -export * from "./InventoryChangeType"; -export * from "./InventoryCount"; -export * from "./InventoryCountUpdatedEvent"; -export * from "./InventoryCountUpdatedEventData"; -export * from "./InventoryCountUpdatedEventObject"; -export * from "./InventoryPhysicalCount"; -export * from "./InventoryState"; -export * from "./InventoryTransfer"; -export * from "./Invoice"; -export * from "./InvoiceAcceptedPaymentMethods"; -export * from "./InvoiceAttachment"; -export * from "./InvoiceAutomaticPaymentSource"; -export * from "./InvoiceCanceledEvent"; -export * from "./InvoiceCanceledEventData"; -export * from "./InvoiceCanceledEventObject"; -export * from "./InvoiceCreatedEvent"; -export * from "./InvoiceCreatedEventData"; -export * from "./InvoiceCreatedEventObject"; -export * from "./InvoiceCustomField"; -export * from "./InvoiceCustomFieldPlacement"; -export * from "./InvoiceDeletedEvent"; -export * from "./InvoiceDeletedEventData"; -export * from "./InvoiceDeliveryMethod"; -export * from "./InvoiceFilter"; -export * from "./InvoicePaymentMadeEvent"; -export * from "./InvoicePaymentMadeEventData"; -export * from "./InvoicePaymentMadeEventObject"; -export * from "./InvoicePaymentReminder"; -export * from "./InvoicePaymentReminderStatus"; -export * from "./InvoicePaymentRequest"; -export * from "./InvoicePublishedEvent"; -export * from "./InvoicePublishedEventData"; -export * from "./InvoicePublishedEventObject"; -export * from "./InvoiceQuery"; -export * from "./InvoiceRecipient"; -export * from "./InvoiceRecipientTaxIds"; -export * from "./InvoiceRefundedEvent"; -export * from "./InvoiceRefundedEventData"; -export * from "./InvoiceRefundedEventObject"; -export * from "./InvoiceRequestMethod"; -export * from "./InvoiceRequestType"; -export * from "./InvoiceScheduledChargeFailedEvent"; -export * from "./InvoiceScheduledChargeFailedEventData"; -export * from "./InvoiceScheduledChargeFailedEventObject"; -export * from "./InvoiceSort"; -export * from "./InvoiceSortField"; -export * from "./InvoiceStatus"; -export * from "./InvoiceUpdatedEvent"; -export * from "./InvoiceUpdatedEventData"; -export * from "./InvoiceUpdatedEventObject"; -export * from "./ItemVariationLocationOverrides"; -export * from "./Job"; -export * from "./JobAssignment"; -export * from "./JobAssignmentPayType"; -export * from "./JobCreatedEvent"; -export * from "./JobCreatedEventData"; -export * from "./JobCreatedEventObject"; -export * from "./JobUpdatedEvent"; -export * from "./JobUpdatedEventData"; -export * from "./JobUpdatedEventObject"; -export * from "./LaborScheduledShiftCreatedEvent"; -export * from "./LaborScheduledShiftCreatedEventData"; -export * from "./LaborScheduledShiftCreatedEventObject"; -export * from "./LaborScheduledShiftDeletedEvent"; -export * from "./LaborScheduledShiftDeletedEventData"; -export * from "./LaborScheduledShiftPublishedEvent"; -export * from "./LaborScheduledShiftPublishedEventData"; -export * from "./LaborScheduledShiftPublishedEventObject"; -export * from "./LaborScheduledShiftUpdatedEvent"; -export * from "./LaborScheduledShiftUpdatedEventData"; -export * from "./LaborScheduledShiftUpdatedEventObject"; -export * from "./LaborShiftCreatedEvent"; -export * from "./LaborShiftCreatedEventData"; -export * from "./LaborShiftCreatedEventObject"; -export * from "./LaborShiftDeletedEvent"; -export * from "./LaborShiftDeletedEventData"; -export * from "./LaborShiftUpdatedEvent"; -export * from "./LaborShiftUpdatedEventData"; -export * from "./LaborShiftUpdatedEventObject"; -export * from "./LaborTimecardCreatedEvent"; -export * from "./LaborTimecardCreatedEventData"; -export * from "./LaborTimecardCreatedEventObject"; -export * from "./LaborTimecardDeletedEvent"; -export * from "./LaborTimecardDeletedEventData"; -export * from "./LaborTimecardUpdatedEvent"; -export * from "./LaborTimecardUpdatedEventData"; -export * from "./LaborTimecardUpdatedEventObject"; -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 "./ListPaymentRefundsRequestSortField"; -export * from "./ListPaymentRefundsResponse"; -export * from "./ListPaymentsRequestSortField"; -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 "./LocationCreatedEvent"; -export * from "./LocationCreatedEventData"; -export * from "./LocationCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./LocationCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./LocationCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./LocationCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./LocationCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./LocationCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./LocationCustomAttributeOwnedDeletedEvent"; -export * from "./LocationCustomAttributeOwnedUpdatedEvent"; -export * from "./LocationCustomAttributeVisibleDeletedEvent"; -export * from "./LocationCustomAttributeVisibleUpdatedEvent"; -export * from "./LocationSettingsUpdatedEvent"; -export * from "./LocationSettingsUpdatedEventData"; -export * from "./LocationSettingsUpdatedEventObject"; -export * from "./LocationStatus"; -export * from "./LocationType"; -export * from "./LocationUpdatedEvent"; -export * from "./LocationUpdatedEventData"; -export * from "./LoyaltyAccount"; -export * from "./LoyaltyAccountCreatedEvent"; -export * from "./LoyaltyAccountCreatedEventData"; -export * from "./LoyaltyAccountCreatedEventObject"; -export * from "./LoyaltyAccountDeletedEvent"; -export * from "./LoyaltyAccountDeletedEventData"; -export * from "./LoyaltyAccountDeletedEventObject"; -export * from "./LoyaltyAccountExpiringPointDeadline"; -export * from "./LoyaltyAccountMapping"; -export * from "./LoyaltyAccountMappingType"; -export * from "./LoyaltyAccountUpdatedEvent"; -export * from "./LoyaltyAccountUpdatedEventData"; -export * from "./LoyaltyAccountUpdatedEventObject"; -export * from "./LoyaltyEvent"; -export * from "./LoyaltyEventAccumulatePoints"; -export * from "./LoyaltyEventAccumulatePromotionPoints"; -export * from "./LoyaltyEventAdjustPoints"; -export * from "./LoyaltyEventCreateReward"; -export * from "./LoyaltyEventCreatedEvent"; -export * from "./LoyaltyEventCreatedEventData"; -export * from "./LoyaltyEventCreatedEventObject"; -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 "./LoyaltyProgramCreatedEvent"; -export * from "./LoyaltyProgramCreatedEventData"; -export * from "./LoyaltyProgramCreatedEventObject"; -export * from "./LoyaltyProgramExpirationPolicy"; -export * from "./LoyaltyProgramRewardTier"; -export * from "./LoyaltyProgramStatus"; -export * from "./LoyaltyProgramTerminology"; -export * from "./LoyaltyProgramUpdatedEvent"; -export * from "./LoyaltyProgramUpdatedEventData"; -export * from "./LoyaltyProgramUpdatedEventObject"; -export * from "./LoyaltyPromotion"; -export * from "./LoyaltyPromotionAvailableTimeData"; -export * from "./LoyaltyPromotionCreatedEvent"; -export * from "./LoyaltyPromotionCreatedEventData"; -export * from "./LoyaltyPromotionCreatedEventObject"; -export * from "./LoyaltyPromotionIncentive"; -export * from "./LoyaltyPromotionIncentivePointsAdditionData"; -export * from "./LoyaltyPromotionIncentivePointsMultiplierData"; -export * from "./LoyaltyPromotionIncentiveType"; -export * from "./LoyaltyPromotionStatus"; -export * from "./LoyaltyPromotionTriggerLimit"; -export * from "./LoyaltyPromotionTriggerLimitInterval"; -export * from "./LoyaltyPromotionUpdatedEvent"; -export * from "./LoyaltyPromotionUpdatedEventData"; -export * from "./LoyaltyPromotionUpdatedEventObject"; -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 "./MerchantCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./MerchantCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./MerchantCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./MerchantCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./MerchantCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./MerchantCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./MerchantCustomAttributeOwnedDeletedEvent"; -export * from "./MerchantCustomAttributeOwnedUpdatedEvent"; -export * from "./MerchantCustomAttributeVisibleDeletedEvent"; -export * from "./MerchantCustomAttributeVisibleUpdatedEvent"; -export * from "./MerchantSettingsUpdatedEvent"; -export * from "./MerchantSettingsUpdatedEventData"; -export * from "./MerchantSettingsUpdatedEventObject"; -export * from "./MerchantStatus"; -export * from "./ModifierLocationOverrides"; -export * from "./Money"; -export * from "./OauthAuthorizationRevokedEvent"; -export * from "./OauthAuthorizationRevokedEventData"; -export * from "./OauthAuthorizationRevokedEventObject"; -export * from "./OauthAuthorizationRevokedEventRevocationObject"; -export * from "./OauthAuthorizationRevokedEventRevokerType"; -export * from "./ObtainTokenResponse"; -export * from "./OfflinePaymentDetails"; -export * from "./Order"; -export * from "./OrderCreated"; -export * from "./OrderCreatedEvent"; -export * from "./OrderCreatedEventData"; -export * from "./OrderCreatedObject"; -export * from "./OrderCustomAttributeDefinitionOwnedCreatedEvent"; -export * from "./OrderCustomAttributeDefinitionOwnedDeletedEvent"; -export * from "./OrderCustomAttributeDefinitionOwnedUpdatedEvent"; -export * from "./OrderCustomAttributeDefinitionVisibleCreatedEvent"; -export * from "./OrderCustomAttributeDefinitionVisibleDeletedEvent"; -export * from "./OrderCustomAttributeDefinitionVisibleUpdatedEvent"; -export * from "./OrderCustomAttributeOwnedDeletedEvent"; -export * from "./OrderCustomAttributeOwnedUpdatedEvent"; -export * from "./OrderCustomAttributeVisibleDeletedEvent"; -export * from "./OrderCustomAttributeVisibleUpdatedEvent"; -export * from "./OrderEntry"; -export * from "./OrderFulfillmentDeliveryDetailsScheduleType"; -export * from "./OrderFulfillmentFulfillmentLineItemApplication"; -export * from "./OrderFulfillmentPickupDetailsScheduleType"; -export * from "./OrderFulfillmentState"; -export * from "./OrderFulfillmentType"; -export * from "./OrderFulfillmentUpdated"; -export * from "./OrderFulfillmentUpdatedEvent"; -export * from "./OrderFulfillmentUpdatedEventData"; -export * from "./OrderFulfillmentUpdatedObject"; -export * from "./OrderFulfillmentUpdatedUpdate"; -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 "./OrderUpdated"; -export * from "./OrderUpdatedEvent"; -export * from "./OrderUpdatedEventData"; -export * from "./OrderUpdatedObject"; -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 "./PaymentCreatedEvent"; -export * from "./PaymentCreatedEventData"; -export * from "./PaymentCreatedEventObject"; -export * from "./PaymentLink"; -export * from "./PaymentLinkRelatedResources"; -export * from "./PaymentOptions"; -export * from "./PaymentOptionsDelayAction"; -export * from "./PaymentRefund"; -export * from "./PaymentUpdatedEvent"; -export * from "./PaymentUpdatedEventData"; -export * from "./PaymentUpdatedEventObject"; -export * from "./Payout"; -export * from "./PayoutEntry"; -export * from "./PayoutFailedEvent"; -export * from "./PayoutFailedEventData"; -export * from "./PayoutFailedEventObject"; -export * from "./PayoutFee"; -export * from "./PayoutFeeType"; -export * from "./PayoutPaidEvent"; -export * from "./PayoutPaidEventData"; -export * from "./PayoutPaidEventObject"; -export * from "./PayoutSentEvent"; -export * from "./PayoutSentEventData"; -export * from "./PayoutSentEventObject"; -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 "./PublishScheduledShiftResponse"; -export * from "./QrCodeOptions"; -export * from "./QuickPay"; -export * from "./Range"; -export * from "./ReceiptOptions"; -export * from "./RedeemLoyaltyRewardResponse"; -export * from "./Refund"; -export * from "./RefundCreatedEvent"; -export * from "./RefundCreatedEventData"; -export * from "./RefundCreatedEventObject"; -export * from "./RefundPaymentResponse"; -export * from "./RefundStatus"; -export * from "./RefundUpdatedEvent"; -export * from "./RefundUpdatedEventData"; -export * from "./RefundUpdatedEventObject"; -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 "./RetrieveScheduledShiftResponse"; -export * from "./GetSnippetResponse"; -export * from "./GetSubscriptionResponse"; -export * from "./GetTeamMemberBookingProfileResponse"; -export * from "./GetTeamMemberResponse"; -export * from "./RetrieveTimecardResponse"; -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 "./ScheduledShift"; -export * from "./ScheduledShiftDetails"; -export * from "./ScheduledShiftFilter"; -export * from "./ScheduledShiftFilterAssignmentStatus"; -export * from "./ScheduledShiftFilterScheduledShiftStatus"; -export * from "./ScheduledShiftNotificationAudience"; -export * from "./ScheduledShiftQuery"; -export * from "./ScheduledShiftSort"; -export * from "./ScheduledShiftSortField"; -export * from "./ScheduledShiftWorkday"; -export * from "./ScheduledShiftWorkdayMatcher"; -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 "./SearchScheduledShiftsResponse"; -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 "./SearchTimecardsResponse"; -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 "./SubscriptionCreatedEvent"; -export * from "./SubscriptionCreatedEventData"; -export * from "./SubscriptionCreatedEventObject"; -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 "./SubscriptionUpdatedEvent"; -export * from "./SubscriptionUpdatedEventData"; -export * from "./SubscriptionUpdatedEventObject"; -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 "./TeamMemberCreatedEvent"; -export * from "./TeamMemberCreatedEventData"; -export * from "./TeamMemberCreatedEventObject"; -export * from "./TeamMemberInvitationStatus"; -export * from "./TeamMemberStatus"; -export * from "./TeamMemberUpdatedEvent"; -export * from "./TeamMemberUpdatedEventData"; -export * from "./TeamMemberUpdatedEventObject"; -export * from "./TeamMemberWage"; -export * from "./TeamMemberWageSettingUpdatedEvent"; -export * from "./TeamMemberWageSettingUpdatedEventData"; -export * from "./TeamMemberWageSettingUpdatedEventObject"; -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 "./TerminalActionCreatedEvent"; -export * from "./TerminalActionCreatedEventData"; -export * from "./TerminalActionCreatedEventObject"; -export * from "./TerminalActionQuery"; -export * from "./TerminalActionQueryFilter"; -export * from "./TerminalActionQuerySort"; -export * from "./TerminalActionUpdatedEvent"; -export * from "./TerminalActionUpdatedEventData"; -export * from "./TerminalActionUpdatedEventObject"; -export * from "./TerminalCheckout"; -export * from "./TerminalCheckoutCreatedEvent"; -export * from "./TerminalCheckoutCreatedEventData"; -export * from "./TerminalCheckoutCreatedEventObject"; -export * from "./TerminalCheckoutQuery"; -export * from "./TerminalCheckoutQueryFilter"; -export * from "./TerminalCheckoutQuerySort"; -export * from "./TerminalCheckoutUpdatedEvent"; -export * from "./TerminalCheckoutUpdatedEventData"; -export * from "./TerminalCheckoutUpdatedEventObject"; -export * from "./TerminalRefund"; -export * from "./TerminalRefundCreatedEvent"; -export * from "./TerminalRefundCreatedEventData"; -export * from "./TerminalRefundCreatedEventObject"; -export * from "./TerminalRefundQuery"; -export * from "./TerminalRefundQueryFilter"; -export * from "./TerminalRefundQuerySort"; -export * from "./TerminalRefundUpdatedEvent"; -export * from "./TerminalRefundUpdatedEventData"; -export * from "./TerminalRefundUpdatedEventObject"; -export * from "./TestWebhookSubscriptionResponse"; -export * from "./TimeRange"; -export * from "./Timecard"; -export * from "./TimecardFilter"; -export * from "./TimecardFilterStatus"; -export * from "./TimecardQuery"; -export * from "./TimecardSort"; -export * from "./TimecardSortField"; -export * from "./TimecardStatus"; -export * from "./TimecardWage"; -export * from "./TimecardWorkday"; -export * from "./TimecardWorkdayMatcher"; -export * from "./TipSettings"; -export * from "./Transaction"; -export * from "./TransactionProduct"; -export * from "./TransactionType"; -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 "./UpdateScheduledShiftResponse"; -export * from "./UpdateShiftResponse"; -export * from "./UpdateSubscriptionResponse"; -export * from "./UpdateTeamMemberRequest"; -export * from "./UpdateTeamMemberResponse"; -export * from "./UpdateTimecardResponse"; -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 "./VendorCreatedEvent"; -export * from "./VendorCreatedEventData"; -export * from "./VendorCreatedEventObject"; -export * from "./VendorCreatedEventObjectOperation"; -export * from "./VendorStatus"; -export * from "./VendorUpdatedEvent"; -export * from "./VendorUpdatedEventData"; -export * from "./VendorUpdatedEventObject"; -export * from "./VendorUpdatedEventObjectOperation"; -export * from "./VisibilityFilter"; -export * from "./VoidTransactionResponse"; -export * from "./WageSetting"; -export * from "./WebhookSubscription"; -export * from "./Weekday"; -export * from "./WorkweekConfig"; -export * from "./CatalogObjectItem"; -export * from "./CatalogObjectImage"; -export * from "./CatalogObjectItemVariation"; -export * from "./CatalogObjectTax"; -export * from "./CatalogObjectDiscount"; -export * from "./CatalogObjectModifierList"; -export * from "./CatalogObjectModifier"; -export * from "./CatalogObjectPricingRule"; -export * from "./CatalogObjectProductSet"; -export * from "./CatalogObjectTimePeriod"; -export * from "./CatalogObjectMeasurementUnit"; -export * from "./CatalogObjectSubscriptionPlanVariation"; -export * from "./CatalogObjectItemOption"; -export * from "./CatalogObjectItemOptionValue"; -export * from "./CatalogObjectCustomAttributeDefinition"; -export * from "./CatalogObjectQuickAmountsSettings"; -export * from "./CatalogObjectSubscriptionPlan"; -export * from "./CatalogObjectAvailabilityPeriod"; -export * from "./GetLoyaltyAccountRequest"; -export * from "./GetLoyaltyProgramRequest"; -export * from "./GetLoyaltyPromotionRequest"; -export * from "./GetLoyaltyRewardRequest"; -export * from "./GetCardRequest"; -export * from "./GetDisputeEvidenceRequest"; -export * from "./GetDisputeRequest"; -export * from "./V1GetPaymentRequest"; -export * from "./V1GetSettlementRequest"; -export * from "./GetCustomerGroupRequest"; -export * from "./GetCustomerRequest"; -export * from "./GetCustomerSegmentRequest"; -export * from "./GetTransactionRequest"; -export * from "./GetBookingRequest"; -export * from "./GetBusinessBookingProfileRequest"; -export * from "./GetTeamMemberBookingProfileRequest"; -export * from "./GetSnippetRequest"; -export * from "./GetInventoryAdjustmentRequest"; -export * from "./GetInventoryPhysicalCountRequest"; -export * from "./GetInventoryTransferRequest"; -export * from "./GetVendorRequest"; -export * from "./GetPaymentLinkRequest"; -export * from "./GetGiftCardRequest"; -export * from "./GetOrderRequest"; -export * from "./GetEmployeeRequest"; -export * from "./GetLocationRequest"; -export * from "./GetMerchantRequest"; -export * from "./GetTeamMemberRequest"; -export * from "./GetWageSettingRequest"; -export * from "./GetWebhookSubscriptionRequest"; diff --git a/tests/BrowserTestEnvironment.ts b/tests/BrowserTestEnvironment.ts new file mode 100644 index 000000000..0f32bf7b0 --- /dev/null +++ b/tests/BrowserTestEnvironment.ts @@ -0,0 +1,17 @@ +import { TestEnvironment } from "jest-environment-jsdom"; + +class BrowserTestEnvironment extends TestEnvironment { + async setup() { + await super.setup(); + this.global.Request = Request; + this.global.Response = Response; + this.global.ReadableStream = ReadableStream; + this.global.TextEncoder = TextEncoder; + this.global.TextDecoder = TextDecoder; + this.global.FormData = FormData; + this.global.File = File; + this.global.Blob = Blob; + } +} + +export default BrowserTestEnvironment; diff --git a/tests/bigint.setup.ts b/tests/bigint.setup.ts new file mode 100644 index 000000000..d03d34f21 --- /dev/null +++ b/tests/bigint.setup.ts @@ -0,0 +1,13 @@ +import { expect } from "@jest/globals"; + +expect.addEqualityTesters([ + (a: any, b: any) => { + if ((typeof a === "bigint" && typeof b === "number") || (typeof a === "number" && typeof b === "bigint")) { + return BigInt(a) === BigInt(b); + } + // Return undefined to let Jest handle other comparisons normally + return undefined; + }, +]); + +export {}; diff --git a/tests/mock-server/MockServer.ts b/tests/mock-server/MockServer.ts new file mode 100644 index 000000000..6e258f172 --- /dev/null +++ b/tests/mock-server/MockServer.ts @@ -0,0 +1,29 @@ +import { RequestHandlerOptions } from "msw"; +import type { SetupServer } from "msw/node"; + +import { mockEndpointBuilder } from "./mockEndpointBuilder"; + +export interface MockServerOptions { + baseUrl: string; + server: SetupServer; +} + +export class MockServer { + private readonly server: SetupServer; + public readonly baseUrl: string; + + constructor({ baseUrl, server }: MockServerOptions) { + this.baseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl; + this.server = server; + } + + public mockEndpoint(options?: RequestHandlerOptions): ReturnType { + const builder = mockEndpointBuilder({ + once: options?.once, + onBuild: (handler) => { + this.server.use(handler); + }, + }).baseUrl(this.baseUrl); + return builder; + } +} diff --git a/tests/mock-server/MockServerPool.ts b/tests/mock-server/MockServerPool.ts new file mode 100644 index 000000000..81608069e --- /dev/null +++ b/tests/mock-server/MockServerPool.ts @@ -0,0 +1,106 @@ +import { setupServer } from "msw/node"; + +import { fromJson, toJson } from "../../src/core/json"; +import { MockServer } from "./MockServer"; +import { randomBaseUrl } from "./randomBaseUrl"; + +const mswServer = setupServer(); +interface MockServerOptions { + baseUrl?: string; +} + +async function formatHttpRequest(request: Request, id?: string): Promise { + try { + const clone = request.clone(); + const headers = [...clone.headers.entries()].map(([k, v]) => `${k}: ${v}`).join("\n"); + + let body = ""; + try { + const contentType = clone.headers.get("content-type"); + if (contentType?.includes("application/json")) { + body = toJson(fromJson(await clone.text()), undefined, 2); + } else if (clone.body) { + body = await clone.text(); + } + } catch (e) { + body = "(unable to parse body)"; + } + + const title = id ? `### Request ${id} ###\n` : ""; + const firstLine = `${title}${request.method} ${request.url.toString()} HTTP/1.1`; + + return `\n${firstLine}\n${headers}\n\n${body || "(no body)"}\n`; + } catch (e) { + return `Error formatting request: ${e}`; + } +} + +async function formatHttpResponse(response: Response, id?: string): Promise { + try { + const clone = response.clone(); + const headers = [...clone.headers.entries()].map(([k, v]) => `${k}: ${v}`).join("\n"); + + let body = ""; + try { + const contentType = clone.headers.get("content-type"); + if (contentType?.includes("application/json")) { + body = toJson(fromJson(await clone.text()), undefined, 2); + } else if (clone.body) { + body = await clone.text(); + } + } catch (e) { + body = "(unable to parse body)"; + } + + const title = id ? `### Response for ${id} ###\n` : ""; + const firstLine = `${title}HTTP/1.1 ${response.status} ${response.statusText}`; + + return `\n${firstLine}\n${headers}\n\n${body || "(no body)"}\n`; + } catch (e) { + return `Error formatting response: ${e}`; + } +} + +class MockServerPool { + private servers: MockServer[] = []; + + public createServer(options?: Partial): MockServer { + const baseUrl = options?.baseUrl || randomBaseUrl(); + const server = new MockServer({ baseUrl, server: mswServer }); + this.servers.push(server); + return server; + } + + public getServers(): MockServer[] { + return [...this.servers]; + } + + public listen(): void { + const onUnhandledRequest = process.env.LOG_LEVEL === "debug" ? "warn" : "bypass"; + mswServer.listen({ onUnhandledRequest }); + + if (process.env.LOG_LEVEL === "debug") { + mswServer.events.on("request:start", async ({ request, requestId }) => { + const formattedRequest = await formatHttpRequest(request, requestId); + console.debug("request:start\n" + formattedRequest); + }); + + mswServer.events.on("request:unhandled", async ({ request, requestId }) => { + const formattedRequest = await formatHttpRequest(request, requestId); + console.debug("request:unhandled\n" + formattedRequest); + }); + + mswServer.events.on("response:mocked", async ({ request, response, requestId }) => { + const formattedResponse = await formatHttpResponse(response, requestId); + console.debug("response:mocked\n" + formattedResponse); + }); + } + } + + public close(): void { + this.servers = []; + mswServer.close(); + } +} + +export const mockServerPool = new MockServerPool(); diff --git a/tests/mock-server/mockEndpointBuilder.ts b/tests/mock-server/mockEndpointBuilder.ts new file mode 100644 index 000000000..390b22568 --- /dev/null +++ b/tests/mock-server/mockEndpointBuilder.ts @@ -0,0 +1,209 @@ +import { DefaultBodyType, HttpHandler, HttpResponse, HttpResponseResolver, http } from "msw"; + +import { toJson } from "../../src/core/json"; +import { withHeaders } from "./withHeaders"; +import { withJson } from "./withJson"; + +type HttpMethod = "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head"; + +interface MethodStage { + baseUrl(baseUrl: string): MethodStage; + all(path: string): RequestHeadersStage; + get(path: string): RequestHeadersStage; + post(path: string): RequestHeadersStage; + put(path: string): RequestHeadersStage; + delete(path: string): RequestHeadersStage; + patch(path: string): RequestHeadersStage; + options(path: string): RequestHeadersStage; + head(path: string): RequestHeadersStage; +} + +interface RequestHeadersStage extends RequestBodyStage, ResponseStage { + header(name: string, value: string): RequestHeadersStage; + headers(headers: Record): RequestBodyStage; +} + +interface RequestBodyStage extends ResponseStage { + jsonBody(body: unknown): ResponseStage; +} + +interface ResponseStage { + respondWith(): ResponseStatusStage; +} +interface ResponseStatusStage { + statusCode(statusCode: number): ResponseHeaderStage; +} + +interface ResponseHeaderStage extends ResponseBodyStage, BuildStage { + header(name: string, value: string): ResponseHeaderStage; + headers(headers: Record): ResponseHeaderStage; +} + +interface ResponseBodyStage { + jsonBody(body: unknown): BuildStage; +} + +interface BuildStage { + build(): HttpHandler; +} + +export interface HttpHandlerBuilderOptions { + onBuild?: (handler: HttpHandler) => void; + once?: boolean; +} + +class RequestBuilder implements MethodStage, RequestHeadersStage, RequestBodyStage, ResponseStage { + private method: HttpMethod = "get"; + private _baseUrl: string = ""; + private path: string = "/"; + private readonly predicates: ((resolver: HttpResponseResolver) => HttpResponseResolver)[] = []; + private readonly handlerOptions?: HttpHandlerBuilderOptions; + + constructor(options?: HttpHandlerBuilderOptions) { + this.handlerOptions = options; + } + + baseUrl(baseUrl: string): MethodStage { + this._baseUrl = baseUrl; + return this; + } + + all(path: string): RequestHeadersStage { + this.method = "all"; + this.path = path; + return this; + } + + get(path: string): RequestHeadersStage { + this.method = "get"; + this.path = path; + return this; + } + + post(path: string): RequestHeadersStage { + this.method = "post"; + this.path = path; + return this; + } + + put(path: string): RequestHeadersStage { + this.method = "put"; + this.path = path; + return this; + } + + delete(path: string): RequestHeadersStage { + this.method = "delete"; + this.path = path; + return this; + } + + patch(path: string): RequestHeadersStage { + this.method = "patch"; + this.path = path; + return this; + } + + options(path: string): RequestHeadersStage { + this.method = "options"; + this.path = path; + return this; + } + + head(path: string): RequestHeadersStage { + this.method = "head"; + this.path = path; + return this; + } + + header(name: string, value: string): RequestHeadersStage { + this.predicates.push((resolver) => withHeaders({ [name]: value }, resolver)); + return this; + } + + headers(headers: Record): RequestBodyStage { + this.predicates.push((resolver) => withHeaders(headers, resolver)); + return this; + } + + jsonBody(body: unknown): ResponseStage { + this.predicates.push((resolver) => withJson(body, resolver)); + return this; + } + + respondWith(): ResponseStatusStage { + return new ResponseBuilder(this.method, this.buildPath(), this.predicates, this.handlerOptions); + } + + private buildPath(): string { + if (this._baseUrl.endsWith("/") && this.path.startsWith("/")) { + return this._baseUrl + this.path.slice(1); + } + if (!this._baseUrl.endsWith("/") && !this.path.startsWith("/")) { + return this._baseUrl + "/" + this.path; + } + return this._baseUrl + this.path; + } +} + +class ResponseBuilder implements ResponseStatusStage, ResponseHeaderStage, ResponseBodyStage, BuildStage { + private readonly method: HttpMethod; + private readonly path: string; + private readonly requestPredicates: ((resolver: HttpResponseResolver) => HttpResponseResolver)[]; + private readonly handlerOptions?: HttpHandlerBuilderOptions; + + private responseStatusCode: number = 200; + private responseHeaders: Record = {}; + private responseBody: DefaultBodyType = undefined; + + constructor( + method: HttpMethod, + path: string, + requestPredicates: ((resolver: HttpResponseResolver) => HttpResponseResolver)[], + options?: HttpHandlerBuilderOptions, + ) { + this.method = method; + this.path = path; + this.requestPredicates = requestPredicates; + this.handlerOptions = options; + } + + public statusCode(code: number): ResponseHeaderStage { + this.responseStatusCode = code; + return this; + } + + public header(name: string, value: string): ResponseHeaderStage { + this.responseHeaders[name] = value; + return this; + } + + public headers(headers: Record): ResponseHeaderStage { + this.responseHeaders = { ...this.responseHeaders, ...headers }; + return this; + } + + public jsonBody(body: unknown): BuildStage { + this.responseBody = toJson(body); + return this; + } + + public build(): HttpHandler { + const responseResolver: HttpResponseResolver = () => { + return new HttpResponse(this.responseBody, { + status: this.responseStatusCode, + headers: this.responseHeaders, + }); + }; + + const finalResolver = this.requestPredicates.reduceRight((acc, predicate) => predicate(acc), responseResolver); + + const handler = http[this.method](this.path, finalResolver, this.handlerOptions); + this.handlerOptions?.onBuild?.(handler); + return handler; + } +} + +export function mockEndpointBuilder(options?: HttpHandlerBuilderOptions): MethodStage { + return new RequestBuilder(options); +} diff --git a/tests/mock-server/randomBaseUrl.ts b/tests/mock-server/randomBaseUrl.ts new file mode 100644 index 000000000..031aa6408 --- /dev/null +++ b/tests/mock-server/randomBaseUrl.ts @@ -0,0 +1,4 @@ +export function randomBaseUrl(): string { + const randomString = Math.random().toString(36).substring(2, 15); + return `http://${randomString}.localhost`; +} diff --git a/tests/mock-server/setup.ts b/tests/mock-server/setup.ts new file mode 100644 index 000000000..c216d6074 --- /dev/null +++ b/tests/mock-server/setup.ts @@ -0,0 +1,10 @@ +import { afterAll, beforeAll } from "@jest/globals"; + +import { mockServerPool } from "./MockServerPool"; + +beforeAll(() => { + mockServerPool.listen(); +}); +afterAll(() => { + mockServerPool.close(); +}); diff --git a/tests/mock-server/withHeaders.ts b/tests/mock-server/withHeaders.ts new file mode 100644 index 000000000..e77c837d9 --- /dev/null +++ b/tests/mock-server/withHeaders.ts @@ -0,0 +1,70 @@ +import { HttpResponseResolver, passthrough } from "msw"; + +/** + * Creates a request matcher that validates if request headers match specified criteria + * @param expectedHeaders - Headers to match against + * @param resolver - Response resolver to execute if headers match + */ +export function withHeaders( + expectedHeaders: Record boolean)>, + resolver: HttpResponseResolver, +): HttpResponseResolver { + return (args) => { + const { request } = args; + const { headers } = request; + + const mismatches: Record< + string, + { actual: string | null; expected: string | RegExp | ((value: string) => boolean) } + > = {}; + + for (const [key, expectedValue] of Object.entries(expectedHeaders)) { + const actualValue = headers.get(key); + + if (actualValue === null) { + mismatches[key] = { actual: null, expected: expectedValue }; + continue; + } + + if (typeof expectedValue === "function") { + if (!expectedValue(actualValue)) { + mismatches[key] = { actual: actualValue, expected: expectedValue }; + } + } else if (expectedValue instanceof RegExp) { + if (!expectedValue.test(actualValue)) { + mismatches[key] = { actual: actualValue, expected: expectedValue }; + } + } else if (expectedValue !== actualValue) { + mismatches[key] = { actual: actualValue, expected: expectedValue }; + } + } + + if (Object.keys(mismatches).length > 0) { + const formattedMismatches = formatHeaderMismatches(mismatches); + console.error("Header mismatch:", formattedMismatches); + return passthrough(); + } + + return resolver(args); + }; +} + +function formatHeaderMismatches( + mismatches: Record boolean) }>, +): Record { + const formatted: Record = {}; + + for (const [key, { actual, expected }] of Object.entries(mismatches)) { + formatted[key] = { + actual, + expected: + expected instanceof RegExp + ? expected.toString() + : typeof expected === "function" + ? "[Function]" + : expected, + }; + } + + return formatted; +} diff --git a/tests/mock-server/withJson.ts b/tests/mock-server/withJson.ts new file mode 100644 index 000000000..44e3eb832 --- /dev/null +++ b/tests/mock-server/withJson.ts @@ -0,0 +1,152 @@ +import { HttpResponseResolver, passthrough } from "msw"; + +import { fromJson, toJson } from "../../src/core/json"; + +/** + * Creates a request matcher that validates if the request JSON body exactly matches the expected object + * @param expectedBody - The exact body object to match against + * @param resolver - Response resolver to execute if body matches + */ +export function withJson(expectedBody: unknown, resolver: HttpResponseResolver): HttpResponseResolver { + return async (args) => { + const { request } = args; + + let clonedRequest: Request; + let actualBody: unknown; + try { + clonedRequest = request.clone(); + actualBody = fromJson(await clonedRequest.text()); + } catch (error) { + console.error("Error processing request body:", error); + return passthrough(); + } + + const mismatches = findMismatches(actualBody, expectedBody); + if (Object.keys(mismatches).length > 0) { + console.error("JSON body mismatch:", toJson(mismatches, undefined, 2)); + return passthrough(); + } + + return resolver(args); + }; +} + +function findMismatches(actual: any, expected: any): Record { + const mismatches: Record = {}; + + if (typeof actual !== typeof expected) { + if (areEquivalent(actual, expected)) { + return {}; + } + return { value: { actual, expected } }; + } + + if (typeof actual !== "object" || actual === null || expected === null) { + if (actual !== expected) { + if (areEquivalent(actual, expected)) { + return {}; + } + return { value: { actual, expected } }; + } + return {}; + } + + if (Array.isArray(actual) && Array.isArray(expected)) { + if (actual.length !== expected.length) { + return { length: { actual: actual.length, expected: expected.length } }; + } + + const arrayMismatches: Record = {}; + for (let i = 0; i < actual.length; i++) { + const itemMismatches = findMismatches(actual[i], expected[i]); + if (Object.keys(itemMismatches).length > 0) { + for (const [mismatchKey, mismatchValue] of Object.entries(itemMismatches)) { + arrayMismatches[`[${i}]${mismatchKey === "value" ? "" : "." + mismatchKey}`] = mismatchValue; + } + } + } + return arrayMismatches; + } + + const actualKeys = Object.keys(actual); + const expectedKeys = Object.keys(expected); + + const allKeys = new Set([...actualKeys, ...expectedKeys]); + + for (const key of allKeys) { + if (!expectedKeys.includes(key)) { + if (actual[key] === undefined) { + continue; // Skip undefined values in actual + } + mismatches[key] = { actual: actual[key], expected: undefined }; + } else if (!actualKeys.includes(key)) { + if (expected[key] === undefined) { + continue; // Skip undefined values in expected + } + mismatches[key] = { actual: undefined, expected: expected[key] }; + } else if ( + typeof actual[key] === "object" && + actual[key] !== null && + typeof expected[key] === "object" && + expected[key] !== null + ) { + const nestedMismatches = findMismatches(actual[key], expected[key]); + if (Object.keys(nestedMismatches).length > 0) { + for (const [nestedKey, nestedValue] of Object.entries(nestedMismatches)) { + mismatches[`${key}${nestedKey === "value" ? "" : "." + nestedKey}`] = nestedValue; + } + } + } else if (actual[key] !== expected[key]) { + if (areEquivalent(actual[key], expected[key])) { + continue; + } + mismatches[key] = { actual: actual[key], expected: expected[key] }; + } + } + + return mismatches; +} + +function areEquivalent(actual: unknown, expected: unknown): boolean { + if (actual === expected) { + return true; + } + if (isEquivalentBigInt(actual, expected)) { + return true; + } + if (isEquivalentDatetime(actual, expected)) { + return true; + } + return false; +} + +function isEquivalentBigInt(actual: unknown, expected: unknown) { + if (typeof actual === "number") { + actual = BigInt(actual); + } + if (typeof expected === "number") { + expected = BigInt(expected); + } + if (typeof actual === "bigint" && typeof expected === "bigint") { + return actual === expected; + } + return false; +} + +function isEquivalentDatetime(str1: unknown, str2: unknown): boolean { + if (typeof str1 !== "string" || typeof str2 !== "string") { + return false; + } + const isoDatePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/; + if (!isoDatePattern.test(str1) || !isoDatePattern.test(str2)) { + return false; + } + + try { + const date1 = new Date(str1).getTime(); + const date2 = new Date(str2).getTime(); + return date1 === date2; + } catch { + return false; + } +} diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 000000000..10185ed2e --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": null, + "rootDir": "..", + "baseUrl": ".." + }, + "include": ["../src", "../tests"], + "exclude": [] +} diff --git a/tests/unit/base64.test.ts b/tests/unit/base64.test.ts new file mode 100644 index 000000000..939594ca2 --- /dev/null +++ b/tests/unit/base64.test.ts @@ -0,0 +1,53 @@ +import { base64Decode, base64Encode } from "../../src/core/base64"; + +describe("base64", () => { + describe("base64Encode", () => { + it("should encode ASCII strings", () => { + expect(base64Encode("hello")).toBe("aGVsbG8="); + expect(base64Encode("")).toBe(""); + }); + + it("should encode UTF-8 strings", () => { + expect(base64Encode("café")).toBe("Y2Fmw6k="); + expect(base64Encode("🎉")).toBe("8J+OiQ=="); + }); + + it("should handle basic auth credentials", () => { + expect(base64Encode("username:password")).toBe("dXNlcm5hbWU6cGFzc3dvcmQ="); + }); + }); + + describe("base64Decode", () => { + it("should decode ASCII strings", () => { + expect(base64Decode("aGVsbG8=")).toBe("hello"); + expect(base64Decode("")).toBe(""); + }); + + it("should decode UTF-8 strings", () => { + expect(base64Decode("Y2Fmw6k=")).toBe("café"); + expect(base64Decode("8J+OiQ==")).toBe("🎉"); + }); + + it("should handle basic auth credentials", () => { + expect(base64Decode("dXNlcm5hbWU6cGFzc3dvcmQ=")).toBe("username:password"); + }); + }); + + describe("round-trip encoding", () => { + const testStrings = [ + "hello world", + "test@example.com", + "café", + "username:password", + "user@domain.com:super$ecret123!", + ]; + + testStrings.forEach((testString) => { + it(`should round-trip encode/decode: "${testString}"`, () => { + const encoded = base64Encode(testString); + const decoded = base64Decode(encoded); + expect(decoded).toBe(testString); + }); + }); + }); +}); diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts index a32945e94..a9bd945dd 100644 --- a/tests/unit/fetcher/Fetcher.test.ts +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -1,7 +1,9 @@ import fs from "fs"; +import stream from "stream"; import { join } from "path"; import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; +import { BinaryResponse } from "../../../src/core"; describe("Test fetcherImpl", () => { it("should handle successful request", async () => { @@ -12,14 +14,15 @@ describe("Test fetcherImpl", () => { body: { data: "test" }, contentType: "application/json", requestType: "json", + responseType: "json", }; - global.fetch = jest.fn().mockResolvedValue({ - ok: true, - status: 200, - text: () => Promise.resolve(JSON.stringify({ data: "test" })), - json: () => ({ data: "test" }), - }); + global.fetch = jest.fn().mockResolvedValue( + new Response(JSON.stringify({ data: "test" }), { + status: 200, + statusText: "OK", + }), + ); const result = await fetcherImpl(mockArgs); expect(result.ok).toBe(true); @@ -45,16 +48,16 @@ describe("Test fetcherImpl", () => { headers: { "X-Test": "x-test-header" }, contentType: "application/octet-stream", requestType: "bytes", - duplex: "half", + responseType: "json", 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" }), - }); + global.fetch = jest.fn().mockResolvedValue( + new Response(JSON.stringify({ data: "test" }), { + status: 200, + statusText: "OK", + }), + ); const result = await fetcherImpl(mockArgs); @@ -71,4 +74,183 @@ describe("Test fetcherImpl", () => { expect(result.body).toEqual({ data: "test" }); } }); + + it("should receive file as stream", async () => { + const url = "https://httpbin.org/post/file"; + const mockArgs: Fetcher.Args = { + url, + method: "GET", + headers: { "X-Test": "x-test-header" }, + responseType: "binary-response", + }; + + global.fetch = jest.fn().mockResolvedValue( + new Response( + stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, + { + status: 200, + statusText: "OK", + }, + ), + ); + + const result = await fetcherImpl(mockArgs); + + expect(global.fetch).toHaveBeenCalledWith( + url, + expect.objectContaining({ + method: "GET", + headers: expect.objectContaining({ "X-Test": "x-test-header" }), + }), + ); + expect(result.ok).toBe(true); + if (result.ok) { + const body = result.body as BinaryResponse; + expect(body).toBeDefined(); + expect(body.bodyUsed).toBe(false); + expect(typeof body.stream).toBe("function"); + const stream = body.stream(); + expect(stream).toBeInstanceOf(ReadableStream); + const reader = stream.getReader(); + const { value } = await reader.read(); + const decoder = new TextDecoder(); + const streamContent = decoder.decode(value); + expect(streamContent).toBe("This is a test file!\n"); + expect(body.bodyUsed).toBe(true); + } + }); + + it("should receive file as blob", async () => { + const url = "https://httpbin.org/post/file"; + const mockArgs: Fetcher.Args = { + url, + method: "GET", + headers: { "X-Test": "x-test-header" }, + responseType: "binary-response", + }; + + global.fetch = jest.fn().mockResolvedValue( + new Response( + stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, + { + status: 200, + statusText: "OK", + }, + ), + ); + + const result = await fetcherImpl(mockArgs); + + expect(global.fetch).toHaveBeenCalledWith( + url, + expect.objectContaining({ + method: "GET", + headers: expect.objectContaining({ "X-Test": "x-test-header" }), + }), + ); + expect(result.ok).toBe(true); + if (result.ok) { + const body = result.body as BinaryResponse; + expect(body).toBeDefined(); + expect(body.bodyUsed).toBe(false); + expect(typeof body.blob).toBe("function"); + const blob = await body.blob(); + expect(blob).toBeInstanceOf(Blob); + const reader = blob.stream().getReader(); + const { value } = await reader.read(); + const decoder = new TextDecoder(); + const streamContent = decoder.decode(value); + expect(streamContent).toBe("This is a test file!\n"); + expect(body.bodyUsed).toBe(true); + } + }); + + it("should receive file as arraybuffer", async () => { + const url = "https://httpbin.org/post/file"; + const mockArgs: Fetcher.Args = { + url, + method: "GET", + headers: { "X-Test": "x-test-header" }, + responseType: "binary-response", + }; + + global.fetch = jest.fn().mockResolvedValue( + new Response( + stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, + { + status: 200, + statusText: "OK", + }, + ), + ); + + const result = await fetcherImpl(mockArgs); + + expect(global.fetch).toHaveBeenCalledWith( + url, + expect.objectContaining({ + method: "GET", + headers: expect.objectContaining({ "X-Test": "x-test-header" }), + }), + ); + expect(result.ok).toBe(true); + if (result.ok) { + const body = result.body as BinaryResponse; + expect(body).toBeDefined(); + expect(body.bodyUsed).toBe(false); + expect(typeof body.arrayBuffer).toBe("function"); + const arrayBuffer = await body.arrayBuffer(); + expect(arrayBuffer).toBeInstanceOf(ArrayBuffer); + const decoder = new TextDecoder(); + const streamContent = decoder.decode(new Uint8Array(arrayBuffer)); + expect(streamContent).toBe("This is a test file!\n"); + expect(body.bodyUsed).toBe(true); + } + }); + + it("should receive file as bytes", async () => { + const url = "https://httpbin.org/post/file"; + const mockArgs: Fetcher.Args = { + url, + method: "GET", + headers: { "X-Test": "x-test-header" }, + responseType: "binary-response", + }; + + global.fetch = jest.fn().mockResolvedValue( + new Response( + stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, + { + status: 200, + statusText: "OK", + }, + ), + ); + + const result = await fetcherImpl(mockArgs); + + expect(global.fetch).toHaveBeenCalledWith( + url, + expect.objectContaining({ + method: "GET", + headers: expect.objectContaining({ "X-Test": "x-test-header" }), + }), + ); + expect(result.ok).toBe(true); + if (result.ok) { + const body = result.body as BinaryResponse; + expect(body).toBeDefined(); + expect(body.bodyUsed).toBe(false); + expect(typeof body.bytes).toBe("function"); + if (!body.bytes) { + return; + } + const bytes = await body.bytes(); + expect(bytes).toBeInstanceOf(Uint8Array); + const decoder = new TextDecoder(); + const streamContent = decoder.decode(bytes); + expect(streamContent).toBe("This is a test file!\n"); + expect(body.bodyUsed).toBe(true); + } + }); }); diff --git a/tests/unit/fetcher/HttpResponsePromise.test.ts b/tests/unit/fetcher/HttpResponsePromise.test.ts new file mode 100644 index 000000000..2216a33e1 --- /dev/null +++ b/tests/unit/fetcher/HttpResponsePromise.test.ts @@ -0,0 +1,143 @@ +import { beforeEach, describe, expect, it, jest } from "@jest/globals"; + +import { HttpResponsePromise } from "../../../src/core/fetcher/HttpResponsePromise"; +import { RawResponse, WithRawResponse } from "../../../src/core/fetcher/RawResponse"; + +describe("HttpResponsePromise", () => { + const mockRawResponse: RawResponse = { + headers: new Headers(), + redirected: false, + status: 200, + statusText: "OK", + type: "basic" as ResponseType, + url: "https://example.com", + }; + const mockData = { id: "123", name: "test" }; + const mockWithRawResponse: WithRawResponse = { + data: mockData, + rawResponse: mockRawResponse, + }; + + describe("fromFunction", () => { + it("should create an HttpResponsePromise from a function", async () => { + const mockFn = jest + .fn<(arg1: string, arg2: string) => Promise>>() + .mockResolvedValue(mockWithRawResponse); + + const responsePromise = HttpResponsePromise.fromFunction(mockFn, "arg1", "arg2"); + + const result = await responsePromise; + expect(result).toEqual(mockData); + expect(mockFn).toHaveBeenCalledWith("arg1", "arg2"); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("fromPromise", () => { + it("should create an HttpResponsePromise from a promise", async () => { + const promise = Promise.resolve(mockWithRawResponse); + + const responsePromise = HttpResponsePromise.fromPromise(promise); + + const result = await responsePromise; + expect(result).toEqual(mockData); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("fromExecutor", () => { + it("should create an HttpResponsePromise from an executor function", async () => { + const responsePromise = HttpResponsePromise.fromExecutor((resolve) => { + resolve(mockWithRawResponse); + }); + + const result = await responsePromise; + expect(result).toEqual(mockData); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("fromResult", () => { + it("should create an HttpResponsePromise from a result", async () => { + const responsePromise = HttpResponsePromise.fromResult(mockWithRawResponse); + + const result = await responsePromise; + expect(result).toEqual(mockData); + + const resultWithRawResponse = await responsePromise.withRawResponse(); + expect(resultWithRawResponse).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); + + describe("Promise methods", () => { + let responsePromise: HttpResponsePromise; + + beforeEach(() => { + responsePromise = HttpResponsePromise.fromResult(mockWithRawResponse); + }); + + it("should support then() method", async () => { + const result = await responsePromise.then((data) => ({ + ...data, + modified: true, + })); + + expect(result).toEqual({ + ...mockData, + modified: true, + }); + }); + + it("should support catch() method", async () => { + const errorResponsePromise = HttpResponsePromise.fromExecutor((_, reject) => { + reject(new Error("Test error")); + }); + + const catchSpy = jest.fn(); + await errorResponsePromise.catch(catchSpy); + + expect(catchSpy).toHaveBeenCalled(); + const error = catchSpy.mock.calls[0]?.[0]; + expect(error).toBeInstanceOf(Error); + expect((error as Error).message).toBe("Test error"); + }); + + it("should support finally() method", async () => { + const finallySpy = jest.fn(); + await responsePromise.finally(finallySpy); + + expect(finallySpy).toHaveBeenCalled(); + }); + }); + + describe("withRawResponse", () => { + it("should return both data and raw response", async () => { + const responsePromise = HttpResponsePromise.fromResult(mockWithRawResponse); + + const result = await responsePromise.withRawResponse(); + + expect(result).toEqual({ + data: mockData, + rawResponse: mockRawResponse, + }); + }); + }); +}); diff --git a/tests/unit/fetcher/RawResponse.test.ts b/tests/unit/fetcher/RawResponse.test.ts new file mode 100644 index 000000000..9ccd5e1eb --- /dev/null +++ b/tests/unit/fetcher/RawResponse.test.ts @@ -0,0 +1,34 @@ +import { describe, expect, it } from "@jest/globals"; + +import { toRawResponse } from "../../../src/core/fetcher/RawResponse"; + +describe("RawResponse", () => { + describe("toRawResponse", () => { + it("should convert Response to RawResponse by removing body, bodyUsed, and ok properties", () => { + const mockHeaders = new Headers({ "content-type": "application/json" }); + const mockResponse = { + body: "test body", + bodyUsed: false, + ok: true, + headers: mockHeaders, + redirected: false, + status: 200, + statusText: "OK", + type: "basic" as ResponseType, + url: "https://example.com", + }; + + const result = toRawResponse(mockResponse as unknown as Response); + + expect("body" in result).toBe(false); + expect("bodyUsed" in result).toBe(false); + expect("ok" in result).toBe(false); + expect(result.headers).toBe(mockHeaders); + expect(result.redirected).toBe(false); + expect(result.status).toBe(200); + expect(result.statusText).toBe("OK"); + expect(result.type).toBe("basic"); + expect(result.url).toBe("https://example.com"); + }); + }); +}); diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts index 486e1e614..06e03b2c6 100644 --- a/tests/unit/fetcher/createRequestUrl.test.ts +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -48,4 +48,113 @@ describe("Test createRequestUrl", () => { const queryParams = { special: "a&b=c d" }; expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?special=a%26b%3Dc%20d"); }); + + // Additional tests for edge cases and different value types + it("should handle numeric values", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { count: 42, price: 19.99, active: 1, inactive: 0 }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?count=42&price=19.99&active=1&inactive=0", + ); + }); + + it("should handle boolean values", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { enabled: true, disabled: false }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?enabled=true&disabled=false"); + }); + + it("should handle null and undefined values", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + valid: "value", + nullValue: null, + undefinedValue: undefined, + emptyString: "", + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?valid=value&nullValue=&emptyString=", + ); + }); + + it("should handle deeply nested objects", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + user: { + profile: { + name: "John", + settings: { theme: "dark" }, + }, + }, + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", + ); + }); + + it("should handle arrays of objects", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + users: [ + { name: "John", age: 30 }, + { name: "Jane", age: 25 }, + ], + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?users%5Bname%5D=John&users%5Bage%5D=30&users%5Bname%5D=Jane&users%5Bage%5D=25", + ); + }); + + it("should handle mixed arrays", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + mixed: ["string", 42, true, { key: "value" }], + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?mixed=string&mixed=42&mixed=true&mixed%5Bkey%5D=value", + ); + }); + + it("should handle empty arrays", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { emptyArray: [] }; + expect(createRequestUrl(baseUrl, queryParams)).toBe(baseUrl); + }); + + it("should handle empty objects", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { emptyObject: {} }; + expect(createRequestUrl(baseUrl, queryParams)).toBe(baseUrl); + }); + + it("should handle special characters in keys", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { "key with spaces": "value", "key[with]brackets": "value" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?key%20with%20spaces=value&key%5Bwith%5Dbrackets=value", + ); + }); + + it("should handle URL with existing query parameters", () => { + const baseUrl = "https://api.example.com?existing=param"; + const queryParams = { new: "value" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?existing=param?new=value"); + }); + + it("should handle complex nested structures", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, + }, + sort: { field: "name", direction: "asc" }, + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + ); + }); }); diff --git a/tests/unit/fetcher/getFetchFn.test.ts b/tests/unit/fetcher/getFetchFn.test.ts deleted file mode 100644 index 9b315ad09..000000000 --- a/tests/unit/fetcher/getFetchFn.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -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 index 919604c2e..e864c8b57 100644 --- a/tests/unit/fetcher/getRequestBody.test.ts +++ b/tests/unit/fetcher/getRequestBody.test.ts @@ -1,19 +1,7 @@ -import { RUNTIME } from "../../../src/core/runtime"; import { getRequestBody } from "../../../src/core/fetcher/getRequestBody"; +import { RUNTIME } from "../../../src/core/runtime"; 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" }; @@ -27,7 +15,7 @@ describe("Test getRequestBody", () => { it("should return FormData in browser environment", async () => { if (RUNTIME.type === "browser") { - const formData = new (await import("form-data")).default(); + const formData = new FormData(); formData.append("key", "value"); const result = await getRequestBody({ body: formData, diff --git a/tests/unit/fetcher/getResponseBody.test.ts b/tests/unit/fetcher/getResponseBody.test.ts index 1030c517c..400782f55 100644 --- a/tests/unit/fetcher/getResponseBody.test.ts +++ b/tests/unit/fetcher/getResponseBody.test.ts @@ -1,6 +1,5 @@ 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 () => { @@ -21,13 +20,27 @@ describe("Test getResponseBody", () => { }); 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()))); - } + // Create a ReadableStream with some test data + const encoder = new TextEncoder(); + const testData = "test stream data"; + const mockStream = new ReadableStream({ + start(controller) { + controller.enqueue(encoder.encode(testData)); + controller.close(); + }, + }); + + const mockResponse = new Response(mockStream); + const result = (await getResponseBody(mockResponse, "streaming")) as ReadableStream; + + expect(result).toBeInstanceOf(ReadableStream); + + // Read and verify the stream content + const reader = result.getReader(); + const decoder = new TextDecoder(); + const { value } = await reader.read(); + const streamContent = decoder.decode(value); + expect(streamContent).toBe(testData); }); it("should handle text response type", async () => { diff --git a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts deleted file mode 100644 index 1dc9be0cc..000000000 --- a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts +++ /dev/null @@ -1,178 +0,0 @@ -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 deleted file mode 100644 index 0c99d3b26..000000000 --- a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts +++ /dev/null @@ -1,124 +0,0 @@ -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 deleted file mode 100644 index 1d171ce6c..000000000 --- a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts +++ /dev/null @@ -1,153 +0,0 @@ -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 deleted file mode 100644 index 8004e9abb..000000000 --- a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -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/form-data-utils/encodeAsFormParameter.test.ts b/tests/unit/form-data-utils/encodeAsFormParameter.test.ts new file mode 100644 index 000000000..d4b0c4503 --- /dev/null +++ b/tests/unit/form-data-utils/encodeAsFormParameter.test.ts @@ -0,0 +1,344 @@ +import { encodeAsFormParameter } from "../../../src/core/form-data-utils/encodeAsFormParameter"; + +describe("encodeAsFormParameter", () => { + describe("Basic functionality", () => { + it("should return empty object for null/undefined", () => { + expect(encodeAsFormParameter(null)).toEqual({}); + expect(encodeAsFormParameter(undefined)).toEqual({}); + }); + + it("should return empty object for primitive values", () => { + expect(encodeAsFormParameter("hello")).toEqual({}); + expect(encodeAsFormParameter(42)).toEqual({}); + expect(encodeAsFormParameter(true)).toEqual({}); + }); + + it("should handle simple key-value pairs", () => { + const obj = { name: "John", age: 30 }; + expect(encodeAsFormParameter(obj)).toEqual({ + name: "John", + age: "30", + }); + }); + + it("should handle empty objects", () => { + expect(encodeAsFormParameter({})).toEqual({}); + }); + }); + + describe("Array handling", () => { + it("should handle arrays with indices format (default)", () => { + const obj = { items: ["a", "b", "c"] }; + expect(encodeAsFormParameter(obj)).toEqual({ + "items[0]": "a", + "items[1]": "b", + "items[2]": "c", + }); + }); + + it("should handle empty arrays", () => { + const obj = { items: [] }; + expect(encodeAsFormParameter(obj)).toEqual({}); + }); + + it("should handle arrays with mixed types", () => { + const obj = { mixed: ["string", 42, true, false] }; + expect(encodeAsFormParameter(obj)).toEqual({ + "mixed[0]": "string", + "mixed[1]": "42", + "mixed[2]": "true", + "mixed[3]": "false", + }); + }); + + it("should handle arrays with objects", () => { + const obj = { users: [{ name: "John" }, { name: "Jane" }] }; + expect(encodeAsFormParameter(obj)).toEqual({ + "users[0][name]": "John", + "users[1][name]": "Jane", + }); + }); + + it("should handle arrays with null/undefined values", () => { + const obj = { items: ["a", null, "c", undefined, "e"] }; + expect(encodeAsFormParameter(obj)).toEqual({ + "items[0]": "a", + "items[1]": "", + "items[2]": "c", + "items[4]": "e", + }); + }); + }); + + describe("Nested objects", () => { + it("should handle nested objects", () => { + const obj = { user: { name: "John", age: 30 } }; + expect(encodeAsFormParameter(obj)).toEqual({ + "user[name]": "John", + "user[age]": "30", + }); + }); + + it("should handle deeply nested objects", () => { + const obj = { user: { profile: { name: "John", settings: { theme: "dark" } } } }; + expect(encodeAsFormParameter(obj)).toEqual({ + "user[profile][name]": "John", + "user[profile][settings][theme]": "dark", + }); + }); + + it("should handle empty nested objects", () => { + const obj = { user: {} }; + expect(encodeAsFormParameter(obj)).toEqual({}); + }); + }); + + describe("Special characters and encoding", () => { + it("should not encode values (encode: false is used)", () => { + const obj = { name: "John Doe", email: "john@example.com" }; + expect(encodeAsFormParameter(obj)).toEqual({ + name: "John Doe", + email: "john@example.com", + }); + }); + + it("should not encode special characters in keys", () => { + const obj = { "user name": "John", "email[primary]": "john@example.com" }; + expect(encodeAsFormParameter(obj)).toEqual({ + "user name": "John", + "email[primary]": "john@example.com", + }); + }); + + it("should handle values that contain special characters", () => { + const obj = { + query: "search term with spaces", + filter: "category:electronics", + }; + expect(encodeAsFormParameter(obj)).toEqual({ + query: "search term with spaces", + filter: "category:electronics", + }); + }); + + it("should handle ampersand and equals characters (edge case)", () => { + // Note: Values containing & and = may be problematic because + // encodeAsFormParameter splits on these characters when parsing the stringified result + const obj = { + message: "Hello & welcome", + equation: "x = y + z", + }; + // This demonstrates the limitation - ampersands and equals signs in values + // will cause the parameter to be split incorrectly + const result = encodeAsFormParameter(obj); + + // We expect this to be parsed incorrectly due to the implementation + expect(result.message).toBe("Hello "); + expect(result[" welcome"]).toBeUndefined(); + expect(result.equation).toBe("x "); + expect(result[" y + z"]).toBeUndefined(); + }); + }); + + describe("Form data specific scenarios", () => { + it("should handle file upload metadata", () => { + const metadata = { + file: { + name: "document.pdf", + size: 1024, + type: "application/pdf", + }, + options: { + compress: true, + quality: 0.8, + }, + }; + expect(encodeAsFormParameter(metadata)).toEqual({ + "file[name]": "document.pdf", + "file[size]": "1024", + "file[type]": "application/pdf", + "options[compress]": "true", + "options[quality]": "0.8", + }); + }); + + it("should handle form validation data", () => { + const formData = { + fields: ["name", "email", "phone"], + validation: { + required: ["name", "email"], + patterns: { + email: "^[^@]+@[^@]+\\.[^@]+$", + phone: "^\\+?[1-9]\\d{1,14}$", + }, + }, + }; + expect(encodeAsFormParameter(formData)).toEqual({ + "fields[0]": "name", + "fields[1]": "email", + "fields[2]": "phone", + "validation[required][0]": "name", + "validation[required][1]": "email", + "validation[patterns][email]": "^[^@]+@[^@]+\\.[^@]+$", + "validation[patterns][phone]": "^\\+?[1-9]\\d{1,14}$", + }); + }); + + it("should handle search/filter parameters", () => { + const searchParams = { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, + }, + sort: { field: "name", direction: "asc" }, + pagination: { page: 1, limit: 20 }, + }; + expect(encodeAsFormParameter(searchParams)).toEqual({ + "filters[status][0]": "active", + "filters[status][1]": "pending", + "filters[category][type]": "electronics", + "filters[category][subcategories][0]": "phones", + "filters[category][subcategories][1]": "laptops", + "sort[field]": "name", + "sort[direction]": "asc", + "pagination[page]": "1", + "pagination[limit]": "20", + }); + }); + }); + + describe("Edge cases", () => { + it("should handle boolean values", () => { + const obj = { enabled: true, disabled: false }; + expect(encodeAsFormParameter(obj)).toEqual({ + enabled: "true", + disabled: "false", + }); + }); + + it("should handle empty strings", () => { + const obj = { name: "", description: "test" }; + expect(encodeAsFormParameter(obj)).toEqual({ + name: "", + description: "test", + }); + }); + + it("should handle zero values", () => { + const obj = { count: 0, price: 0.0 }; + expect(encodeAsFormParameter(obj)).toEqual({ + count: "0", + price: "0", + }); + }); + + it("should handle numeric keys", () => { + const obj = { "0": "zero", "1": "one" }; + expect(encodeAsFormParameter(obj)).toEqual({ + "0": "zero", + "1": "one", + }); + }); + + it("should handle objects with null/undefined values", () => { + const obj = { name: "John", age: null, email: undefined, active: true }; + expect(encodeAsFormParameter(obj)).toEqual({ + name: "John", + age: "", + active: "true", + }); + }); + }); + + describe("Integration with form submission", () => { + it("should produce form-compatible key-value pairs", () => { + const formObject = { + username: "john_doe", + preferences: { + theme: "dark", + notifications: ["email", "push"], + settings: { + autoSave: true, + timeout: 300, + }, + }, + }; + + const result = encodeAsFormParameter(formObject); + + // Verify all values are strings (as required for form data) + Object.values(result).forEach((value) => { + expect(typeof value).toBe("string"); + }); + + // Verify the structure can be reconstructed + expect(result).toEqual({ + username: "john_doe", + "preferences[theme]": "dark", + "preferences[notifications][0]": "email", + "preferences[notifications][1]": "push", + "preferences[settings][autoSave]": "true", + "preferences[settings][timeout]": "300", + }); + }); + + it("should handle complex nested arrays for API parameters", () => { + const apiParams = { + query: { + filters: [ + { field: "status", operator: "eq", value: "active" }, + { field: "created", operator: "gte", value: "2023-01-01" }, + ], + sort: [ + { field: "name", direction: "asc" }, + { field: "created", direction: "desc" }, + ], + }, + }; + + const result = encodeAsFormParameter(apiParams); + expect(result).toEqual({ + "query[filters][0][field]": "status", + "query[filters][0][operator]": "eq", + "query[filters][0][value]": "active", + "query[filters][1][field]": "created", + "query[filters][1][operator]": "gte", + "query[filters][1][value]": "2023-01-01", + "query[sort][0][field]": "name", + "query[sort][0][direction]": "asc", + "query[sort][1][field]": "created", + "query[sort][1][direction]": "desc", + }); + }); + }); + + describe("Error cases and malformed input", () => { + it("should handle circular references gracefully", () => { + const obj: any = { name: "test" }; + obj.self = obj; + + // This will throw a RangeError due to stack overflow - this is expected behavior + expect(() => encodeAsFormParameter(obj)).toThrow("Maximum call stack size exceeded"); + }); + + it("should handle very deeply nested objects", () => { + let deepObj: any = { value: "deep" }; + for (let i = 0; i < 100; i++) { + deepObj = { level: deepObj }; + } + + expect(() => encodeAsFormParameter(deepObj)).not.toThrow(); + const result = encodeAsFormParameter(deepObj); + expect(Object.keys(result).length).toBeGreaterThan(0); + }); + + it("should handle empty string splitting edge case", () => { + // Test what happens when qs returns an empty string + const result = encodeAsFormParameter({}); + expect(result).toEqual({}); + }); + }); +}); diff --git a/tests/unit/form-data-utils/formDataWrapper.browser.test.ts b/tests/unit/form-data-utils/formDataWrapper.browser.test.ts new file mode 100644 index 000000000..f7667618b --- /dev/null +++ b/tests/unit/form-data-utils/formDataWrapper.browser.test.ts @@ -0,0 +1,378 @@ +import { FormDataWrapper, newFormData } from "../../../src/core/form-data-utils/FormDataWrapper"; + +type FormDataRequest = ReturnType["getRequest"]>; + +async function getFormDataInfo(formRequest: FormDataRequest): Promise<{ + hasFile: boolean; + filename?: string; + contentType?: string; + serialized: string; +}> { + const request = new Request("http://localhost", { + ...formRequest, + method: "POST", + }); + const buffer = await request.arrayBuffer(); + const serialized = new TextDecoder().decode(buffer); + + const filenameMatch = serialized.match(/filename="([^"]+)"/); + const filename = filenameMatch ? filenameMatch[1] : undefined; + + const contentTypeMatch = serialized.match(/Content-Type: ([^\r\n]+)/); + const contentType = contentTypeMatch ? contentTypeMatch[1] : undefined; + + return { + hasFile: !!filename, + filename, + contentType, + serialized, + }; +} + +describe("FormDataWrapper - Browser Environment", () => { + let formData: FormDataWrapper; + + beforeEach(async () => { + formData = new FormDataWrapper(); + await formData.setup(); + }); + + describe("Web ReadableStream", () => { + it("serializes Web ReadableStream with filename", async () => { + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("web stream content")); + controller.close(); + }, + }); + + await formData.appendFile("file", stream, "webstream.txt"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="webstream.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("webstream.txt"); + }); + + it("handles empty Web ReadableStream", async () => { + const stream = new ReadableStream({ + start(controller) { + controller.close(); + }, + }); + + await formData.appendFile("file", stream, "empty.txt"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="empty.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("empty.txt"); + }); + }); + + describe("Browser-specific types", () => { + it("serializes Blob with specified filename and content type", async () => { + const blob = new Blob(["file content"], { type: "text/plain" }); + await formData.appendFile("file", blob, "testfile.txt"); + + const { serialized, hasFile, contentType, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="testfile.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("testfile.txt"); + expect(contentType).toBe("text/plain"); + }); + + it("serializes File and preserves filename", async () => { + const file = new File(["file content"], "testfile.txt", { type: "text/plain" }); + await formData.appendFile("file", file); + + const { serialized, hasFile, contentType, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="testfile.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("testfile.txt"); + expect(contentType).toBe("text/plain"); + }); + + it("allows filename override for File objects", async () => { + const file = new File(["file content"], "original.txt", { type: "text/plain" }); + await formData.appendFile("file", file, "override.txt"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="override.txt"'); + expect(serialized).not.toContain('filename="original.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("override.txt"); + }); + }); + + describe("Binary data types", () => { + it("serializes ArrayBuffer with filename", async () => { + const arrayBuffer = new ArrayBuffer(8); + new Uint8Array(arrayBuffer).set([1, 2, 3, 4, 5, 6, 7, 8]); + + await formData.appendFile("file", arrayBuffer, "binary.bin"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="binary.bin"'); + expect(hasFile).toBe(true); + expect(filename).toBe("binary.bin"); + }); + + it("serializes Uint8Array with filename", async () => { + const uint8Array = new Uint8Array([72, 101, 108, 108, 111]); // "Hello" + await formData.appendFile("file", uint8Array, "binary.bin"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="binary.bin"'); + expect(hasFile).toBe(true); + expect(filename).toBe("binary.bin"); + }); + + it("serializes other typed arrays", async () => { + const int16Array = new Int16Array([1000, 2000, 3000]); + await formData.appendFile("file", int16Array, "numbers.bin"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="numbers.bin"'); + expect(hasFile).toBe(true); + expect(filename).toBe("numbers.bin"); + }); + }); + + describe("Text and primitive types", () => { + it("serializes string as regular form field", async () => { + formData.append("text", "test string"); + + const { serialized, hasFile } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="text"'); + expect(serialized).not.toContain("filename="); + expect(serialized).toContain("test string"); + expect(hasFile).toBe(false); + }); + + it("serializes string as file with filename", async () => { + await formData.appendFile("file", "test content", "text.txt"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="text.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("text.txt"); + }); + + it("serializes numbers and booleans as strings", async () => { + formData.append("number", 12345); + formData.append("flag", true); + + const { serialized } = await getFormDataInfo(formData.getRequest()); + expect(serialized).toContain("12345"); + expect(serialized).toContain("true"); + }); + }); + + describe("Object and JSON handling", () => { + it("serializes objects as JSON with filename", async () => { + const obj = { test: "value", nested: { key: "data" } }; + await formData.appendFile("data", obj, "data.json"); + + const { serialized, hasFile, contentType, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="data"'); + expect(serialized).toContain('filename="data.json"'); + expect(serialized).toContain("Content-Type: application/json"); + expect(hasFile).toBe(true); + expect(filename).toBe("data.json"); + expect(contentType).toBe("application/json"); + }); + + it("serializes arrays as JSON", async () => { + const arr = [1, 2, 3, "test"]; + await formData.appendFile("array", arr, "array.json"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="array"'); + expect(serialized).toContain('filename="array.json"'); + expect(hasFile).toBe(true); + expect(filename).toBe("array.json"); + }); + + it("handles null and undefined values", async () => { + formData.append("nullValue", null); + formData.append("undefinedValue", undefined); + + const { serialized } = await getFormDataInfo(formData.getRequest()); + expect(serialized).toContain("null"); + expect(serialized).toContain("undefined"); + }); + }); + + describe("Filename extraction from objects", () => { + it("extracts filename from object with name property", async () => { + const namedValue = { name: "custom-name.txt", data: "content" }; + await formData.appendFile("file", namedValue); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="custom-name.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("custom-name.txt"); + }); + + it("extracts filename from object with path property", async () => { + const pathedValue = { path: "/some/path/file.txt", content: "data" }; + await formData.appendFile("file", pathedValue); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="file.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("file.txt"); + }); + + it("prioritizes explicit filename over object properties", async () => { + const namedValue = { name: "original.txt", data: "content" }; + await formData.appendFile("file", namedValue, "override.txt"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file"'); + expect(serialized).toContain('filename="override.txt"'); + expect(serialized).not.toContain('filename="original.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("override.txt"); + }); + }); + + describe("Edge cases and error handling", () => { + it("handles empty filename gracefully", async () => { + await formData.appendFile("file", "content", ""); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('Content-Disposition: form-data; name="file"'); + expect(serialized).toContain('filename="blob"'); // Default fallback + expect(hasFile).toBe(true); + expect(filename).toBe("blob"); + }); + + it("handles large strings", async () => { + const largeString = "x".repeat(1000); + await formData.appendFile("large", largeString, "large.txt"); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="large"'); + expect(serialized).toContain('filename="large.txt"'); + expect(hasFile).toBe(true); + expect(filename).toBe("large.txt"); + }); + + it("handles unicode content and filenames", async () => { + const unicodeContent = "Hello 世界 🌍 Emoji 🚀"; + const unicodeFilename = "файл-тест-🌟.txt"; + + await formData.appendFile("unicode", unicodeContent, unicodeFilename); + + const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="unicode"'); + expect(serialized).toContain(`filename="${unicodeFilename}"`); + expect(hasFile).toBe(true); + expect(filename).toBe(unicodeFilename); + }); + + it("handles multiple files in single form", async () => { + await formData.appendFile("file1", "content1", "file1.txt"); + await formData.appendFile("file2", "content2", "file2.txt"); + formData.append("text", "regular field"); + + const { serialized } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toContain('name="file1"'); + expect(serialized).toContain('filename="file1.txt"'); + + expect(serialized).toContain('name="file2"'); + expect(serialized).toContain('filename="file2.txt"'); + + expect(serialized).toContain('name="text"'); + expect(serialized).not.toContain('filename="text"'); + expect(serialized).toContain("regular field"); + }); + }); + + describe("Request structure", () => { + it("returns correct request structure", async () => { + await formData.appendFile("file", "content", "test.txt"); + + const request = formData.getRequest(); + + expect(request).toHaveProperty("body"); + expect(request).toHaveProperty("headers"); + expect(request).toHaveProperty("duplex"); + expect(request.body).toBeInstanceOf(FormData); + expect(request.headers).toEqual({}); + expect(request.duplex).toBe("half"); + }); + + it("generates proper multipart boundary structure", async () => { + await formData.appendFile("file", "test content", "test.txt"); + formData.append("field", "value"); + + const { serialized } = await getFormDataInfo(formData.getRequest()); + + expect(serialized).toMatch(/------formdata-undici-\w+|------WebKitFormBoundary\w+/); + expect(serialized).toContain("Content-Disposition: form-data;"); + expect(serialized).toMatch(/------formdata-undici-\w+--|------WebKitFormBoundary\w+--/); + }); + }); + + describe("Factory function", () => { + it("returns FormDataWrapper instance", async () => { + const formData = await newFormData(); + expect(formData).toBeInstanceOf(FormDataWrapper); + }); + + it("creates independent instances", async () => { + const formData1 = await newFormData(); + const formData2 = await newFormData(); + + await formData1.setup(); + await formData2.setup(); + + formData1.append("test1", "value1"); + formData2.append("test2", "value2"); + + const request1 = formData1.getRequest() as { body: FormData }; + const request2 = formData2.getRequest() as { body: FormData }; + + const entries1 = Array.from(request1.body.entries()); + const entries2 = Array.from(request2.body.entries()); + + expect(entries1).toHaveLength(1); + expect(entries2).toHaveLength(1); + expect(entries1[0][0]).toBe("test1"); + expect(entries2[0][0]).toBe("test2"); + }); + }); +}); diff --git a/tests/unit/form-data-utils/formDataWrapper.test.ts b/tests/unit/form-data-utils/formDataWrapper.test.ts index 61fd5bfc1..0ec0bcaee 100644 --- a/tests/unit/form-data-utils/formDataWrapper.test.ts +++ b/tests/unit/form-data-utils/formDataWrapper.test.ts @@ -1,123 +1,360 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { Node18FormData, WebFormData } from "../../../src/core/form-data-utils/FormDataWrapper"; +import { Readable } from "stream"; +import { FormDataWrapper, newFormData } from "../../../src/core/form-data-utils/FormDataWrapper"; +import { File, Blob } from "buffer"; -describe("CrossPlatformFormData", () => { - describe("Node18FormData", () => { - let formData: any; +// Helper function to serialize FormData to string for inspection +async function serializeFormData(formData: FormData): Promise { + const request = new Request("http://localhost", { + method: "POST", + body: formData, + }); + + const buffer = await request.arrayBuffer(); + return new TextDecoder().decode(buffer); +} + +describe("FormDataWrapper", () => { + let formData: FormDataWrapper; + + beforeEach(async () => { + formData = new FormDataWrapper(); + await formData.setup(); + }); + + describe("Stream handling", () => { + it("serializes Node.js Readable stream with filename", async () => { + const stream = Readable.from(["file content"]); + await formData.appendFile("file", stream, "testfile.txt"); - beforeEach(async () => { - formData = new Node18FormData(); - await formData.setup(); + const serialized = await serializeFormData(formData.getRequest().body); + + expect(serialized).toContain('Content-Disposition: form-data; name="file"'); + expect(serialized).toContain('filename="testfile.txt"'); + expect(serialized).toContain("file content"); }); - 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"; + it("auto-detects filename from stream path property", async () => { + const stream = Readable.from(["file content"]); + (stream as { path?: string }).path = "/test/path/testfile.txt"; - await formData.appendFile("file", value, filename); + await formData.appendFile("file", stream); - 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); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="testfile.txt"'); }); - it("should append a Blob with a specified filename", async () => { - const value = new Blob(["file content"], { type: "text/plain" }); - const filename = "testfile.txt"; + it("handles Windows-style paths", async () => { + const stream = Readable.from(["file content"]); + (stream as { path?: string }).path = "C:\\test\\path\\testfile.txt"; - await formData.appendFile("file", value, filename); + await formData.appendFile("file", stream); - 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); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="testfile.txt"'); + }); + + it("handles empty streams", async () => { + const stream = Readable.from([]); + await formData.appendFile("file", stream, "empty.txt"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="empty.txt"'); + expect(serialized).toMatch(/------formdata-undici-\w+|------WebKitFormBoundary\w+/); + }); + + it("serializes Web ReadableStream with filename", async () => { + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("web stream content")); + controller.close(); + }, + }); + + await formData.appendFile("file", stream, "webstream.txt"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="webstream.txt"'); + expect(serialized).toContain("web stream content"); }); - it("should append a File with a specified filename", async () => { - const filename = "testfile.txt"; - const value = new (await import("buffer")).File(["file content"], filename); + it("handles empty Web ReadableStream", async () => { + const stream = new ReadableStream({ + start(controller) { + controller.close(); + }, + }); + + await formData.appendFile("file", stream, "empty.txt"); - await formData.appendFile("file", value); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="empty.txt"'); + expect(serialized).toMatch(/------formdata-undici-\w+|------WebKitFormBoundary\w+/); + }); + }); + + describe("Blob and File types", () => { + it("serializes Blob with specified filename", async () => { + const blob = new Blob(["file content"], { type: "text/plain" }); + await formData.appendFile("file", blob, "testfile.txt"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="testfile.txt"'); + expect(serialized).toContain("Content-Type: text/plain"); + expect(serialized).toContain("file content"); + }); - const request = await formData.getRequest(); - const decoder = new TextDecoder("utf-8"); - let data = ""; - for await (const chunk of request.body) { - data += decoder.decode(chunk); + it("uses default filename for Blob without explicit filename", async () => { + const blob = new Blob(["file content"], { type: "text/plain" }); + await formData.appendFile("file", blob); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="blob"'); + }); + + it("preserves File object filename", async () => { + if (typeof File !== "undefined") { + const file = new File(["file content"], "original.txt", { type: "text/plain" }); + await formData.appendFile("file", file); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="original.txt"'); + expect(serialized).toContain("file content"); } - 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); + it("allows filename override for File objects", async () => { + if (typeof File !== "undefined") { + const file = new File(["file content"], "original.txt", { type: "text/plain" }); + await formData.appendFile("file", file, "override.txt"); - await formData.appendFile("file", value, "test.txt"); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="override.txt"'); + expect(serialized).not.toContain('filename="original.txt"'); + } + }); + }); + + describe("Binary data types", () => { + it("serializes ArrayBuffer with filename", async () => { + const arrayBuffer = new ArrayBuffer(8); + new Uint8Array(arrayBuffer).set([1, 2, 3, 4, 5, 6, 7, 8]); + + await formData.appendFile("file", arrayBuffer, "binary.bin"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="binary.bin"'); + expect(serialized).toMatch(/------formdata-undici-\w+|------WebKitFormBoundary\w+/); + }); - const request = await formData.getRequest(); - const decoder = new TextDecoder("utf-8"); - let data = ""; - for await (const chunk of request.body) { - data += decoder.decode(chunk); + it("serializes Uint8Array with filename", async () => { + const uint8Array = new Uint8Array([72, 101, 108, 108, 111]); // "Hello" + await formData.appendFile("file", uint8Array, "binary.bin"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="binary.bin"'); + expect(serialized).toContain("Hello"); + }); + + it("serializes other typed arrays", async () => { + const int16Array = new Int16Array([1000, 2000, 3000]); + await formData.appendFile("file", int16Array, "numbers.bin"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="numbers.bin"'); + }); + + it("serializes Buffer data with filename", async () => { + if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer === "function") { + const buffer = Buffer.from("test content"); + await formData.appendFile("file", buffer, "test.txt"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="test.txt"'); + expect(serialized).toContain("test content"); } - expect(data).toContain("test.txt"); }); }); - describe("WebFormData", () => { - let formData: any; + describe("Text and primitive types", () => { + it("serializes string as regular form field", async () => { + formData.append("text", "test string"); - beforeEach(async () => { - formData = new WebFormData(); - await formData.setup(); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('name="text"'); + expect(serialized).not.toContain("filename="); + expect(serialized).toContain("test string"); }); - 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"; + it("serializes string as file with filename", async () => { + await formData.appendFile("file", "test content", "text.txt"); - await formData.appendFile("file", value, filename); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="text.txt"'); + expect(serialized).toContain("test content"); + }); - const request = formData.getRequest(); - expect(request.body.get("file").name).toBe(filename); + it("serializes numbers and booleans as strings", async () => { + formData.append("number", 12345); + formData.append("flag", true); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain("12345"); + expect(serialized).toContain("true"); }); + }); - it("should append a Blob with a specified filename", async () => { - const value = new Blob(["file content"], { type: "text/plain" }); - const filename = "testfile.txt"; + describe("Object and JSON handling", () => { + it("serializes objects as JSON with filename", async () => { + const obj = { test: "value", nested: { key: "data" } }; + await formData.appendFile("data", obj, "data.json"); - await formData.appendFile("file", value, filename); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="data.json"'); + expect(serialized).toContain("Content-Type: application/json"); + expect(serialized).toContain(JSON.stringify(obj)); + }); - const request = formData.getRequest(); + it("serializes arrays as JSON", async () => { + const arr = [1, 2, 3, "test"]; + await formData.appendFile("array", arr, "array.json"); - expect(request.body.get("file").name).toBe(filename); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="array.json"'); + expect(serialized).toContain(JSON.stringify(arr)); }); - it("should append a File with a specified filename", async () => { - const filename = "testfile.txt"; - const value = new (await import("buffer")).File(["file content"], filename); + it("handles null and undefined values", async () => { + formData.append("nullValue", null); + formData.append("undefinedValue", undefined); - await formData.appendFile("file", value); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain("null"); + expect(serialized).toContain("undefined"); + }); + }); - const request = formData.getRequest(); - expect(request.body.get("file").name).toBe(filename); + describe("Filename extraction from objects", () => { + it("extracts filename from object with name property", async () => { + const namedValue = { name: "custom-name.txt", data: "content" }; + await formData.appendFile("file", namedValue); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="custom-name.txt"'); + expect(serialized).toContain(JSON.stringify(namedValue)); + }); + + it("extracts filename from object with path property", async () => { + const pathedValue = { path: "/some/path/file.txt", content: "data" }; + await formData.appendFile("file", pathedValue); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="file.txt"'); + }); + + it("prioritizes explicit filename over object properties", async () => { + const namedValue = { name: "original.txt", data: "content" }; + await formData.appendFile("file", namedValue, "override.txt"); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="override.txt"'); + expect(serialized).not.toContain('filename="original.txt"'); + }); + }); + + describe("Edge cases and error handling", () => { + it("handles empty filename gracefully", async () => { + await formData.appendFile("file", "content", ""); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="blob"'); // Default fallback }); - it("should append a File with an explicit filename", async () => { - const filename = "testfile.txt"; - const value = new (await import("buffer")).File(["file content"], filename); + it("handles large strings", async () => { + const largeString = "x".repeat(1000); + await formData.appendFile("large", largeString, "large.txt"); - await formData.appendFile("file", value, "test.txt"); + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="large.txt"'); + }); + + it("handles unicode content and filenames", async () => { + const unicodeContent = "Hello 世界 🌍 Emoji 🚀"; + const unicodeFilename = "файл-тест-🌟.txt"; + + await formData.appendFile("unicode", unicodeContent, unicodeFilename); + + const serialized = await serializeFormData(formData.getRequest().body); + expect(serialized).toContain('filename="' + unicodeFilename + '"'); + expect(serialized).toContain(unicodeContent); + }); + + it("handles multiple files in single form", async () => { + await formData.appendFile("file1", "content1", "file1.txt"); + await formData.appendFile("file2", "content2", "file2.txt"); + formData.append("text", "regular field"); + + const serialized = await serializeFormData(formData.getRequest().body); + + expect(serialized).toContain('filename="file1.txt"'); + expect(serialized).toContain('filename="file2.txt"'); + expect(serialized).toContain('name="text"'); + expect(serialized).not.toContain('filename="text"'); + }); + }); + + describe("Request structure", () => { + it("returns correct request structure", async () => { + await formData.appendFile("file", "content", "test.txt"); const request = formData.getRequest(); - expect(request.body.get("file").name).toBe("test.txt"); + + expect(request).toHaveProperty("body"); + expect(request).toHaveProperty("headers"); + expect(request).toHaveProperty("duplex"); + expect(request.body).toBeInstanceOf(FormData); + expect(request.headers).toEqual({}); + expect(request.duplex).toBe("half"); + }); + + it("generates proper multipart boundary structure", async () => { + await formData.appendFile("file", "test content", "test.txt"); + formData.append("field", "value"); + + const serialized = await serializeFormData(formData.getRequest().body); + + expect(serialized).toMatch(/------formdata-undici-\w+|------WebKitFormBoundary\w+/); + expect(serialized).toContain("Content-Disposition: form-data;"); + expect(serialized).toMatch(/------formdata-undici-\w+--|------WebKitFormBoundary\w+--/); + }); + }); + + describe("Factory function", () => { + it("returns FormDataWrapper instance", async () => { + const formData = await newFormData(); + expect(formData).toBeInstanceOf(FormDataWrapper); + }); + + it("creates independent instances", async () => { + const formData1 = await newFormData(); + const formData2 = await newFormData(); + + await formData1.setup(); + await formData2.setup(); + + formData1.append("test1", "value1"); + formData2.append("test2", "value2"); + + const request1 = formData1.getRequest() as { body: FormData }; + const request2 = formData2.getRequest() as { body: FormData }; + + const entries1 = Array.from(request1.body.entries()); + const entries2 = Array.from(request2.body.entries()); + + expect(entries1).toHaveLength(1); + expect(entries2).toHaveLength(1); + expect(entries1[0][0]).toBe("test1"); + expect(entries2[0][0]).toBe("test2"); }); }); }); diff --git a/tests/unit/url/join.test.ts b/tests/unit/url/join.test.ts new file mode 100644 index 000000000..394628995 --- /dev/null +++ b/tests/unit/url/join.test.ts @@ -0,0 +1,101 @@ +import { join } from "../../../src/core/url/index"; + +describe("join", () => { + describe("basic functionality", () => { + it("should return empty string for empty base", () => { + expect(join("")).toBe(""); + expect(join("", "path")).toBe(""); + }); + + it("should handle single segment", () => { + expect(join("base", "segment")).toBe("base/segment"); + expect(join("base/", "segment")).toBe("base/segment"); + expect(join("base", "/segment")).toBe("base/segment"); + expect(join("base/", "/segment")).toBe("base/segment"); + }); + + it("should handle multiple segments", () => { + expect(join("base", "path1", "path2", "path3")).toBe("base/path1/path2/path3"); + expect(join("base/", "/path1/", "/path2/", "/path3/")).toBe("base/path1/path2/path3"); + }); + }); + + describe("URL handling", () => { + it("should handle absolute URLs", () => { + expect(join("https://example.com", "api", "v1")).toBe("https://example.com/api/v1"); + expect(join("https://example.com/", "/api/", "/v1/")).toBe("https://example.com/api/v1"); + expect(join("https://example.com/base", "api", "v1")).toBe("https://example.com/base/api/v1"); + }); + + it("should preserve URL query parameters and fragments", () => { + expect(join("https://example.com?query=1", "api")).toBe("https://example.com/api?query=1"); + expect(join("https://example.com#fragment", "api")).toBe("https://example.com/api#fragment"); + expect(join("https://example.com?query=1#fragment", "api")).toBe( + "https://example.com/api?query=1#fragment", + ); + }); + + it("should handle different protocols", () => { + expect(join("http://example.com", "api")).toBe("http://example.com/api"); + expect(join("ftp://example.com", "files")).toBe("ftp://example.com/files"); + expect(join("ws://example.com", "socket")).toBe("ws://example.com/socket"); + }); + + it("should fallback to path joining for malformed URLs", () => { + expect(join("not-a-url://", "path")).toBe("not-a-url:///path"); + }); + }); + + describe("edge cases", () => { + it("should handle empty segments", () => { + expect(join("base", "", "path")).toBe("base/path"); + expect(join("base", null as any, "path")).toBe("base/path"); + expect(join("base", undefined as any, "path")).toBe("base/path"); + }); + + it("should handle segments with only slashes", () => { + expect(join("base", "/", "path")).toBe("base/path"); + expect(join("base", "//", "path")).toBe("base/path"); + }); + + it("should handle base paths with trailing slashes", () => { + expect(join("base/", "path")).toBe("base/path"); + }); + + it("should handle complex nested paths", () => { + expect(join("api/v1/", "/users/", "/123/", "/profile")).toBe("api/v1/users/123/profile"); + }); + }); + + describe("real-world scenarios", () => { + it("should handle API endpoint construction", () => { + const baseUrl = "https://api.example.com/v1"; + expect(join(baseUrl, "users", "123", "posts")).toBe("https://api.example.com/v1/users/123/posts"); + }); + + it("should handle file path construction", () => { + expect(join("/var/www", "html", "assets", "images")).toBe("/var/www/html/assets/images"); + }); + + it("should handle relative path construction", () => { + expect(join("../parent", "child", "grandchild")).toBe("../parent/child/grandchild"); + }); + + it("should handle Windows-style paths", () => { + expect(join("C:\\Users", "Documents", "file.txt")).toBe("C:\\Users/Documents/file.txt"); + }); + }); + + describe("performance scenarios", () => { + it("should handle many segments efficiently", () => { + const segments = Array(100).fill("segment"); + const result = join("base", ...segments); + expect(result).toBe("base/" + segments.join("/")); + }); + + it("should handle long URLs", () => { + const longPath = "a".repeat(1000); + expect(join("https://example.com", longPath)).toBe(`https://example.com/${longPath}`); + }); + }); +}); diff --git a/tests/unit/url/qs.test.ts b/tests/unit/url/qs.test.ts new file mode 100644 index 000000000..80e7e0444 --- /dev/null +++ b/tests/unit/url/qs.test.ts @@ -0,0 +1,187 @@ +import { toQueryString } from "../../../src/core/url/index"; + +describe("Test qs toQueryString", () => { + describe("Basic functionality", () => { + it("should return empty string for null/undefined", () => { + expect(toQueryString(null)).toBe(""); + expect(toQueryString(undefined)).toBe(""); + }); + + it("should return empty string for primitive values", () => { + expect(toQueryString("hello")).toBe(""); + expect(toQueryString(42)).toBe(""); + expect(toQueryString(true)).toBe(""); + expect(toQueryString(false)).toBe(""); + }); + + it("should handle empty objects", () => { + expect(toQueryString({})).toBe(""); + }); + + it("should handle simple key-value pairs", () => { + const obj = { name: "John", age: 30 }; + expect(toQueryString(obj)).toBe("name=John&age=30"); + }); + }); + + describe("Array handling", () => { + it("should handle arrays with indices format (default)", () => { + const obj = { items: ["a", "b", "c"] }; + expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=b&items%5B2%5D=c"); + }); + + it("should handle arrays with repeat format", () => { + const obj = { items: ["a", "b", "c"] }; + expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe("items=a&items=b&items=c"); + }); + + it("should handle empty arrays", () => { + const obj = { items: [] }; + expect(toQueryString(obj)).toBe(""); + }); + + it("should handle arrays with mixed types", () => { + const obj = { mixed: ["string", 42, true, false] }; + expect(toQueryString(obj)).toBe("mixed%5B0%5D=string&mixed%5B1%5D=42&mixed%5B2%5D=true&mixed%5B3%5D=false"); + }); + + it("should handle arrays with objects", () => { + const obj = { users: [{ name: "John" }, { name: "Jane" }] }; + expect(toQueryString(obj)).toBe("users%5B0%5D%5Bname%5D=John&users%5B1%5D%5Bname%5D=Jane"); + }); + + it("should handle arrays with objects in repeat format", () => { + const obj = { users: [{ name: "John" }, { name: "Jane" }] }; + expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe("users%5Bname%5D=John&users%5Bname%5D=Jane"); + }); + }); + + describe("Nested objects", () => { + it("should handle nested objects", () => { + const obj = { user: { name: "John", age: 30 } }; + expect(toQueryString(obj)).toBe("user%5Bname%5D=John&user%5Bage%5D=30"); + }); + + it("should handle deeply nested objects", () => { + const obj = { user: { profile: { name: "John", settings: { theme: "dark" } } } }; + expect(toQueryString(obj)).toBe( + "user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", + ); + }); + + it("should handle empty nested objects", () => { + const obj = { user: {} }; + expect(toQueryString(obj)).toBe(""); + }); + }); + + describe("Encoding", () => { + it("should encode by default", () => { + const obj = { name: "John Doe", email: "john@example.com" }; + expect(toQueryString(obj)).toBe("name=John%20Doe&email=john%40example.com"); + }); + + it("should not encode when encode is false", () => { + const obj = { name: "John Doe", email: "john@example.com" }; + expect(toQueryString(obj, { encode: false })).toBe("name=John Doe&email=john@example.com"); + }); + + it("should encode special characters in keys", () => { + const obj = { "user name": "John", "email[primary]": "john@example.com" }; + expect(toQueryString(obj)).toBe("user%20name=John&email%5Bprimary%5D=john%40example.com"); + }); + + it("should not encode special characters in keys when encode is false", () => { + const obj = { "user name": "John", "email[primary]": "john@example.com" }; + expect(toQueryString(obj, { encode: false })).toBe("user name=John&email[primary]=john@example.com"); + }); + }); + + describe("Mixed scenarios", () => { + it("should handle complex nested structures", () => { + const obj = { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, + }, + sort: { field: "name", direction: "asc" }, + }; + expect(toQueryString(obj)).toBe( + "filters%5Bstatus%5D%5B0%5D=active&filters%5Bstatus%5D%5B1%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D%5B0%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D%5B1%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + ); + }); + + it("should handle complex nested structures with repeat format", () => { + const obj = { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, + }, + sort: { field: "name", direction: "asc" }, + }; + expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe( + "filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + ); + }); + + it("should handle arrays with null/undefined values", () => { + const obj = { items: ["a", null, "c", undefined, "e"] }; + expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c&items%5B4%5D=e"); + }); + + it("should handle objects with null/undefined values", () => { + const obj = { name: "John", age: null, email: undefined, active: true }; + expect(toQueryString(obj)).toBe("name=John&age=&active=true"); + }); + }); + + describe("Edge cases", () => { + it("should handle numeric keys", () => { + const obj = { "0": "zero", "1": "one" }; + expect(toQueryString(obj)).toBe("0=zero&1=one"); + }); + + it("should handle boolean values in objects", () => { + const obj = { enabled: true, disabled: false }; + expect(toQueryString(obj)).toBe("enabled=true&disabled=false"); + }); + + it("should handle empty strings", () => { + const obj = { name: "", description: "test" }; + expect(toQueryString(obj)).toBe("name=&description=test"); + }); + + it("should handle zero values", () => { + const obj = { count: 0, price: 0.0 }; + expect(toQueryString(obj)).toBe("count=0&price=0"); + }); + + it("should handle arrays with empty strings", () => { + const obj = { items: ["a", "", "c"] }; + expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c"); + }); + }); + + describe("Options combinations", () => { + it("should respect both arrayFormat and encode options", () => { + const obj = { items: ["a & b", "c & d"] }; + expect(toQueryString(obj, { arrayFormat: "repeat", encode: false })).toBe("items=a & b&items=c & d"); + }); + + it("should use default options when none provided", () => { + const obj = { items: ["a", "b"] }; + expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=b"); + }); + + it("should merge provided options with defaults", () => { + const obj = { items: ["a", "b"], name: "John Doe" }; + expect(toQueryString(obj, { encode: false })).toBe("items[0]=a&items[1]=b&name=John Doe"); + }); + }); +}); diff --git a/tests/unit/utils/setObjectProperty.test.ts b/tests/unit/utils/setObjectProperty.test.ts new file mode 100644 index 000000000..29f8e638d --- /dev/null +++ b/tests/unit/utils/setObjectProperty.test.ts @@ -0,0 +1,76 @@ +import { setObjectProperty } from "../../../src/core/utils/setObjectProperty"; + +interface TestCase { + description: string; + giveObject: object; + givePath: string; + giveValue: any; + wantObject: object; +} + +describe("Test setObjectProperty", () => { + const testCases: TestCase[] = [ + { + description: "empty", + giveObject: {}, + givePath: "", + giveValue: 0, + wantObject: { "": 0 }, + }, + { + description: "top-level primitive", + giveObject: {}, + givePath: "age", + giveValue: 42, + wantObject: { age: 42 }, + }, + { + description: "top-level object", + giveObject: {}, + givePath: "name", + giveValue: { first: "John", last: "Doe" }, + wantObject: { name: { first: "John", last: "Doe" } }, + }, + { + description: "top-level array", + giveObject: {}, + givePath: "values", + giveValue: [1, 2, 3], + wantObject: { values: [1, 2, 3] }, + }, + { + description: "nested object property", + giveObject: { + name: { + first: "John", + }, + }, + givePath: "name.last", + giveValue: "Doe", + wantObject: { name: { first: "John", last: "Doe" } }, + }, + { + description: "deeply nested object property", + giveObject: { + info: { + address: { + street: "123 Main St.", + }, + age: 42, + name: { + last: "Doe", + }, + }, + }, + givePath: "info.name.first", + giveValue: "John", + wantObject: { + info: { age: 42, address: { street: "123 Main St." }, name: { first: "John", last: "Doe" } }, + }, + }, + ]; + test.each(testCases)("$description", ({ giveObject, givePath, giveValue, wantObject }) => { + const result = setObjectProperty(giveObject, givePath, giveValue); + expect(result).toEqual(wantObject); + }); +}); diff --git a/tests/unit/zurg/bigint/bigint.test.ts b/tests/unit/zurg/bigint/bigint.test.ts deleted file mode 100644 index 498f143c7..000000000 --- a/tests/unit/zurg/bigint/bigint.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -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 deleted file mode 100644 index 2790268a0..000000000 --- a/tests/unit/zurg/date/date.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index d1707325b..000000000 --- a/tests/unit/zurg/enum/enum.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -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 deleted file mode 100644 index 3a5a338d6..000000000 --- a/tests/unit/zurg/lazy/lazy.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -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 deleted file mode 100644 index 9b443671a..000000000 --- a/tests/unit/zurg/lazy/lazyObject.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 8b7d5e40c..000000000 --- a/tests/unit/zurg/lazy/recursive/a.ts +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index fb219d54c..000000000 --- a/tests/unit/zurg/lazy/recursive/b.ts +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 108789b73..000000000 --- a/tests/unit/zurg/list/list.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index fa6c88873..000000000 --- a/tests/unit/zurg/literals/stringLiteral.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 9f5dd0ed3..000000000 --- a/tests/unit/zurg/object-like/withParsedProperties.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -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 deleted file mode 100644 index 109547137..000000000 --- a/tests/unit/zurg/object/extend.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -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 deleted file mode 100644 index a8d9fe0a1..000000000 --- a/tests/unit/zurg/object/object.test.ts +++ /dev/null @@ -1,255 +0,0 @@ -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 deleted file mode 100644 index efcd83afa..000000000 --- a/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index c8770fca1..000000000 --- a/tests/unit/zurg/object/passthrough.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -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 deleted file mode 100644 index 1adbbe2a8..000000000 --- a/tests/unit/zurg/primitives/any.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 897a8295d..000000000 --- a/tests/unit/zurg/primitives/boolean.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index 2d01415a6..000000000 --- a/tests/unit/zurg/primitives/number.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index 57b236878..000000000 --- a/tests/unit/zurg/primitives/string.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index 4d17a7dbd..000000000 --- a/tests/unit/zurg/primitives/unknown.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index e07f3e7cb..000000000 --- a/tests/unit/zurg/record/record.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100644 index 2cd9b1251..000000000 --- a/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -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 deleted file mode 100644 index 13842ff40..000000000 --- a/tests/unit/zurg/schema.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -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 deleted file mode 100644 index 53a1652c8..000000000 --- a/tests/unit/zurg/set/set.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -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 deleted file mode 100644 index 328355594..000000000 --- a/tests/unit/zurg/skipValidation.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 deleted file mode 100644 index e0ddb21b4..000000000 --- a/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -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 deleted file mode 100644 index 1f5d7a8fa..000000000 --- a/tests/unit/zurg/union/union.test.ts +++ /dev/null @@ -1,113 +0,0 @@ -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 deleted file mode 100644 index 82a538878..000000000 --- a/tests/unit/zurg/utils/itSchema.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* 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 deleted file mode 100644 index ead1ca70b..000000000 --- a/tests/unit/zurg/utils/itValidate.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* 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/tests/wire/.gitkeep b/tests/wire/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/wire/applePay.test.ts b/tests/wire/applePay.test.ts new file mode 100644 index 000000000..0b0627c40 --- /dev/null +++ b/tests/wire/applePay.test.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("ApplePay", () => { + test("RegisterDomain", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { domain_name: "example.com" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + status: "VERIFIED", + }; + server + .mockEndpoint() + .post("/v2/apple-pay/domains") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.applePay.registerDomain({ + domain_name: "example.com", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + status: "VERIFIED", + }); + }); +}); diff --git a/tests/wire/bankAccounts.test.ts b/tests/wire/bankAccounts.test.ts new file mode 100644 index 000000000..75112cfd1 --- /dev/null +++ b/tests/wire/bankAccounts.test.ts @@ -0,0 +1,144 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("BankAccounts", () => { + test("GetByV1Id", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + bank_account: { + id: "w3yRgCGYQnwmdl0R3GB", + account_number_suffix: "971", + country: "US", + currency: "USD", + account_type: "CHECKING", + holder_name: "Jane Doe", + primary_bank_identification_number: "112200303", + secondary_bank_identification_number: "secondary_bank_identification_number", + debit_mandate_reference_id: "debit_mandate_reference_id", + reference_id: "reference_id", + location_id: "S8GWD5example", + status: "VERIFICATION_IN_PROGRESS", + creditable: false, + debitable: false, + fingerprint: "fingerprint", + version: 5, + bank_name: "Bank Name", + }, + }; + server + .mockEndpoint() + .get("/v2/bank-accounts/by-v1-id/v1_bank_account_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bankAccounts.getByV1Id({ + v1_bank_account_id: "v1_bank_account_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + bank_account: { + id: "w3yRgCGYQnwmdl0R3GB", + account_number_suffix: "971", + country: "US", + currency: "USD", + account_type: "CHECKING", + holder_name: "Jane Doe", + primary_bank_identification_number: "112200303", + secondary_bank_identification_number: "secondary_bank_identification_number", + debit_mandate_reference_id: "debit_mandate_reference_id", + reference_id: "reference_id", + location_id: "S8GWD5example", + status: "VERIFICATION_IN_PROGRESS", + creditable: false, + debitable: false, + fingerprint: "fingerprint", + version: 5, + bank_name: "Bank Name", + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + bank_account: { + id: "w3yRgCGYQnwmdl0R3GB", + account_number_suffix: "971", + country: "US", + currency: "USD", + account_type: "CHECKING", + holder_name: "Jane Doe", + primary_bank_identification_number: "112200303", + secondary_bank_identification_number: "secondary_bank_identification_number", + debit_mandate_reference_id: "debit_mandate_reference_id", + reference_id: "reference_id", + location_id: "S8GWD5example", + status: "VERIFICATION_IN_PROGRESS", + creditable: false, + debitable: false, + fingerprint: "fingerprint", + version: 5, + bank_name: "Bank Name", + }, + }; + server + .mockEndpoint() + .get("/v2/bank-accounts/bank_account_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bankAccounts.get({ + bank_account_id: "bank_account_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + bank_account: { + id: "w3yRgCGYQnwmdl0R3GB", + account_number_suffix: "971", + country: "US", + currency: "USD", + account_type: "CHECKING", + holder_name: "Jane Doe", + primary_bank_identification_number: "112200303", + secondary_bank_identification_number: "secondary_bank_identification_number", + debit_mandate_reference_id: "debit_mandate_reference_id", + reference_id: "reference_id", + location_id: "S8GWD5example", + status: "VERIFICATION_IN_PROGRESS", + creditable: false, + debitable: false, + fingerprint: "fingerprint", + version: 5, + bank_name: "Bank Name", + }, + }); + }); +}); diff --git a/tests/wire/bookings.test.ts b/tests/wire/bookings.test.ts new file mode 100644 index 000000000..1eeb666cf --- /dev/null +++ b/tests/wire/bookings.test.ts @@ -0,0 +1,1327 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Bookings", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { booking: {} }; + const rawResponseBody = { + booking: { + id: "zkras0xv0xwswx", + version: 0, + status: "ACCEPTED", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:47:41Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "BUSINESS_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.create({ + booking: {}, + }); + expect(response).toEqual({ + booking: { + id: "zkras0xv0xwswx", + version: 0, + status: "ACCEPTED", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:47:41Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "BUSINESS_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("SearchAvailability", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { query: { filter: { start_at_range: {} } } }; + const rawResponseBody = { + availabilities: [ + { + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-26T13:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-26T14:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-26T14:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-26T15:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-26T15:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-26T16:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T09:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T09:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T10:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T10:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T11:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T11:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T12:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T12:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T13:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T13:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + { + start_at: "2020-11-27T14:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt(1599775456731), + }, + ], + }, + ], + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings/availability/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.searchAvailability({ + query: { + filter: { + start_at_range: {}, + }, + }, + }); + expect(response).toEqual({ + availabilities: [ + { + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-26T13:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-26T14:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-26T14:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-26T15:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-26T15:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-26T16:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T09:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T09:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T10:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T10:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T11:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T11:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T12:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T12:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T13:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T13:30:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + { + start_at: "2020-11-27T14:00:00Z", + location_id: "LEQHH0YY8B42M", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMaJcbiRqPIGZuS9", + service_variation_version: BigInt("1599775456731"), + }, + ], + }, + ], + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("BulkRetrieveBookings", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { booking_ids: ["booking_ids"] }; + const rawResponseBody = { + bookings: { + sc3p3m7dvctfr1: { + booking: { + id: "sc3p3m7dvctfr1", + version: 0, + status: "ACCEPTED", + created_at: "2023-04-26T18:19:21Z", + updated_at: "2023-04-26T18:19:21Z", + start_at: "2023-05-01T14:00:00Z", + location_id: "LY6WNBPVM6VGV", + customer_id: "4TDWKN9E8165X8Z77MRS0VFMJM", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "VG4FYBKK3UL6UITOEYQ6MFLS", + team_member_id: "TMjiqI3PxyLMKr4k", + service_variation_version: BigInt(1641341724039), + any_team_member: false, + }, + ], + all_day: false, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + tdegug1dvctdef: { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "NOT_FOUND", + detail: "Specified booking was not found.", + field: "booking_id", + }, + ], + }, + tdegug1fqni3wh: { + booking: { + id: "tdegug1fqni3wh", + version: 0, + status: "ACCEPTED", + created_at: "2023-04-26T18:19:30Z", + updated_at: "2023-04-26T18:19:30Z", + start_at: "2023-05-02T14:00:00Z", + location_id: "LY6WNBPVM6VGV", + customer_id: "4TDWKN9E8165X8Z77MRS0VFMJM", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "VG4FYBKK3UL6UITOEYQ6MFLS", + team_member_id: "TMjiqI3PxyLMKr4k", + service_variation_version: BigInt(1641341724039), + any_team_member: false, + }, + ], + all_day: false, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings/bulk-retrieve") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.bulkRetrieveBookings({ + booking_ids: ["booking_ids"], + }); + expect(response).toEqual({ + bookings: { + sc3p3m7dvctfr1: { + booking: { + id: "sc3p3m7dvctfr1", + version: 0, + status: "ACCEPTED", + created_at: "2023-04-26T18:19:21Z", + updated_at: "2023-04-26T18:19:21Z", + start_at: "2023-05-01T14:00:00Z", + location_id: "LY6WNBPVM6VGV", + customer_id: "4TDWKN9E8165X8Z77MRS0VFMJM", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "VG4FYBKK3UL6UITOEYQ6MFLS", + team_member_id: "TMjiqI3PxyLMKr4k", + service_variation_version: BigInt("1641341724039"), + any_team_member: false, + }, + ], + all_day: false, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + tdegug1dvctdef: { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "NOT_FOUND", + detail: "Specified booking was not found.", + field: "booking_id", + }, + ], + }, + tdegug1fqni3wh: { + booking: { + id: "tdegug1fqni3wh", + version: 0, + status: "ACCEPTED", + created_at: "2023-04-26T18:19:30Z", + updated_at: "2023-04-26T18:19:30Z", + start_at: "2023-05-02T14:00:00Z", + location_id: "LY6WNBPVM6VGV", + customer_id: "4TDWKN9E8165X8Z77MRS0VFMJM", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "VG4FYBKK3UL6UITOEYQ6MFLS", + team_member_id: "TMjiqI3PxyLMKr4k", + service_variation_version: BigInt("1641341724039"), + any_team_member: false, + }, + ], + all_day: false, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("getBusinessProfile", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + business_booking_profile: { + seller_id: "MLJQYZZRM0D3Y", + created_at: "2020-09-10T21:40:38Z", + booking_enabled: true, + customer_timezone_choice: "CUSTOMER_CHOICE", + booking_policy: "ACCEPT_ALL", + allow_user_cancel: true, + business_appointment_settings: { + location_types: ["BUSINESS_LOCATION"], + alignment_time: "HALF_HOURLY", + min_booking_lead_time_seconds: 0, + max_booking_lead_time_seconds: 31536000, + any_team_member_booking_enabled: true, + multiple_service_booking_enabled: true, + max_appointments_per_day_limit_type: "PER_TEAM_MEMBER", + max_appointments_per_day_limit: 1, + cancellation_window_seconds: 1, + cancellation_fee_money: { currency: "USD" }, + cancellation_policy: "CUSTOM_POLICY", + cancellation_policy_text: "cancellation_policy_text", + skip_booking_flow_staff_selection: false, + }, + support_seller_level_writes: true, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/bookings/business-booking-profile") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.getBusinessProfile(); + expect(response).toEqual({ + business_booking_profile: { + seller_id: "MLJQYZZRM0D3Y", + created_at: "2020-09-10T21:40:38Z", + booking_enabled: true, + customer_timezone_choice: "CUSTOMER_CHOICE", + booking_policy: "ACCEPT_ALL", + allow_user_cancel: true, + business_appointment_settings: { + location_types: ["BUSINESS_LOCATION"], + alignment_time: "HALF_HOURLY", + min_booking_lead_time_seconds: 0, + max_booking_lead_time_seconds: 31536000, + any_team_member_booking_enabled: true, + multiple_service_booking_enabled: true, + max_appointments_per_day_limit_type: "PER_TEAM_MEMBER", + max_appointments_per_day_limit: 1, + cancellation_window_seconds: 1, + cancellation_fee_money: { + currency: "USD", + }, + cancellation_policy: "CUSTOM_POLICY", + cancellation_policy_text: "cancellation_policy_text", + skip_booking_flow_staff_selection: false, + }, + support_seller_level_writes: true, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("RetrieveLocationBookingProfile", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + location_booking_profile: { + location_id: "L3HETDGYQ4A2C", + booking_site_url: "https://square.site/book/L3HETDGYQ4A2C/prod-business", + online_booking_enabled: true, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/bookings/location-booking-profiles/location_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.retrieveLocationBookingProfile({ + location_id: "location_id", + }); + expect(response).toEqual({ + location_booking_profile: { + location_id: "L3HETDGYQ4A2C", + booking_site_url: "https://square.site/book/L3HETDGYQ4A2C/prod-business", + online_booking_enabled: true, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("BulkRetrieveTeamMemberBookingProfiles", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { team_member_ids: ["team_member_ids"] }; + const rawResponseBody = { + team_member_booking_profiles: { + TMXUrsBWWcHTt79t: { + errors: [{ category: "INVALID_REQUEST_ERROR", code: "NOT_FOUND", detail: "Resource not found." }], + }, + TMaJcbiRqPIGZuS9: { + team_member_booking_profile: { + team_member_id: "TMaJcbiRqPIGZuS9", + display_name: "Sandbox Staff 1", + is_bookable: true, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + TMtdegug1fqni3wh: { + team_member_booking_profile: { + team_member_id: "TMtdegug1fqni3wh", + display_name: "Sandbox Staff 2", + is_bookable: true, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings/team-member-booking-profiles/bulk-retrieve") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.bulkRetrieveTeamMemberBookingProfiles({ + team_member_ids: ["team_member_ids"], + }); + expect(response).toEqual({ + team_member_booking_profiles: { + TMXUrsBWWcHTt79t: { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "NOT_FOUND", + detail: "Resource not found.", + }, + ], + }, + TMaJcbiRqPIGZuS9: { + team_member_booking_profile: { + team_member_id: "TMaJcbiRqPIGZuS9", + display_name: "Sandbox Staff 1", + is_bookable: true, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + TMtdegug1fqni3wh: { + team_member_booking_profile: { + team_member_id: "TMtdegug1fqni3wh", + display_name: "Sandbox Staff 2", + is_bookable: true, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + booking: { + id: "zkras0xv0xwswx", + version: 1, + status: "ACCEPTED", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:49:25Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "BUSINESS_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/bookings/booking_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.get({ + booking_id: "booking_id", + }); + expect(response).toEqual({ + booking: { + id: "zkras0xv0xwswx", + version: 1, + status: "ACCEPTED", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:49:25Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "BUSINESS_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { booking: {} }; + const rawResponseBody = { + booking: { + id: "zkras0xv0xwswx", + version: 2, + status: "ACCEPTED", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:49:25Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "I would like to sit near the window please", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "CUSTOMER_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "1955 Broadway", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "Oakland", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "CA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "94612", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/bookings/booking_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.update({ + booking_id: "booking_id", + booking: {}, + }); + expect(response).toEqual({ + booking: { + id: "zkras0xv0xwswx", + version: 2, + status: "ACCEPTED", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:49:25Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "I would like to sit near the window please", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "CUSTOMER_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "1955 Broadway", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "Oakland", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "CA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "94612", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { + booking: { + id: "zkras0xv0xwswx", + version: 1, + status: "CANCELLED_BY_CUSTOMER", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:49:25Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt(1599775456731), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "BUSINESS_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings/booking_id/cancel") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.cancel({ + booking_id: "booking_id", + }); + expect(response).toEqual({ + booking: { + id: "zkras0xv0xwswx", + version: 1, + status: "CANCELLED_BY_CUSTOMER", + created_at: "2020-10-28T15:47:41Z", + updated_at: "2020-10-28T15:49:25Z", + start_at: "2020-11-26T13:00:00Z", + location_id: "LEQHH0YY8B42M", + customer_id: "EX2QSVGTZN4K1E5QE1CBFNVQ8M", + customer_note: "", + seller_note: "", + appointment_segments: [ + { + duration_minutes: 60, + service_variation_id: "RU3PBTZTK7DXZDQFCJHOK2MC", + team_member_id: "TMXUrsBWWcHTt79t", + service_variation_version: BigInt("1599775456731"), + }, + ], + transition_time_minutes: 1, + all_day: true, + location_type: "BUSINESS_LOCATION", + creator_details: { + creator_type: "TEAM_MEMBER", + team_member_id: "team_member_id", + customer_id: "customer_id", + }, + source: "FIRST_PARTY_MERCHANT", + address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/bookings/customAttributeDefinitions.test.ts b/tests/wire/bookings/customAttributeDefinitions.test.ts new file mode 100644 index 000000000..81c257a50 --- /dev/null +++ b/tests/wire/bookings/customAttributeDefinitions.test.ts @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributeDefinitions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { custom_attribute_definition: {} }; + const rawResponseBody = { + custom_attribute_definition: { + key: "favoriteShampoo", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite Shampoo", + description: "The favorite shampoo of the customer.", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "2022-11-16T15:27:30Z", + created_at: "2022-11-16T15:27:30Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings/custom-attribute-definitions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributeDefinitions.create({ + custom_attribute_definition: {}, + }); + expect(response).toEqual({ + custom_attribute_definition: { + key: "favoriteShampoo", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite Shampoo", + description: "The favorite shampoo of the customer.", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "2022-11-16T15:27:30Z", + created_at: "2022-11-16T15:27:30Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute_definition: { + key: "favoriteShampoo", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite shampoo", + description: "The favorite shampoo of the customer.", + visibility: "VISIBILITY_READ_WRITE_VALUES", + version: 1, + updated_at: "2022-11-16T15:27:30Z", + created_at: "2022-11-16T15:27:30Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/bookings/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributeDefinitions.get({ + key: "key", + }); + expect(response).toEqual({ + custom_attribute_definition: { + key: "favoriteShampoo", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite shampoo", + description: "The favorite shampoo of the customer.", + visibility: "VISIBILITY_READ_WRITE_VALUES", + version: 1, + updated_at: "2022-11-16T15:27:30Z", + created_at: "2022-11-16T15:27:30Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { custom_attribute_definition: {} }; + const rawResponseBody = { + custom_attribute_definition: { + key: "favoriteShampoo", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite shampoo", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2022-11-16T15:39:38Z", + created_at: "2022-11-16T15:27:30Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/bookings/custom-attribute-definitions/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributeDefinitions.update({ + key: "key", + custom_attribute_definition: {}, + }); + expect(response).toEqual({ + custom_attribute_definition: { + key: "favoriteShampoo", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite shampoo", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2022-11-16T15:39:38Z", + created_at: "2022-11-16T15:27:30Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/bookings/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributeDefinitions.delete({ + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/bookings/customAttributes.test.ts b/tests/wire/bookings/customAttributes.test.ts new file mode 100644 index 000000000..4ef63ef49 --- /dev/null +++ b/tests/wire/bookings/customAttributes.test.ts @@ -0,0 +1,443 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributes", () => { + test("batchDelete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { values: { key: { booking_id: "booking_id", key: "key" } } }; + const rawResponseBody = { + values: { + id1: { + booking_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id2: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id3: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings/custom-attributes/bulk-delete") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributes.batchDelete({ + values: { + key: { + booking_id: "booking_id", + key: "key", + }, + }, + }); + expect(response).toEqual({ + values: { + id1: { + booking_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id2: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id3: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("batchUpsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { values: { key: { booking_id: "booking_id", custom_attribute: {} } } }; + const rawResponseBody = { + values: { + id1: { + booking_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "favoriteShampoo", + value: "Spring Fresh", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T23:14:47Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id2: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "hasShoes", + value: false, + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T00:16:20Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id3: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "favoriteShampoo", + value: "Hydro-Cool", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T00:16:20Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id4: { + booking_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "partySize", + value: 4, + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T23:14:47Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id5: { + booking_id: "70548QG1HN43B05G0KCZ4MMC1G", + custom_attribute: { + key: "celebrating", + value: "birthday", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T00:16:20Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/bookings/custom-attributes/bulk-upsert") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributes.batchUpsert({ + values: { + key: { + booking_id: "booking_id", + custom_attribute: {}, + }, + }, + }); + expect(response).toEqual({ + values: { + id1: { + booking_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "favoriteShampoo", + value: "Spring Fresh", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T23:14:47Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id2: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "hasShoes", + value: false, + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T00:16:20Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id3: { + booking_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "favoriteShampoo", + value: "Hydro-Cool", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T00:16:20Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id4: { + booking_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "partySize", + value: 4, + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T23:14:47Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id5: { + booking_id: "70548QG1HN43B05G0KCZ4MMC1G", + custom_attribute: { + key: "celebrating", + value: "birthday", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-16T00:16:23Z", + created_at: "2022-11-16T00:16:20Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute: { + key: "favoriteShampoo", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-11-16T15:50:27Z", + created_at: "2022-11-16T15:50:27Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/bookings/booking_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributes.get({ + booking_id: "booking_id", + key: "key", + }); + expect(response).toEqual({ + custom_attribute: { + key: "favoriteShampoo", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-11-16T15:50:27Z", + created_at: "2022-11-16T15:50:27Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("upsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { custom_attribute: {} }; + const rawResponseBody = { + custom_attribute: { + key: "favoriteShampoo", + value: "Spring Fresh", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-11-16T15:50:27Z", + created_at: "2022-11-16T15:50:27Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/bookings/booking_id/custom-attributes/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributes.upsert({ + booking_id: "booking_id", + key: "key", + custom_attribute: {}, + }); + expect(response).toEqual({ + custom_attribute: { + key: "favoriteShampoo", + value: "Spring Fresh", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-11-16T15:50:27Z", + created_at: "2022-11-16T15:50:27Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/bookings/booking_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.customAttributes.delete({ + booking_id: "booking_id", + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/bookings/teamMemberProfiles.test.ts b/tests/wire/bookings/teamMemberProfiles.test.ts new file mode 100644 index 000000000..8adc6d968 --- /dev/null +++ b/tests/wire/bookings/teamMemberProfiles.test.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("TeamMemberProfiles", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + team_member_booking_profile: { + team_member_id: "TMaJcbiRqPIGZuS9", + description: "description", + display_name: "Sandbox Staff", + is_bookable: true, + profile_image_url: "profile_image_url", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/bookings/team-member-booking-profiles/team_member_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.bookings.teamMemberProfiles.get({ + team_member_id: "team_member_id", + }); + expect(response).toEqual({ + team_member_booking_profile: { + team_member_id: "TMaJcbiRqPIGZuS9", + description: "description", + display_name: "Sandbox Staff", + is_bookable: true, + profile_image_url: "profile_image_url", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/cards.test.ts b/tests/wire/cards.test.ts new file mode 100644 index 000000000..2fe41bb84 --- /dev/null +++ b/tests/wire/cards.test.ts @@ -0,0 +1,345 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Cards", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "4935a656-a929-4792-b97c-8848be85c27c", + source_id: "cnon:uIbfJXhXETSP197M3GB", + card: { + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + reference_id: "user-id-1", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + card: { + id: "ccof:uIbfJXhXETSP197M3GB", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + merchant_id: "6SSW7HV8K2ST5", + reference_id: "user-id-1", + enabled: true, + card_type: "CREDIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + version: BigInt(1), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: false, + }, + }; + server + .mockEndpoint() + .post("/v2/cards") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.cards.create({ + idempotency_key: "4935a656-a929-4792-b97c-8848be85c27c", + source_id: "cnon:uIbfJXhXETSP197M3GB", + card: { + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + reference_id: "user-id-1", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + card: { + id: "ccof:uIbfJXhXETSP197M3GB", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + merchant_id: "6SSW7HV8K2ST5", + reference_id: "user-id-1", + enabled: true, + card_type: "CREDIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + version: BigInt("1"), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: false, + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + card: { + id: "ccof:uIbfJXhXETSP197M3GB", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + merchant_id: "6SSW7HV8K2ST5", + reference_id: "user-id-1", + enabled: true, + card_type: "CREDIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + version: BigInt(1), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: false, + }, + }; + server.mockEndpoint().get("/v2/cards/card_id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.cards.get({ + card_id: "card_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + card: { + id: "ccof:uIbfJXhXETSP197M3GB", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + merchant_id: "6SSW7HV8K2ST5", + reference_id: "user-id-1", + enabled: true, + card_type: "CREDIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + version: BigInt("1"), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: false, + }, + }); + }); + + test("disable", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + card: { + id: "ccof:uIbfJXhXETSP197M3GB", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + merchant_id: "6SSW7HV8K2ST5", + reference_id: "user-id-1", + enabled: false, + card_type: "CREDIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + version: BigInt(2), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: false, + }, + }; + server + .mockEndpoint() + .post("/v2/cards/card_id/disable") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.cards.disable({ + card_id: "card_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + card: { + id: "ccof:uIbfJXhXETSP197M3GB", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", + customer_id: "VDKXEEKPJN48QDG3BGGFAK05P8", + merchant_id: "6SSW7HV8K2ST5", + reference_id: "user-id-1", + enabled: false, + card_type: "CREDIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + version: BigInt("2"), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: false, + }, + }); + }); +}); diff --git a/tests/wire/cashDrawers/shifts.test.ts b/tests/wire/cashDrawers/shifts.test.ts new file mode 100644 index 000000000..e02b6c14d --- /dev/null +++ b/tests/wire/cashDrawers/shifts.test.ts @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Shifts", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + cash_drawer_shift: { + id: "DCC99978-09A6-4926-849F-300BE9C5793A", + state: "CLOSED", + opened_at: "2019-11-22T00:42:54.000Z", + ended_at: "2019-11-22T00:44:49.000Z", + closed_at: "2019-11-22T00:44:49.000Z", + description: "Misplaced some change", + opened_cash_money: { amount: BigInt(10000), currency: "USD" }, + cash_payment_money: { amount: BigInt(100), currency: "USD" }, + cash_refunds_money: { amount: BigInt(-100), currency: "USD" }, + cash_paid_in_money: { amount: BigInt(10000), currency: "USD" }, + cash_paid_out_money: { amount: BigInt(-10000), currency: "USD" }, + expected_cash_money: { amount: BigInt(10000), currency: "USD" }, + closed_cash_money: { amount: BigInt(9970), currency: "USD" }, + device: { id: "id", name: "My iPad" }, + created_at: "created_at", + updated_at: "updated_at", + location_id: "location_id", + team_member_ids: ["team_member_ids"], + opening_team_member_id: "", + ending_team_member_id: "", + closing_team_member_id: "", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/cash-drawers/shifts/shift_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.cashDrawers.shifts.get({ + shift_id: "shift_id", + location_id: "location_id", + }); + expect(response).toEqual({ + cash_drawer_shift: { + id: "DCC99978-09A6-4926-849F-300BE9C5793A", + state: "CLOSED", + opened_at: "2019-11-22T00:42:54.000Z", + ended_at: "2019-11-22T00:44:49.000Z", + closed_at: "2019-11-22T00:44:49.000Z", + description: "Misplaced some change", + opened_cash_money: { + amount: BigInt("10000"), + currency: "USD", + }, + cash_payment_money: { + amount: BigInt("100"), + currency: "USD", + }, + cash_refunds_money: { + amount: BigInt("-100"), + currency: "USD", + }, + cash_paid_in_money: { + amount: BigInt("10000"), + currency: "USD", + }, + cash_paid_out_money: { + amount: BigInt("-10000"), + currency: "USD", + }, + expected_cash_money: { + amount: BigInt("10000"), + currency: "USD", + }, + closed_cash_money: { + amount: BigInt("9970"), + currency: "USD", + }, + device: { + id: "id", + name: "My iPad", + }, + created_at: "created_at", + updated_at: "updated_at", + location_id: "location_id", + team_member_ids: ["team_member_ids"], + opening_team_member_id: "", + ending_team_member_id: "", + closing_team_member_id: "", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/catalog.test.ts b/tests/wire/catalog.test.ts new file mode 100644 index 000000000..df691b7e0 --- /dev/null +++ b/tests/wire/catalog.test.ts @@ -0,0 +1,800 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Catalog", () => { + test("batchDelete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"] }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + deleted_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + deleted_at: "2016-11-16T22:25:24.878Z", + }; + server + .mockEndpoint() + .post("/v2/catalog/batch-delete") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.batchDelete({ + object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + deleted_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + deleted_at: "2016-11-16T22:25:24.878Z", + }); + }); + + test("batchGet", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + include_related_objects: true, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + objects: [ + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + ], + related_objects: [ + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + ordinal: 1000000, + type: "CATEGORY", + }, + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "TAX", + }, + ], + }; + server + .mockEndpoint() + .post("/v2/catalog/batch-retrieve") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.batchGet({ + object_ids: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + include_related_objects: true, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + objects: [ + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + ], + related_objects: [ + { + type: "CATEGORY", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + ordinal: BigInt("1000000"), + }, + { + type: "TAX", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + ], + }); + }); + + test("batchUpsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + batches: [ + { + objects: [ + { id: "id", type: "ITEM" }, + { id: "id", type: "ITEM" }, + { id: "id", type: "ITEM" }, + { id: "id", type: "TAX" }, + ], + }, + ], + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + objects: [ + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + ordinal: 1000000, + type: "CATEGORY", + }, + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "TAX", + }, + ], + updated_at: "updated_at", + 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" }, + ], + }; + server + .mockEndpoint() + .post("/v2/catalog/batch-upsert") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.batchUpsert({ + idempotency_key: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + batches: [ + { + objects: [ + { + type: "ITEM", + id: "id", + }, + { + type: "ITEM", + id: "id", + }, + { + type: "ITEM", + id: "id", + }, + { + type: "TAX", + id: "id", + }, + ], + }, + ], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + objects: [ + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + { + type: "CATEGORY", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + ordinal: BigInt("1000000"), + }, + { + type: "TAX", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + ], + updated_at: "updated_at", + 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", + }, + ], + }); + }); + + test("info", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + limits: { + batch_upsert_max_objects_per_batch: 1000, + batch_upsert_max_total_objects: 10000, + batch_retrieve_max_object_ids: 1000, + search_max_page_limit: 1000, + batch_delete_max_object_ids: 200, + update_item_taxes_max_item_ids: 1000, + update_item_taxes_max_taxes_to_enable: 1000, + update_item_taxes_max_taxes_to_disable: 1000, + update_item_modifier_lists_max_item_ids: 1000, + update_item_modifier_lists_max_modifier_lists_to_enable: 1000, + update_item_modifier_lists_max_modifier_lists_to_disable: 1000, + }, + standard_unit_description_group: { standard_unit_descriptions: [{}], language_code: "language_code" }, + }; + server.mockEndpoint().get("/v2/catalog/info").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.catalog.info(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + limits: { + batch_upsert_max_objects_per_batch: 1000, + batch_upsert_max_total_objects: 10000, + batch_retrieve_max_object_ids: 1000, + search_max_page_limit: 1000, + batch_delete_max_object_ids: 200, + update_item_taxes_max_item_ids: 1000, + update_item_taxes_max_taxes_to_enable: 1000, + update_item_taxes_max_taxes_to_disable: 1000, + update_item_modifier_lists_max_item_ids: 1000, + update_item_modifier_lists_max_modifier_lists_to_enable: 1000, + update_item_modifier_lists_max_modifier_lists_to_disable: 1000, + }, + standard_unit_description_group: { + standard_unit_descriptions: [{}], + language_code: "language_code", + }, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + object_types: ["ITEM"], + query: { prefix_query: { attribute_name: "name", attribute_prefix: "tea" } }, + limit: 100, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + cursor: "cursor", + objects: [ + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + ], + related_objects: [ + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + ], + latest_time: "latest_time", + }; + server + .mockEndpoint() + .post("/v2/catalog/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.search({ + object_types: ["ITEM"], + query: { + prefix_query: { + attribute_name: "name", + attribute_prefix: "tea", + }, + }, + limit: 100, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + cursor: "cursor", + objects: [ + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + ], + related_objects: [ + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + ], + latest_time: "latest_time", + }); + }); + + test("SearchItems", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + text_filter: "red", + category_ids: ["WINE_CATEGORY_ID"], + stock_levels: ["OUT", "LOW"], + enabled_location_ids: ["ATL_LOCATION_ID"], + limit: 100, + sort_order: "ASC", + product_types: ["REGULAR"], + custom_attribute_filters: [ + { custom_attribute_definition_id: "VEGAN_DEFINITION_ID", bool_filter: true }, + { custom_attribute_definition_id: "BRAND_DEFINITION_ID", string_filter: "Dark Horse" }, + { key: "VINTAGE", number_filter: { min: "min", max: "max" } }, + { custom_attribute_definition_id: "VARIETAL_DEFINITION_ID" }, + ], + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + items: [ + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "ITEM", + }, + ], + cursor: "cursor", + matched_variation_ids: ["VBJNPHCOKDFECR6VU25WRJUD"], + }; + server + .mockEndpoint() + .post("/v2/catalog/search-catalog-items") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.searchItems({ + text_filter: "red", + category_ids: ["WINE_CATEGORY_ID"], + stock_levels: ["OUT", "LOW"], + enabled_location_ids: ["ATL_LOCATION_ID"], + limit: 100, + sort_order: "ASC", + product_types: ["REGULAR"], + custom_attribute_filters: [ + { + custom_attribute_definition_id: "VEGAN_DEFINITION_ID", + bool_filter: true, + }, + { + custom_attribute_definition_id: "BRAND_DEFINITION_ID", + string_filter: "Dark Horse", + }, + { + key: "VINTAGE", + number_filter: { + min: "min", + max: "max", + }, + }, + { + custom_attribute_definition_id: "VARIETAL_DEFINITION_ID", + }, + ], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + items: [ + { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + ], + cursor: "cursor", + matched_variation_ids: ["VBJNPHCOKDFECR6VU25WRJUD"], + }); + }); + + test("UpdateItemModifierLists", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifier_lists_to_enable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifier_lists_to_disable: ["7WRC16CJZDVLSNDQ35PP6YAD"], + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + updated_at: "2016-11-16T22:25:24.878Z", + }; + server + .mockEndpoint() + .post("/v2/catalog/update-item-modifier-lists") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.updateItemModifierLists({ + item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifier_lists_to_enable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifier_lists_to_disable: ["7WRC16CJZDVLSNDQ35PP6YAD"], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + updated_at: "2016-11-16T22:25:24.878Z", + }); + }); + + test("UpdateItemTaxes", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + taxes_to_enable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + taxes_to_disable: ["AQCEGCEBBQONINDOHRGZISEX"], + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + updated_at: "2016-11-16T22:25:24.878Z", + }; + server + .mockEndpoint() + .post("/v2/catalog/update-item-taxes") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.updateItemTaxes({ + item_ids: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + taxes_to_enable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + taxes_to_disable: ["AQCEGCEBBQONINDOHRGZISEX"], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + updated_at: "2016-11-16T22:25:24.878Z", + }); + }); +}); diff --git a/tests/wire/catalog/object.test.ts b/tests/wire/catalog/object.test.ts new file mode 100644 index 000000000..969bd82ac --- /dev/null +++ b/tests/wire/catalog/object.test.ts @@ -0,0 +1,343 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Object_", () => { + test("upsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + object: { id: "id", type: "ITEM" }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + catalog_object: { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + item_data: { + name: "name", + description: "description", + abbreviation: "abbreviation", + label_color: "label_color", + is_taxable: true, + category_id: "category_id", + tax_ids: ["tax_ids"], + modifier_list_info: [{ modifier_list_id: "modifier_list_id" }], + product_type: "REGULAR", + skip_modifier_screen: true, + item_options: [{}], + ecom_uri: "ecom_uri", + ecom_image_uris: ["ecom_image_uris"], + image_ids: ["image_ids"], + sort_name: "sort_name", + description_html: "description_html", + description_plaintext: "description_plaintext", + channels: ["channels"], + is_archived: true, + is_alcoholic: true, + }, + type: "ITEM", + }, + id_mappings: [ + { client_object_id: "#Cocoa", object_id: "R2TA2FOBUGCJZNIWJSOSNAI4" }, + { client_object_id: "#Small", object_id: "QRT53UP4LITLWGOGBZCUWP63" }, + { client_object_id: "#Large", object_id: "NS77DKEIQ3AEQTCP727DSA7U" }, + ], + }; + server + .mockEndpoint() + .post("/v2/catalog/object") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.object.upsert({ + idempotency_key: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + object: { + type: "ITEM", + id: "id", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + catalog_object: { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + item_data: { + name: "name", + description: "description", + abbreviation: "abbreviation", + label_color: "label_color", + is_taxable: true, + category_id: "category_id", + tax_ids: ["tax_ids"], + modifier_list_info: [ + { + modifier_list_id: "modifier_list_id", + }, + ], + product_type: "REGULAR", + skip_modifier_screen: true, + item_options: [{}], + ecom_uri: "ecom_uri", + ecom_image_uris: ["ecom_image_uris"], + image_ids: ["image_ids"], + sort_name: "sort_name", + description_html: "description_html", + description_plaintext: "description_plaintext", + channels: ["channels"], + is_archived: true, + is_alcoholic: true, + }, + }, + id_mappings: [ + { + client_object_id: "#Cocoa", + object_id: "R2TA2FOBUGCJZNIWJSOSNAI4", + }, + { + client_object_id: "#Small", + object_id: "QRT53UP4LITLWGOGBZCUWP63", + }, + { + client_object_id: "#Large", + object_id: "NS77DKEIQ3AEQTCP727DSA7U", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + object: { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + item_data: { + name: "name", + description: "description", + abbreviation: "abbreviation", + label_color: "label_color", + is_taxable: true, + category_id: "category_id", + tax_ids: ["tax_ids"], + modifier_list_info: [{ modifier_list_id: "modifier_list_id" }], + product_type: "REGULAR", + skip_modifier_screen: true, + item_options: [{}], + ecom_uri: "ecom_uri", + ecom_image_uris: ["ecom_image_uris"], + image_ids: ["image_ids"], + sort_name: "sort_name", + description_html: "description_html", + description_plaintext: "description_plaintext", + channels: ["channels"], + is_archived: true, + is_alcoholic: true, + }, + type: "ITEM", + }, + related_objects: [ + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + ordinal: 1000000, + type: "CATEGORY", + }, + { + id: "id", + updated_at: "updated_at", + version: 1000000, + is_deleted: true, + custom_attribute_values: { key: {} }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + type: "TAX", + }, + ], + }; + server + .mockEndpoint() + .get("/v2/catalog/object/object_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.object.get({ + object_id: "object_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + object: { + type: "ITEM", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + item_data: { + name: "name", + description: "description", + abbreviation: "abbreviation", + label_color: "label_color", + is_taxable: true, + category_id: "category_id", + tax_ids: ["tax_ids"], + modifier_list_info: [ + { + modifier_list_id: "modifier_list_id", + }, + ], + product_type: "REGULAR", + skip_modifier_screen: true, + item_options: [{}], + ecom_uri: "ecom_uri", + ecom_image_uris: ["ecom_image_uris"], + image_ids: ["image_ids"], + sort_name: "sort_name", + description_html: "description_html", + description_plaintext: "description_plaintext", + channels: ["channels"], + is_archived: true, + is_alcoholic: true, + }, + }, + related_objects: [ + { + type: "CATEGORY", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + ordinal: BigInt("1000000"), + }, + { + type: "TAX", + id: "id", + updated_at: "updated_at", + version: BigInt("1000000"), + is_deleted: true, + custom_attribute_values: { + key: {}, + }, + catalog_v1_ids: [{}], + present_at_all_locations: true, + present_at_location_ids: ["present_at_location_ids"], + absent_at_location_ids: ["absent_at_location_ids"], + image_id: "image_id", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + deleted_object_ids: ["7SB3ZQYJ5GDMVFL7JK46JCHT", "KQLFFHA6K6J3YQAQAWDQAL57"], + deleted_at: "2016-11-16T22:25:24.878Z", + }; + server + .mockEndpoint() + .delete("/v2/catalog/object/object_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.catalog.object.delete({ + object_id: "object_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + deleted_object_ids: ["7SB3ZQYJ5GDMVFL7JK46JCHT", "KQLFFHA6K6J3YQAQAWDQAL57"], + deleted_at: "2016-11-16T22:25:24.878Z", + }); + }); +}); diff --git a/tests/wire/checkout.test.ts b/tests/wire/checkout.test.ts new file mode 100644 index 000000000..8ec88718b --- /dev/null +++ b/tests/wire/checkout.test.ts @@ -0,0 +1,325 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Checkout", () => { + test("RetrieveLocationSettings", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + location_settings: { + location_id: "LOCATION_ID_1", + customer_notes_enabled: true, + policies: [{ uid: "POLICY_ID_1", title: "Return Policy", description: "This is my Return Policy" }], + branding: { header_type: "FRAMED_LOGO", button_color: "#ffffff", button_shape: "ROUNDED" }, + tipping: { + percentages: [10, 15, 20], + smart_tipping_enabled: true, + default_percent: 15, + smart_tips: [{}], + }, + coupons: { enabled: true }, + updated_at: "2022-06-16T22:25:35Z", + }, + }; + server + .mockEndpoint() + .get("/v2/online-checkout/location-settings/location_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.retrieveLocationSettings({ + location_id: "location_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + location_settings: { + location_id: "LOCATION_ID_1", + customer_notes_enabled: true, + policies: [ + { + uid: "POLICY_ID_1", + title: "Return Policy", + description: "This is my Return Policy", + }, + ], + branding: { + header_type: "FRAMED_LOGO", + button_color: "#ffffff", + button_shape: "ROUNDED", + }, + tipping: { + percentages: [10, 15, 20], + smart_tipping_enabled: true, + default_percent: 15, + smart_tips: [{}], + }, + coupons: { + enabled: true, + }, + updated_at: "2022-06-16T22:25:35Z", + }, + }); + }); + + test("UpdateLocationSettings", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { location_settings: {} }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + location_settings: { + location_id: "LOCATION_ID_1", + customer_notes_enabled: false, + policies: [ + { uid: "POLICY_ID_1", title: "Return Policy", description: "This is my Return Policy" }, + { + uid: "POLICY_ID_2", + title: "Return Policy", + description: "Items may be returned within 30 days of purchase.", + }, + ], + branding: { header_type: "FRAMED_LOGO", button_color: "#00b23b", button_shape: "ROUNDED" }, + tipping: { + percentages: [15, 20, 25], + smart_tipping_enabled: true, + default_percent: 20, + smart_tips: [{}], + }, + coupons: { enabled: true }, + updated_at: "2022-06-16T22:25:35Z", + }, + }; + server + .mockEndpoint() + .put("/v2/online-checkout/location-settings/location_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.updateLocationSettings({ + location_id: "location_id", + location_settings: {}, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + location_settings: { + location_id: "LOCATION_ID_1", + customer_notes_enabled: false, + policies: [ + { + uid: "POLICY_ID_1", + title: "Return Policy", + description: "This is my Return Policy", + }, + { + uid: "POLICY_ID_2", + title: "Return Policy", + description: "Items may be returned within 30 days of purchase.", + }, + ], + branding: { + header_type: "FRAMED_LOGO", + button_color: "#00b23b", + button_shape: "ROUNDED", + }, + tipping: { + percentages: [15, 20, 25], + smart_tipping_enabled: true, + default_percent: 20, + smart_tips: [{}], + }, + coupons: { + enabled: true, + }, + updated_at: "2022-06-16T22:25:35Z", + }, + }); + }); + + test("RetrieveMerchantSettings", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + merchant_settings: { + payment_methods: { + apple_pay: { enabled: true }, + google_pay: { enabled: true }, + afterpay_clearpay: { + order_eligibility_range: { + min: { amount: BigInt(100), currency: "USD" }, + max: { amount: BigInt(10000), currency: "USD" }, + }, + item_eligibility_range: { + min: { amount: BigInt(100), currency: "USD" }, + max: { amount: BigInt(10000), currency: "USD" }, + }, + enabled: true, + }, + }, + updated_at: "2022-06-16T22:25:35Z", + }, + }; + server + .mockEndpoint() + .get("/v2/online-checkout/merchant-settings") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.retrieveMerchantSettings(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + merchant_settings: { + payment_methods: { + apple_pay: { + enabled: true, + }, + google_pay: { + enabled: true, + }, + afterpay_clearpay: { + order_eligibility_range: { + min: { + amount: BigInt("100"), + currency: "USD", + }, + max: { + amount: BigInt("10000"), + currency: "USD", + }, + }, + item_eligibility_range: { + min: { + amount: BigInt("100"), + currency: "USD", + }, + max: { + amount: BigInt("10000"), + currency: "USD", + }, + }, + enabled: true, + }, + }, + updated_at: "2022-06-16T22:25:35Z", + }, + }); + }); + + test("UpdateMerchantSettings", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { merchant_settings: {} }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + merchant_settings: { + payment_methods: { + apple_pay: { enabled: false }, + google_pay: { enabled: true }, + afterpay_clearpay: { + order_eligibility_range: { + min: { amount: BigInt(100), currency: "USD" }, + max: { amount: BigInt(10000), currency: "USD" }, + }, + item_eligibility_range: { + min: { amount: BigInt(100), currency: "USD" }, + max: { amount: BigInt(10000), currency: "USD" }, + }, + enabled: true, + }, + }, + updated_at: "2022-06-16T22:25:35Z", + }, + }; + server + .mockEndpoint() + .put("/v2/online-checkout/merchant-settings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.updateMerchantSettings({ + merchant_settings: {}, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + merchant_settings: { + payment_methods: { + apple_pay: { + enabled: false, + }, + google_pay: { + enabled: true, + }, + afterpay_clearpay: { + order_eligibility_range: { + min: { + amount: BigInt("100"), + currency: "USD", + }, + max: { + amount: BigInt("10000"), + currency: "USD", + }, + }, + item_eligibility_range: { + min: { + amount: BigInt("100"), + currency: "USD", + }, + max: { + amount: BigInt("10000"), + currency: "USD", + }, + }, + enabled: true, + }, + }, + updated_at: "2022-06-16T22:25:35Z", + }, + }); + }); +}); diff --git a/tests/wire/checkout/paymentLinks.test.ts b/tests/wire/checkout/paymentLinks.test.ts new file mode 100644 index 000000000..d1e9511cf --- /dev/null +++ b/tests/wire/checkout/paymentLinks.test.ts @@ -0,0 +1,463 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("PaymentLinks", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + quick_pay: { + name: "Auto Detailing", + price_money: { amount: BigInt(10000), currency: "USD" }, + location_id: "A9Y43N9ABXZBP", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment_link: { + id: "PKVT6XGJZXYUP3NZ", + version: 1, + description: "description", + order_id: "o4b7saqp4HzhNttf5AJxC0Srjd4F", + checkout_options: { + allow_tipping: true, + custom_fields: [{ title: "title" }], + subscription_plan_id: "subscription_plan_id", + redirect_url: "redirect_url", + merchant_support_email: "merchant_support_email", + ask_for_shipping_address: true, + shipping_fee: { charge: {} }, + enable_coupon: true, + enable_loyalty: true, + }, + pre_populated_data: { buyer_email: "buyer_email", buyer_phone_number: "buyer_phone_number" }, + url: "https://square.link/u/EXAMPLE", + long_url: "https://checkout.square.site/EXAMPLE", + created_at: "2022-04-25T23:58:01Z", + updated_at: "updated_at", + payment_note: "payment_note", + }, + related_resources: { + orders: [ + { + id: "o4b7saqp4HzhNttf5AJxC0Srjd4F", + location_id: "{LOCATION_ID}", + source: { name: "Test Online Checkout Application" }, + line_items: [ + { + uid: "8YX13D1U3jO7czP8JVrAR", + name: "Auto Detailing", + quantity: "1", + item_type: "ITEM", + base_price_money: { amount: BigInt(12500), currency: "USD" }, + variation_total_price_money: { amount: BigInt(12500), currency: "USD" }, + gross_sales_money: { amount: BigInt(12500), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_money: { amount: BigInt(12500), currency: "USD" }, + }, + ], + fulfillments: [{ uid: "bBpNrxjdQxGQP16sTmdzi", type: "PICKUP", state: "PROPOSED" }], + net_amounts: { + total_money: { amount: BigInt(12500), currency: "USD" }, + tax_money: { amount: BigInt(0), currency: "USD" }, + discount_money: { amount: BigInt(0), currency: "USD" }, + tip_money: { amount: BigInt(0), currency: "USD" }, + service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + created_at: "2022-03-03T00:53:15.829Z", + updated_at: "2022-03-03T00:53:15.829Z", + state: "DRAFT", + version: 1, + total_money: { amount: BigInt(12500), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_tip_money: { amount: BigInt(0), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + subscription_plans: [{ id: "id", type: "ITEM" }], + }, + }; + server + .mockEndpoint() + .post("/v2/online-checkout/payment-links") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.paymentLinks.create({ + idempotency_key: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + quick_pay: { + name: "Auto Detailing", + price_money: { + amount: BigInt("10000"), + currency: "USD", + }, + location_id: "A9Y43N9ABXZBP", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment_link: { + id: "PKVT6XGJZXYUP3NZ", + version: 1, + description: "description", + order_id: "o4b7saqp4HzhNttf5AJxC0Srjd4F", + checkout_options: { + allow_tipping: true, + custom_fields: [ + { + title: "title", + }, + ], + subscription_plan_id: "subscription_plan_id", + redirect_url: "redirect_url", + merchant_support_email: "merchant_support_email", + ask_for_shipping_address: true, + shipping_fee: { + charge: {}, + }, + enable_coupon: true, + enable_loyalty: true, + }, + pre_populated_data: { + buyer_email: "buyer_email", + buyer_phone_number: "buyer_phone_number", + }, + url: "https://square.link/u/EXAMPLE", + long_url: "https://checkout.square.site/EXAMPLE", + created_at: "2022-04-25T23:58:01Z", + updated_at: "updated_at", + payment_note: "payment_note", + }, + related_resources: { + orders: [ + { + id: "o4b7saqp4HzhNttf5AJxC0Srjd4F", + location_id: "{LOCATION_ID}", + source: { + name: "Test Online Checkout Application", + }, + line_items: [ + { + uid: "8YX13D1U3jO7czP8JVrAR", + name: "Auto Detailing", + quantity: "1", + item_type: "ITEM", + base_price_money: { + amount: BigInt("12500"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("12500"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("12500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_money: { + amount: BigInt("12500"), + currency: "USD", + }, + }, + ], + fulfillments: [ + { + uid: "bBpNrxjdQxGQP16sTmdzi", + type: "PICKUP", + state: "PROPOSED", + }, + ], + net_amounts: { + total_money: { + amount: BigInt("12500"), + currency: "USD", + }, + tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + created_at: "2022-03-03T00:53:15.829Z", + updated_at: "2022-03-03T00:53:15.829Z", + state: "DRAFT", + version: 1, + total_money: { + amount: BigInt("12500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + subscription_plans: [ + { + type: "ITEM", + id: "id", + }, + ], + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment_link: { + id: "LLO5Q3FRCFICDB4B", + version: 1, + description: "description", + order_id: "4uKASDATqSd1QQ9jV86sPhMdVEbSJc4F", + checkout_options: { + allow_tipping: true, + custom_fields: [{ title: "title" }], + subscription_plan_id: "subscription_plan_id", + redirect_url: "redirect_url", + merchant_support_email: "merchant_support_email", + ask_for_shipping_address: true, + shipping_fee: { charge: {} }, + enable_coupon: true, + enable_loyalty: true, + }, + pre_populated_data: { buyer_email: "buyer_email", buyer_phone_number: "buyer_phone_number" }, + url: "https://square.link/u/EXAMPLE", + long_url: "https://checkout.square.site/EXAMPLE", + created_at: "2022-04-26T00:10:29Z", + updated_at: "updated_at", + payment_note: "payment_note", + }, + }; + server + .mockEndpoint() + .get("/v2/online-checkout/payment-links/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.paymentLinks.get({ + id: "id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment_link: { + id: "LLO5Q3FRCFICDB4B", + version: 1, + description: "description", + order_id: "4uKASDATqSd1QQ9jV86sPhMdVEbSJc4F", + checkout_options: { + allow_tipping: true, + custom_fields: [ + { + title: "title", + }, + ], + subscription_plan_id: "subscription_plan_id", + redirect_url: "redirect_url", + merchant_support_email: "merchant_support_email", + ask_for_shipping_address: true, + shipping_fee: { + charge: {}, + }, + enable_coupon: true, + enable_loyalty: true, + }, + pre_populated_data: { + buyer_email: "buyer_email", + buyer_phone_number: "buyer_phone_number", + }, + url: "https://square.link/u/EXAMPLE", + long_url: "https://checkout.square.site/EXAMPLE", + created_at: "2022-04-26T00:10:29Z", + updated_at: "updated_at", + payment_note: "payment_note", + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { payment_link: { version: 1, checkout_options: { ask_for_shipping_address: true } } }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment_link: { + id: "TY4BWEDJ6AI5MBIV", + version: 2, + description: "description", + order_id: "Qqc8ypQGvxVwc46Cch4zHTaJqc4F", + checkout_options: { + allow_tipping: true, + custom_fields: [{ title: "title" }], + subscription_plan_id: "subscription_plan_id", + redirect_url: "redirect_url", + merchant_support_email: "merchant_support_email", + ask_for_shipping_address: true, + shipping_fee: { charge: {} }, + enable_coupon: true, + enable_loyalty: true, + }, + pre_populated_data: { buyer_email: "buyer_email", buyer_phone_number: "buyer_phone_number" }, + url: "https://square.link/u/EXAMPLE", + long_url: "https://checkout.square.site/EXAMPLE", + created_at: "2022-04-26T00:15:15Z", + updated_at: "2022-04-26T00:18:24Z", + payment_note: "test", + }, + }; + server + .mockEndpoint() + .put("/v2/online-checkout/payment-links/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.paymentLinks.update({ + id: "id", + payment_link: { + version: 1, + checkout_options: { + ask_for_shipping_address: true, + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment_link: { + id: "TY4BWEDJ6AI5MBIV", + version: 2, + description: "description", + order_id: "Qqc8ypQGvxVwc46Cch4zHTaJqc4F", + checkout_options: { + allow_tipping: true, + custom_fields: [ + { + title: "title", + }, + ], + subscription_plan_id: "subscription_plan_id", + redirect_url: "redirect_url", + merchant_support_email: "merchant_support_email", + ask_for_shipping_address: true, + shipping_fee: { + charge: {}, + }, + enable_coupon: true, + enable_loyalty: true, + }, + pre_populated_data: { + buyer_email: "buyer_email", + buyer_phone_number: "buyer_phone_number", + }, + url: "https://square.link/u/EXAMPLE", + long_url: "https://checkout.square.site/EXAMPLE", + created_at: "2022-04-26T00:15:15Z", + updated_at: "2022-04-26T00:18:24Z", + payment_note: "test", + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + id: "MQASNYL6QB6DFCJ3", + cancelled_order_id: "asx8LgZ6MRzD0fObfkJ6obBmSh4F", + }; + server + .mockEndpoint() + .delete("/v2/online-checkout/payment-links/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.checkout.paymentLinks.delete({ + id: "id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + id: "MQASNYL6QB6DFCJ3", + cancelled_order_id: "asx8LgZ6MRzD0fObfkJ6obBmSh4F", + }); + }); +}); diff --git a/tests/wire/customers.test.ts b/tests/wire/customers.test.ts new file mode 100644 index 000000000..7c50ed71b --- /dev/null +++ b/tests/wire/customers.test.ts @@ -0,0 +1,1121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Customers", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + customer: { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2016-03-23T20:21:54.859Z", + updated_at: "2016-03-23T20:21:54.859Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + phone_number: "+1-212-555-4240", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + group_ids: ["group_ids"], + segment_ids: ["segment_ids"], + version: BigInt(0), + tax_ids: { eu_vat: "eu_vat" }, + }, + }; + server + .mockEndpoint() + .post("/v2/customers") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.create({ + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + customer: { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2016-03-23T20:21:54.859Z", + updated_at: "2016-03-23T20:21:54.859Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + phone_number: "+1-212-555-4240", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + group_ids: ["group_ids"], + segment_ids: ["segment_ids"], + version: BigInt("0"), + tax_ids: { + eu_vat: "eu_vat", + }, + }, + }); + }); + + test("batchCreate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + customers: { + "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + }, + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + given_name: "Marie", + family_name: "Curie", + email_address: "Marie.Curie@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 601", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-444-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "another customer", + }, + }, + }; + const rawResponseBody = { + responses: { + "8bb76c4f-e35d-4c5b-90de-1194cd9179f4": { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + customer: { + id: "8DDA5NZVBZFGAX0V3HPF81HHE0", + created_at: "2024-03-23T20:21:54.859Z", + updated_at: "2024-03-23T20:21:54.859Z", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + version: BigInt(0), + }, + }, + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + customer: { + id: "N18CPRVXR5214XPBBA6BZQWF3C", + created_at: "2024-03-23T20:21:54.859Z", + updated_at: "2024-03-23T20:21:54.859Z", + given_name: "Marie", + family_name: "Curie", + email_address: "Marie.Curie@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 601", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-444-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "another customer", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + version: BigInt(0), + }, + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/customers/bulk-create") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.batchCreate({ + customers: { + "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + }, + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + given_name: "Marie", + family_name: "Curie", + email_address: "Marie.Curie@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 601", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-444-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "another customer", + }, + }, + }); + expect(response).toEqual({ + responses: { + "8bb76c4f-e35d-4c5b-90de-1194cd9179f4": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + customer: { + id: "8DDA5NZVBZFGAX0V3HPF81HHE0", + created_at: "2024-03-23T20:21:54.859Z", + updated_at: "2024-03-23T20:21:54.859Z", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + version: BigInt("0"), + }, + }, + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + customer: { + id: "N18CPRVXR5214XPBBA6BZQWF3C", + created_at: "2024-03-23T20:21:54.859Z", + updated_at: "2024-03-23T20:21:54.859Z", + given_name: "Marie", + family_name: "Curie", + email_address: "Marie.Curie@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 601", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-444-4240", + reference_id: "YOUR_REFERENCE_ID", + note: "another customer", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + version: BigInt("0"), + }, + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("BulkDeleteCustomers", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], + }; + const rawResponseBody = { + responses: { + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "NOT_FOUND", + detail: "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", + }, + ], + }, + "8DDA5NZVBZFGAX0V3HPF81HHE0": { errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }] }, + N18CPRVXR5214XPBBA6BZQWF3C: { errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }] }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/customers/bulk-delete") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.bulkDeleteCustomers({ + customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], + }); + expect(response).toEqual({ + responses: { + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "NOT_FOUND", + detail: "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", + }, + ], + }, + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("BulkRetrieveCustomers", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], + }; + const rawResponseBody = { + responses: { + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "NOT_FOUND", + detail: "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", + }, + ], + }, + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + customer: { + id: "8DDA5NZVBZFGAX0V3HPF81HHE0", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Amelia", + family_name: "Earhart", + email_address: "New.Amelia.Earhart@example.com", + birthday: "1897-07-24", + note: "updated customer note", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + version: BigInt(3), + }, + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + customer: { + id: "N18CPRVXR5214XPBBA6BZQWF3C", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Marie", + family_name: "Curie", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + version: BigInt(1), + }, + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/customers/bulk-retrieve") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.bulkRetrieveCustomers({ + customer_ids: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], + }); + expect(response).toEqual({ + responses: { + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "NOT_FOUND", + detail: "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", + }, + ], + }, + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + customer: { + id: "8DDA5NZVBZFGAX0V3HPF81HHE0", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Amelia", + family_name: "Earhart", + email_address: "New.Amelia.Earhart@example.com", + birthday: "1897-07-24", + note: "updated customer note", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + version: BigInt("3"), + }, + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + customer: { + id: "N18CPRVXR5214XPBBA6BZQWF3C", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Marie", + family_name: "Curie", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + version: BigInt("1"), + }, + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("BulkUpdateCustomers", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + customers: { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + email_address: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: BigInt(2), + }, + N18CPRVXR5214XPBBA6BZQWF3C: { given_name: "Marie", family_name: "Curie", version: BigInt(0) }, + }, + }; + const rawResponseBody = { + responses: { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + customer: { + id: "8DDA5NZVBZFGAX0V3HPF81HHE0", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Amelia", + family_name: "Earhart", + email_address: "New.Amelia.Earhart@example.com", + birthday: "1897-07-24", + note: "updated customer note", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + version: BigInt(3), + }, + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + customer: { + id: "N18CPRVXR5214XPBBA6BZQWF3C", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Marie", + family_name: "Curie", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + version: BigInt(1), + }, + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/customers/bulk-update") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.bulkUpdateCustomers({ + customers: { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + email_address: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: BigInt("2"), + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + given_name: "Marie", + family_name: "Curie", + version: BigInt("0"), + }, + }, + }); + expect(response).toEqual({ + responses: { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + customer: { + id: "8DDA5NZVBZFGAX0V3HPF81HHE0", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Amelia", + family_name: "Earhart", + email_address: "New.Amelia.Earhart@example.com", + birthday: "1897-07-24", + note: "updated customer note", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + version: BigInt("3"), + }, + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + customer: { + id: "N18CPRVXR5214XPBBA6BZQWF3C", + created_at: "2024-01-19T00:27:54.59Z", + updated_at: "2024-01-19T00:38:06Z", + given_name: "Marie", + family_name: "Curie", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + version: BigInt("1"), + }, + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + limit: BigInt(2), + query: { + filter: { + creation_source: { values: ["THIRD_PARTY"], rule: "INCLUDE" }, + created_at: { start_at: "2018-01-01T00:00:00-00:00", end_at: "2018-02-01T00:00:00-00:00" }, + email_address: { fuzzy: "example.com" }, + group_ids: { all: ["545AXB44B4XXWMVQ4W8SBT3HHF"] }, + }, + sort: { field: "CREATED_AT", order: "ASC" }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + customers: [ + { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2018-01-23T20:21:54.859Z", + updated_at: "2020-04-20T10:02:43.083Z", + given_name: "James", + family_name: "Bond", + nickname: "nickname", + company_name: "company_name", + email_address: "james.bond@example.com", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4250", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID_2", + note: "note", + preferences: { email_unsubscribed: false }, + creation_source: "DIRECTORY", + group_ids: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + segment_ids: ["1KB9JE5EGJXCW.REACHABLE"], + version: BigInt(7), + }, + { + id: "A9641GZW2H7Z56YYSD41Q12HDW", + created_at: "2018-01-30T14:10:54.859Z", + updated_at: "2018-03-08T18:25:21.342Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "amelia.earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-9238", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID_1", + note: "a customer", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + group_ids: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + segment_ids: ["1KB9JE5EGJXCW.REACHABLE"], + version: BigInt(1), + }, + ], + cursor: "9dpS093Uy12AzeE", + count: BigInt(1000000), + }; + server + .mockEndpoint() + .post("/v2/customers/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.search({ + limit: BigInt("2"), + query: { + filter: { + creation_source: { + values: ["THIRD_PARTY"], + rule: "INCLUDE", + }, + created_at: { + start_at: "2018-01-01T00:00:00-00:00", + end_at: "2018-02-01T00:00:00-00:00", + }, + email_address: { + fuzzy: "example.com", + }, + group_ids: { + all: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + }, + }, + sort: { + field: "CREATED_AT", + order: "ASC", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + customers: [ + { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2018-01-23T20:21:54.859Z", + updated_at: "2020-04-20T10:02:43.083Z", + given_name: "James", + family_name: "Bond", + nickname: "nickname", + company_name: "company_name", + email_address: "james.bond@example.com", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-4250", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID_2", + note: "note", + preferences: { + email_unsubscribed: false, + }, + creation_source: "DIRECTORY", + group_ids: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + segment_ids: ["1KB9JE5EGJXCW.REACHABLE"], + version: BigInt("7"), + }, + { + id: "A9641GZW2H7Z56YYSD41Q12HDW", + created_at: "2018-01-30T14:10:54.859Z", + updated_at: "2018-03-08T18:25:21.342Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "amelia.earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + phone_number: "+1-212-555-9238", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID_1", + note: "a customer", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + group_ids: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + segment_ids: ["1KB9JE5EGJXCW.REACHABLE"], + version: BigInt("1"), + }, + ], + cursor: "9dpS093Uy12AzeE", + count: BigInt("1000000"), + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + customer: { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2016-03-23T20:21:54.859Z", + updated_at: "2016-03-23T20:21:54.859Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + phone_number: "+1-212-555-4240", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + group_ids: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + segment_ids: ["1KB9JE5EGJXCW.REACHABLE"], + version: BigInt(1), + tax_ids: { eu_vat: "eu_vat" }, + }, + }; + server + .mockEndpoint() + .get("/v2/customers/customer_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.get({ + customer_id: "customer_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + customer: { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2016-03-23T20:21:54.859Z", + updated_at: "2016-03-23T20:21:54.859Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + phone_number: "+1-212-555-4240", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID", + note: "a customer", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + group_ids: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + segment_ids: ["1KB9JE5EGJXCW.REACHABLE"], + version: BigInt("1"), + tax_ids: { + eu_vat: "eu_vat", + }, + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + email_address: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: BigInt(2), + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + customer: { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2016-03-23T20:21:54.859Z", + updated_at: "2016-05-15T20:21:55Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "New.Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + phone_number: "phone_number", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID", + note: "updated customer note", + preferences: { email_unsubscribed: false }, + creation_source: "THIRD_PARTY", + group_ids: ["group_ids"], + segment_ids: ["segment_ids"], + version: BigInt(3), + tax_ids: { eu_vat: "eu_vat" }, + }, + }; + server + .mockEndpoint() + .put("/v2/customers/customer_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.update({ + customer_id: "customer_id", + email_address: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: BigInt("2"), + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + customer: { + id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2016-03-23T20:21:54.859Z", + updated_at: "2016-05-15T20:21:55Z", + given_name: "Amelia", + family_name: "Earhart", + nickname: "nickname", + company_name: "company_name", + email_address: "New.Amelia.Earhart@example.com", + address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + phone_number: "phone_number", + birthday: "birthday", + reference_id: "YOUR_REFERENCE_ID", + note: "updated customer note", + preferences: { + email_unsubscribed: false, + }, + creation_source: "THIRD_PARTY", + group_ids: ["group_ids"], + segment_ids: ["segment_ids"], + version: BigInt("3"), + tax_ids: { + eu_vat: "eu_vat", + }, + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/customers/customer_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.delete({ + customer_id: "customer_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/customers/cards.test.ts b/tests/wire/customers/cards.test.ts new file mode 100644 index 000000000..b39e93bb9 --- /dev/null +++ b/tests/wire/customers/cards.test.ts @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Cards", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + card_nonce: "YOUR_CARD_NONCE", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + cardholder_name: "Amelia Earhart", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + card: { + id: "icard-card_id", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2018), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "fingerprint", + customer_id: "customer_id", + merchant_id: "merchant_id", + reference_id: "reference_id", + enabled: true, + card_type: "UNKNOWN_CARD_TYPE", + prepaid_type: "UNKNOWN_PREPAID_TYPE", + bin: "bin", + version: BigInt(1000000), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: true, + }, + }; + server + .mockEndpoint() + .post("/v2/customers/customer_id/cards") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.cards.create({ + customer_id: "customer_id", + card_nonce: "YOUR_CARD_NONCE", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + cardholder_name: "Amelia Earhart", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + card: { + id: "icard-card_id", + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2018"), + cardholder_name: "Amelia Earhart", + billing_address: { + address_line_1: "500 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + fingerprint: "fingerprint", + customer_id: "customer_id", + merchant_id: "merchant_id", + reference_id: "reference_id", + enabled: true, + card_type: "UNKNOWN_CARD_TYPE", + prepaid_type: "UNKNOWN_PREPAID_TYPE", + bin: "bin", + version: BigInt("1000000"), + card_co_brand: "UNKNOWN", + issuer_alert: "ISSUER_ALERT_CARD_CLOSED", + issuer_alert_at: "issuer_alert_at", + hsa_fsa: true, + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/customers/customer_id/cards/card_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.cards.delete({ + customer_id: "customer_id", + card_id: "card_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/customers/customAttributeDefinitions.test.ts b/tests/wire/customers/customAttributeDefinitions.test.ts new file mode 100644 index 000000000..0e7f47617 --- /dev/null +++ b/tests/wire/customers/customAttributeDefinitions.test.ts @@ -0,0 +1,471 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributeDefinitions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { + 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", + }, + }; + const rawResponseBody = { + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-04-26T15:27:30Z", + created_at: "2022-04-26T15:27:30Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/customers/custom-attribute-definitions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributeDefinitions.create({ + custom_attribute_definition: { + 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", + }, + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-04-26T15:27:30Z", + created_at: "2022-04-26T15:27:30Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute_definition: { + 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_READ_WRITE_VALUES", + version: 1, + updated_at: "2022-04-26T15:27:30Z", + created_at: "2022-04-26T15:27:30Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/customers/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributeDefinitions.get({ + key: "key", + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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_READ_WRITE_VALUES", + version: 1, + updated_at: "2022-04-26T15:27:30Z", + created_at: "2022-04-26T15:27:30Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, + }; + const rawResponseBody = { + custom_attribute_definition: { + key: "favoritemovie", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite Movie", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2022-04-26T15:39:38Z", + created_at: "2022-04-26T15:27:30Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/customers/custom-attribute-definitions/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributeDefinitions.update({ + key: "key", + custom_attribute_definition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, + }); + expect(response).toEqual({ + custom_attribute_definition: { + key: "favoritemovie", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite Movie", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2022-04-26T15:39:38Z", + created_at: "2022-04-26T15:27:30Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/customers/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributeDefinitions.delete({ + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("batchUpsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + values: { + id1: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { key: "favoritemovie", value: "Dune" }, + }, + id2: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { key: "ownsmovie", value: false }, + }, + id3: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { key: "favoritemovie", value: "Star Wars" }, + }, + id4: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", value: "10.5" }, + }, + id5: { + customer_id: "70548QG1HN43B05G0KCZ4MMC1G", + custom_attribute: { + key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", + value: "fake-email@squareup.com", + }, + }, + }, + }; + const rawResponseBody = { + values: { + id1: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "favoritemovie", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-08T23:14:47Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id2: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "ownsmovie", + value: false, + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-09T00:16:20Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id3: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "favoritemovie", + value: "Star Wars", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-09T00:16:20Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id4: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", + value: "10.5", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-08T23:14:47Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id5: { + customer_id: "70548QG1HN43B05G0KCZ4MMC1G", + custom_attribute: { + key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", + value: "fake-email@squareup.com", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-09T00:16:20Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/customers/custom-attributes/bulk-upsert") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributeDefinitions.batchUpsert({ + values: { + id1: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "favoritemovie", + value: "Dune", + }, + }, + id2: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "ownsmovie", + value: false, + }, + }, + id3: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "favoritemovie", + value: "Star Wars", + }, + }, + id4: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", + value: "10.5", + }, + }, + id5: { + customer_id: "70548QG1HN43B05G0KCZ4MMC1G", + custom_attribute: { + key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", + value: "fake-email@squareup.com", + }, + }, + }, + }); + expect(response).toEqual({ + values: { + id1: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "favoritemovie", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-08T23:14:47Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id2: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "ownsmovie", + value: false, + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-09T00:16:20Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id3: { + customer_id: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + custom_attribute: { + key: "favoritemovie", + value: "Star Wars", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-09T00:16:20Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id4: { + customer_id: "N3NCVYY3WS27HF0HKANA3R9FP8", + custom_attribute: { + key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", + value: "10.5", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-08T23:14:47Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id5: { + customer_id: "70548QG1HN43B05G0KCZ4MMC1G", + custom_attribute: { + key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", + value: "fake-email@squareup.com", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2021-12-09T00:16:23Z", + created_at: "2021-12-09T00:16:20Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/customers/customAttributes.test.ts b/tests/wire/customers/customAttributes.test.ts new file mode 100644 index 000000000..ef0d948a5 --- /dev/null +++ b/tests/wire/customers/customAttributes.test.ts @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributes", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute: { + key: "favoritemovie", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-04-26T15:50:27Z", + created_at: "2022-04-26T15:50:27Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/customers/customer_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributes.get({ + customer_id: "customer_id", + key: "key", + }); + expect(response).toEqual({ + custom_attribute: { + key: "favoritemovie", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-04-26T15:50:27Z", + created_at: "2022-04-26T15:50:27Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("upsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { custom_attribute: { value: "Dune" } }; + const rawResponseBody = { + custom_attribute: { + key: "favoritemovie", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-04-26T15:50:27Z", + created_at: "2022-04-26T15:50:27Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/customers/customer_id/custom-attributes/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributes.upsert({ + customer_id: "customer_id", + key: "key", + custom_attribute: { + value: "Dune", + }, + }); + expect(response).toEqual({ + custom_attribute: { + key: "favoritemovie", + value: "Dune", + version: 1, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-04-26T15:50:27Z", + created_at: "2022-04-26T15:50:27Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/customers/customer_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.customAttributes.delete({ + customer_id: "customer_id", + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/customers/groups.test.ts b/tests/wire/customers/groups.test.ts new file mode 100644 index 000000000..0b2ca567e --- /dev/null +++ b/tests/wire/customers/groups.test.ts @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Groups", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { group: { name: "Loyal Customers" } }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + group: { + id: "2TAT3CMH4Q0A9M87XJZED0WMR3", + name: "Loyal Customers", + created_at: "2020-04-13T21:54:57.863Z", + updated_at: "2020-04-13T21:54:58Z", + }, + }; + server + .mockEndpoint() + .post("/v2/customers/groups") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.groups.create({ + group: { + name: "Loyal Customers", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + group: { + id: "2TAT3CMH4Q0A9M87XJZED0WMR3", + name: "Loyal Customers", + created_at: "2020-04-13T21:54:57.863Z", + updated_at: "2020-04-13T21:54:58Z", + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + group: { + id: "2TAT3CMH4Q0A9M87XJZED0WMR3", + name: "Loyal Customers", + created_at: "2020-04-13T21:54:57.863Z", + updated_at: "2020-04-13T21:54:58Z", + }, + }; + server + .mockEndpoint() + .get("/v2/customers/groups/group_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.groups.get({ + group_id: "group_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + group: { + id: "2TAT3CMH4Q0A9M87XJZED0WMR3", + name: "Loyal Customers", + created_at: "2020-04-13T21:54:57.863Z", + updated_at: "2020-04-13T21:54:58Z", + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { group: { name: "Loyal Customers" } }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + group: { + id: "2TAT3CMH4Q0A9M87XJZED0WMR3", + name: "Loyal Customers", + created_at: "2020-04-13T21:54:57.863Z", + updated_at: "2020-04-13T21:54:58Z", + }, + }; + server + .mockEndpoint() + .put("/v2/customers/groups/group_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.groups.update({ + group_id: "group_id", + group: { + name: "Loyal Customers", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + group: { + id: "2TAT3CMH4Q0A9M87XJZED0WMR3", + name: "Loyal Customers", + created_at: "2020-04-13T21:54:57.863Z", + updated_at: "2020-04-13T21:54:58Z", + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/customers/groups/group_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.groups.delete({ + group_id: "group_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("add", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/customers/customer_id/groups/group_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.groups.add({ + customer_id: "customer_id", + group_id: "group_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("remove", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/customers/customer_id/groups/group_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.groups.remove({ + customer_id: "customer_id", + group_id: "group_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/customers/segments.test.ts b/tests/wire/customers/segments.test.ts new file mode 100644 index 000000000..1762efaa8 --- /dev/null +++ b/tests/wire/customers/segments.test.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Segments", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + segment: { + id: "GMNXRZVEXNQDF.CHURN_RISK", + name: "Lapsed", + created_at: "2020-01-09T19:33:24.469Z", + updated_at: "2020-04-13T23:01:13Z", + }, + }; + server + .mockEndpoint() + .get("/v2/customers/segments/segment_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.customers.segments.get({ + segment_id: "segment_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + segment: { + id: "GMNXRZVEXNQDF.CHURN_RISK", + name: "Lapsed", + created_at: "2020-01-09T19:33:24.469Z", + updated_at: "2020-04-13T23:01:13Z", + }, + }); + }); +}); diff --git a/tests/wire/devices.test.ts b/tests/wire/devices.test.ts new file mode 100644 index 000000000..2248fb616 --- /dev/null +++ b/tests/wire/devices.test.ts @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Devices", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + device: { + id: "device:995CS397A6475287", + attributes: { + type: "TERMINAL", + manufacturer: "Square", + model: "T2", + name: "Square Terminal 995", + manufacturers_id: "995CS397A6475287", + updated_at: "2023-09-29T13:12:22.365049321Z", + version: "5.41.0085", + merchant_token: "MLCHXZCBWFGDW", + }, + components: [ + { + type: "APPLICATION", + application_details: { + application_type: "TERMINAL_API", + version: "6.25", + session_location: "LMN2K7S3RTOU3", + }, + }, + { type: "CARD_READER", card_reader_details: { version: "3.53.70" } }, + { type: "BATTERY", battery_details: { visible_percent: 5, external_power: "AVAILABLE_CHARGING" } }, + { + type: "WIFI", + wifi_details: { + active: true, + ssid: "Staff Network", + ip_address_v4: "10.0.0.7", + secure_connection: "WPA/WPA2 PSK", + signal_strength: { value: 2 }, + }, + }, + { type: "ETHERNET", ethernet_details: { active: false } }, + ], + status: { category: "AVAILABLE" }, + }, + }; + server + .mockEndpoint() + .get("/v2/devices/device_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.devices.get({ + device_id: "device_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + device: { + id: "device:995CS397A6475287", + attributes: { + type: "TERMINAL", + manufacturer: "Square", + model: "T2", + name: "Square Terminal 995", + manufacturers_id: "995CS397A6475287", + updated_at: "2023-09-29T13:12:22.365049321Z", + version: "5.41.0085", + merchant_token: "MLCHXZCBWFGDW", + }, + components: [ + { + type: "APPLICATION", + application_details: { + application_type: "TERMINAL_API", + version: "6.25", + session_location: "LMN2K7S3RTOU3", + }, + }, + { + type: "CARD_READER", + card_reader_details: { + version: "3.53.70", + }, + }, + { + type: "BATTERY", + battery_details: { + visible_percent: 5, + external_power: "AVAILABLE_CHARGING", + }, + }, + { + type: "WIFI", + wifi_details: { + active: true, + ssid: "Staff Network", + ip_address_v4: "10.0.0.7", + secure_connection: "WPA/WPA2 PSK", + signal_strength: { + value: 2, + }, + }, + }, + { + type: "ETHERNET", + ethernet_details: { + active: false, + }, + }, + ], + status: { + category: "AVAILABLE", + }, + }, + }); + }); +}); diff --git a/tests/wire/devices/codes.test.ts b/tests/wire/devices/codes.test.ts new file mode 100644 index 000000000..bdc0dd587 --- /dev/null +++ b/tests/wire/devices/codes.test.ts @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Codes", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + device_code: { name: "Counter 1", product_type: "TERMINAL_API", location_id: "B5E4484SHHNYH" }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + device_code: { + id: "B3Z6NAMYQSMTM", + name: "Counter 1", + code: "EBCARJ", + device_id: "device_id", + product_type: "TERMINAL_API", + location_id: "B5E4484SHHNYH", + status: "UNPAIRED", + pair_by: "2020-02-06T18:49:33.000Z", + created_at: "2020-02-06T18:44:33.000Z", + status_changed_at: "2020-02-06T18:44:33.000Z", + paired_at: "paired_at", + }, + }; + server + .mockEndpoint() + .post("/v2/devices/codes") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.devices.codes.create({ + idempotency_key: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + device_code: { + name: "Counter 1", + product_type: "TERMINAL_API", + location_id: "B5E4484SHHNYH", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + device_code: { + id: "B3Z6NAMYQSMTM", + name: "Counter 1", + code: "EBCARJ", + device_id: "device_id", + product_type: "TERMINAL_API", + location_id: "B5E4484SHHNYH", + status: "UNPAIRED", + pair_by: "2020-02-06T18:49:33.000Z", + created_at: "2020-02-06T18:44:33.000Z", + status_changed_at: "2020-02-06T18:44:33.000Z", + paired_at: "paired_at", + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + device_code: { + id: "B3Z6NAMYQSMTM", + name: "Counter 1", + code: "EBCARJ", + device_id: "907CS13101300122", + product_type: "TERMINAL_API", + location_id: "B5E4484SHHNYH", + status: "PAIRED", + pair_by: "2020-02-06T18:49:33.000Z", + created_at: "2020-02-06T18:44:33.000Z", + status_changed_at: "2020-02-06T18:47:28.000Z", + paired_at: "paired_at", + }, + }; + server + .mockEndpoint() + .get("/v2/devices/codes/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.devices.codes.get({ + id: "id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + device_code: { + id: "B3Z6NAMYQSMTM", + name: "Counter 1", + code: "EBCARJ", + device_id: "907CS13101300122", + product_type: "TERMINAL_API", + location_id: "B5E4484SHHNYH", + status: "PAIRED", + pair_by: "2020-02-06T18:49:33.000Z", + created_at: "2020-02-06T18:44:33.000Z", + status_changed_at: "2020-02-06T18:47:28.000Z", + paired_at: "paired_at", + }, + }); + }); +}); diff --git a/tests/wire/disputes.test.ts b/tests/wire/disputes.test.ts new file mode 100644 index 000000000..1c028a382 --- /dev/null +++ b/tests/wire/disputes.test.ts @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Disputes", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + dispute: { + dispute_id: "dispute_id", + id: "XDgyFu7yo1E2S5lQGGpYn", + amount_money: { amount: BigInt(2500), currency: "USD" }, + reason: "NO_KNOWLEDGE", + state: "ACCEPTED", + due_at: "2022-07-13T00:00:00.000Z", + disputed_payment: { payment_id: "zhyh1ch64kRBrrlfVhwjCEjZWzNZY" }, + evidence_ids: ["evidence_ids"], + card_brand: "VISA", + created_at: "2022-06-29T18:45:22.265Z", + updated_at: "2022-07-07T19:14:42.650Z", + brand_dispute_id: "100000809947", + reported_date: "reported_date", + reported_at: "2022-06-29T00:00:00.000Z", + version: 2, + location_id: "L1HN3ZMQK64X9", + }, + }; + server + .mockEndpoint() + .get("/v2/disputes/dispute_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.disputes.get({ + dispute_id: "dispute_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + dispute: { + dispute_id: "dispute_id", + id: "XDgyFu7yo1E2S5lQGGpYn", + amount_money: { + amount: BigInt("2500"), + currency: "USD", + }, + reason: "NO_KNOWLEDGE", + state: "ACCEPTED", + due_at: "2022-07-13T00:00:00.000Z", + disputed_payment: { + payment_id: "zhyh1ch64kRBrrlfVhwjCEjZWzNZY", + }, + evidence_ids: ["evidence_ids"], + card_brand: "VISA", + created_at: "2022-06-29T18:45:22.265Z", + updated_at: "2022-07-07T19:14:42.650Z", + brand_dispute_id: "100000809947", + reported_date: "reported_date", + reported_at: "2022-06-29T00:00:00.000Z", + version: 2, + location_id: "L1HN3ZMQK64X9", + }, + }); + }); + + test("accept", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + dispute: { + dispute_id: "dispute_id", + id: "XDgyFu7yo1E2S5lQGGpYn", + amount_money: { amount: BigInt(2500), currency: "USD" }, + reason: "NO_KNOWLEDGE", + state: "ACCEPTED", + due_at: "2022-07-13T00:00:00.000Z", + disputed_payment: { payment_id: "zhyh1ch64kRBrrlfVhwjCEjZWzNZY" }, + evidence_ids: ["evidence_ids"], + card_brand: "VISA", + created_at: "2022-06-29T18:45:22.265Z", + updated_at: "2022-07-07T19:14:42.650Z", + brand_dispute_id: "100000809947", + reported_date: "reported_date", + reported_at: "2022-06-29T00:00:00.000Z", + version: 2, + location_id: "L1HN3ZMQK64X9", + }, + }; + server + .mockEndpoint() + .post("/v2/disputes/dispute_id/accept") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.disputes.accept({ + dispute_id: "dispute_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + dispute: { + dispute_id: "dispute_id", + id: "XDgyFu7yo1E2S5lQGGpYn", + amount_money: { + amount: BigInt("2500"), + currency: "USD", + }, + reason: "NO_KNOWLEDGE", + state: "ACCEPTED", + due_at: "2022-07-13T00:00:00.000Z", + disputed_payment: { + payment_id: "zhyh1ch64kRBrrlfVhwjCEjZWzNZY", + }, + evidence_ids: ["evidence_ids"], + card_brand: "VISA", + created_at: "2022-06-29T18:45:22.265Z", + updated_at: "2022-07-07T19:14:42.650Z", + brand_dispute_id: "100000809947", + reported_date: "reported_date", + reported_at: "2022-06-29T00:00:00.000Z", + version: 2, + location_id: "L1HN3ZMQK64X9", + }, + }); + }); + + test("CreateEvidenceText", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "ed3ee3933d946f1514d505d173c82648", + evidence_type: "TRACKING_NUMBER", + evidence_text: "1Z8888888888888888", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + evidence: { + evidence_id: "evidence_id", + id: "TOomLInj6iWmP3N8qfCXrB", + dispute_id: "bVTprrwk0gygTLZ96VX1oB", + evidence_file: { filename: "filename", filetype: "filetype" }, + evidence_text: "The customer purchased the item twice, on April 11 and April 28.", + uploaded_at: "2022-05-18T16:01:10.000Z", + evidence_type: "REBUTTAL_EXPLANATION", + }, + }; + server + .mockEndpoint() + .post("/v2/disputes/dispute_id/evidence-text") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.disputes.createEvidenceText({ + dispute_id: "dispute_id", + idempotency_key: "ed3ee3933d946f1514d505d173c82648", + evidence_type: "TRACKING_NUMBER", + evidence_text: "1Z8888888888888888", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + evidence: { + evidence_id: "evidence_id", + id: "TOomLInj6iWmP3N8qfCXrB", + dispute_id: "bVTprrwk0gygTLZ96VX1oB", + evidence_file: { + filename: "filename", + filetype: "filetype", + }, + evidence_text: "The customer purchased the item twice, on April 11 and April 28.", + uploaded_at: "2022-05-18T16:01:10.000Z", + evidence_type: "REBUTTAL_EXPLANATION", + }, + }); + }); + + test("SubmitEvidence", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + dispute: { + dispute_id: "dispute_id", + id: "EAZoK70gX3fyvibecLwIGB", + amount_money: { amount: BigInt(4350), currency: "USD" }, + reason: "CUSTOMER_REQUESTS_CREDIT", + state: "PROCESSING", + due_at: "2022-06-01T00:00:00.000Z", + disputed_payment: { payment_id: "2yeBUWJzllJTpmnSqtMRAL19taB" }, + evidence_ids: ["evidence_ids"], + card_brand: "VISA", + created_at: "2022-05-18T16:02:15.313Z", + updated_at: "2022-05-18T16:02:15.313Z", + brand_dispute_id: "100000399240", + reported_date: "reported_date", + reported_at: "2022-05-18T00:00:00.000Z", + version: 4, + location_id: "LSY8XKGSMMX94", + }, + }; + server + .mockEndpoint() + .post("/v2/disputes/dispute_id/submit-evidence") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.disputes.submitEvidence({ + dispute_id: "dispute_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + dispute: { + dispute_id: "dispute_id", + id: "EAZoK70gX3fyvibecLwIGB", + amount_money: { + amount: BigInt("4350"), + currency: "USD", + }, + reason: "CUSTOMER_REQUESTS_CREDIT", + state: "PROCESSING", + due_at: "2022-06-01T00:00:00.000Z", + disputed_payment: { + payment_id: "2yeBUWJzllJTpmnSqtMRAL19taB", + }, + evidence_ids: ["evidence_ids"], + card_brand: "VISA", + created_at: "2022-05-18T16:02:15.313Z", + updated_at: "2022-05-18T16:02:15.313Z", + brand_dispute_id: "100000399240", + reported_date: "reported_date", + reported_at: "2022-05-18T00:00:00.000Z", + version: 4, + location_id: "LSY8XKGSMMX94", + }, + }); + }); +}); diff --git a/tests/wire/disputes/evidence.test.ts b/tests/wire/disputes/evidence.test.ts new file mode 100644 index 000000000..b42d4b54f --- /dev/null +++ b/tests/wire/disputes/evidence.test.ts @@ -0,0 +1,91 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Evidence", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + evidence: { + evidence_id: "evidence_id", + id: "TOomLInj6iWmP3N8qfCXrB", + dispute_id: "bVTprrwk0gygTLZ96VX1oB", + evidence_file: { filename: "customer-interaction.jpg", filetype: "image/jpeg" }, + evidence_text: "evidence_text", + uploaded_at: "2022-05-18T16:01:10.000Z", + evidence_type: "CARDHOLDER_COMMUNICATION", + }, + }; + server + .mockEndpoint() + .get("/v2/disputes/dispute_id/evidence/evidence_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.disputes.evidence.get({ + dispute_id: "dispute_id", + evidence_id: "evidence_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + evidence: { + evidence_id: "evidence_id", + id: "TOomLInj6iWmP3N8qfCXrB", + dispute_id: "bVTprrwk0gygTLZ96VX1oB", + evidence_file: { + filename: "customer-interaction.jpg", + filetype: "image/jpeg", + }, + evidence_text: "evidence_text", + uploaded_at: "2022-05-18T16:01:10.000Z", + evidence_type: "CARDHOLDER_COMMUNICATION", + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/disputes/dispute_id/evidence/evidence_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.disputes.evidence.delete({ + dispute_id: "dispute_id", + evidence_id: "evidence_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/employees.test.ts b/tests/wire/employees.test.ts new file mode 100644 index 000000000..0c7ef8537 --- /dev/null +++ b/tests/wire/employees.test.ts @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Employees", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + employee: { + id: "id", + first_name: "first_name", + last_name: "last_name", + email: "email", + phone_number: "phone_number", + location_ids: ["location_ids"], + status: "ACTIVE", + is_owner: true, + created_at: "created_at", + updated_at: "updated_at", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server.mockEndpoint().get("/v2/employees/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.employees.get({ + id: "id", + }); + expect(response).toEqual({ + employee: { + id: "id", + first_name: "first_name", + last_name: "last_name", + email: "email", + phone_number: "phone_number", + location_ids: ["location_ids"], + status: "ACTIVE", + is_owner: true, + created_at: "created_at", + updated_at: "updated_at", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/events.test.ts b/tests/wire/events.test.ts new file mode 100644 index 000000000..21b7a04a0 --- /dev/null +++ b/tests/wire/events.test.ts @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Events", () => { + test("SearchEvents", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + events: [ + { + merchant_id: "0HPGX5JYE6EE1", + location_id: "VJDQQP3CG14EY", + type: "dispute.state.updated", + event_id: "73ecd468-0aba-424f-b862-583d44efe7c8", + created_at: "2022-04-26T10:08:40.454726", + data: { + type: "dispute", + 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, + }, + }, + }, + }, + ], + metadata: [{ event_id: "73ecd468-0aba-424f-b862-583d44efe7c8", api_version: "2022-12-13" }], + cursor: "6b571fc9773647f=", + }; + server + .mockEndpoint() + .post("/v2/events") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.events.searchEvents(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + events: [ + { + merchant_id: "0HPGX5JYE6EE1", + location_id: "VJDQQP3CG14EY", + type: "dispute.state.updated", + event_id: "73ecd468-0aba-424f-b862-583d44efe7c8", + created_at: "2022-04-26T10:08:40.454726", + data: { + type: "dispute", + 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, + }, + }, + }, + }, + ], + metadata: [ + { + event_id: "73ecd468-0aba-424f-b862-583d44efe7c8", + api_version: "2022-12-13", + }, + ], + cursor: "6b571fc9773647f=", + }); + }); + + test("DisableEvents", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server.mockEndpoint().put("/v2/events/disable").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.events.disableEvents(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("EnableEvents", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server.mockEndpoint().put("/v2/events/enable").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.events.enableEvents(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("ListEventTypes", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + event_types: ["inventory.count.updated"], + metadata: [ + { + event_type: "inventory.count.updated", + api_version_introduced: "2018-07-12", + release_status: "PUBLIC", + }, + ], + }; + server.mockEndpoint().get("/v2/events/types").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.events.listEventTypes(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + event_types: ["inventory.count.updated"], + metadata: [ + { + event_type: "inventory.count.updated", + api_version_introduced: "2018-07-12", + release_status: "PUBLIC", + }, + ], + }); + }); +}); diff --git a/tests/wire/giftCards.test.ts b/tests/wire/giftCards.test.ts new file mode 100644 index 000000000..4d692e64f --- /dev/null +++ b/tests/wire/giftCards.test.ts @@ -0,0 +1,335 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("GiftCards", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "NC9Tm69EjbjtConu", + location_id: "81FN9BNFZTKS4", + gift_card: { type: "DIGITAL" }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + gift_card: { + id: "gftc:6cbacbb64cf54e2ca9f573d619038059", + type: "DIGITAL", + gan_source: "SQUARE", + state: "PENDING", + balance_money: { amount: BigInt(0), currency: "USD" }, + gan: "7783320006753271", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }; + server + .mockEndpoint() + .post("/v2/gift-cards") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.giftCards.create({ + idempotency_key: "NC9Tm69EjbjtConu", + location_id: "81FN9BNFZTKS4", + gift_card: { + type: "DIGITAL", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + gift_card: { + id: "gftc:6cbacbb64cf54e2ca9f573d619038059", + type: "DIGITAL", + gan_source: "SQUARE", + state: "PENDING", + balance_money: { + amount: BigInt("0"), + currency: "USD", + }, + gan: "7783320006753271", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }); + }); + + test("getFromGAN", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { gan: "7783320001001635" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + gift_card: { + id: "gftc:6944163553804e439d89adb47caf806a", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { amount: BigInt(5000), currency: "USD" }, + gan: "7783320001001635", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }; + server + .mockEndpoint() + .post("/v2/gift-cards/from-gan") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.giftCards.getFromGan({ + gan: "7783320001001635", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + gift_card: { + id: "gftc:6944163553804e439d89adb47caf806a", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { + amount: BigInt("5000"), + currency: "USD", + }, + gan: "7783320001001635", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }); + }); + + test("getFromNonce", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { nonce: "cnon:7783322135245171" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + gift_card: { + id: "gftc:6944163553804e439d89adb47caf806a", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { amount: BigInt(5000), currency: "USD" }, + gan: "7783320001001635", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }; + server + .mockEndpoint() + .post("/v2/gift-cards/from-nonce") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.giftCards.getFromNonce({ + nonce: "cnon:7783322135245171", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + gift_card: { + id: "gftc:6944163553804e439d89adb47caf806a", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { + amount: BigInt("5000"), + currency: "USD", + }, + gan: "7783320001001635", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }); + }); + + test("LinkCustomer", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + gift_card: { + id: "gftc:71ea002277a34f8a945e284b04822edb", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { amount: BigInt(2500), currency: "USD" }, + gan: "7783320005440920", + created_at: "2021-03-25T05:13:01Z", + customer_ids: ["GKY0FZ3V717AH8Q2D821PNT2ZW"], + }, + }; + server + .mockEndpoint() + .post("/v2/gift-cards/gift_card_id/link-customer") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.giftCards.linkCustomer({ + gift_card_id: "gift_card_id", + customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + gift_card: { + id: "gftc:71ea002277a34f8a945e284b04822edb", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { + amount: BigInt("2500"), + currency: "USD", + }, + gan: "7783320005440920", + created_at: "2021-03-25T05:13:01Z", + customer_ids: ["GKY0FZ3V717AH8Q2D821PNT2ZW"], + }, + }); + }); + + test("UnlinkCustomer", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + gift_card: { + id: "gftc:71ea002277a34f8a945e284b04822edb", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { amount: BigInt(2500), currency: "USD" }, + gan: "7783320005440920", + created_at: "2021-03-25T05:13:01Z", + customer_ids: ["customer_ids"], + }, + }; + server + .mockEndpoint() + .post("/v2/gift-cards/gift_card_id/unlink-customer") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.giftCards.unlinkCustomer({ + gift_card_id: "gift_card_id", + customer_id: "GKY0FZ3V717AH8Q2D821PNT2ZW", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + gift_card: { + id: "gftc:71ea002277a34f8a945e284b04822edb", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { + amount: BigInt("2500"), + currency: "USD", + }, + gan: "7783320005440920", + created_at: "2021-03-25T05:13:01Z", + customer_ids: ["customer_ids"], + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + gift_card: { + id: "gftc:00113070ba5745f0b2377c1b9570cb03", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { amount: BigInt(1000), currency: "USD" }, + gan: "7783320001001635", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }; + server.mockEndpoint().get("/v2/gift-cards/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.giftCards.get({ + id: "id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + gift_card: { + id: "gftc:00113070ba5745f0b2377c1b9570cb03", + type: "DIGITAL", + gan_source: "SQUARE", + state: "ACTIVE", + balance_money: { + amount: BigInt("1000"), + currency: "USD", + }, + gan: "7783320001001635", + created_at: "2021-05-20T22:26:54.000Z", + customer_ids: ["customer_ids"], + }, + }); + }); +}); diff --git a/tests/wire/giftCards/activities.test.ts b/tests/wire/giftCards/activities.test.ts new file mode 100644 index 000000000..f1bbe765b --- /dev/null +++ b/tests/wire/giftCards/activities.test.ts @@ -0,0 +1,191 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Activities", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "U16kfr-kA70er-q4Rsym-7U7NnY", + gift_card_activity: { + type: "ACTIVATE", + location_id: "81FN9BNFZTKS4", + gift_card_id: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + activate_activity_details: { + order_id: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + line_item_uid: "eIWl7X0nMuO9Ewbh0ChIx", + }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + gift_card_activity: { + id: "gcact_c8f8cbf1f24b448d8ecf39ed03f97864", + type: "ACTIVATE", + location_id: "81FN9BNFZTKS4", + created_at: "2021-05-20T22:26:54.000Z", + gift_card_id: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + gift_card_gan: "7783320002929081", + gift_card_balance_money: { amount: BigInt(1000), currency: "USD" }, + load_activity_details: { + order_id: "order_id", + line_item_uid: "line_item_uid", + reference_id: "reference_id", + buyer_payment_instrument_ids: ["buyer_payment_instrument_ids"], + }, + activate_activity_details: { + amount_money: { amount: BigInt(1000), currency: "USD" }, + order_id: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + line_item_uid: "eIWl7X0nMuO9Ewbh0ChIx", + reference_id: "reference_id", + buyer_payment_instrument_ids: ["buyer_payment_instrument_ids"], + }, + redeem_activity_details: { + amount_money: {}, + payment_id: "payment_id", + reference_id: "reference_id", + status: "PENDING", + }, + clear_balance_activity_details: { reason: "SUSPICIOUS_ACTIVITY" }, + deactivate_activity_details: { reason: "SUSPICIOUS_ACTIVITY" }, + adjust_increment_activity_details: { amount_money: {}, reason: "COMPLIMENTARY" }, + adjust_decrement_activity_details: { amount_money: {}, reason: "SUSPICIOUS_ACTIVITY" }, + refund_activity_details: { + redeem_activity_id: "redeem_activity_id", + reference_id: "reference_id", + payment_id: "payment_id", + }, + unlinked_activity_refund_activity_details: { + amount_money: {}, + reference_id: "reference_id", + payment_id: "payment_id", + }, + import_activity_details: { amount_money: {} }, + block_activity_details: { reason: "CHARGEBACK_BLOCK" }, + unblock_activity_details: { reason: "CHARGEBACK_UNBLOCK" }, + import_reversal_activity_details: { amount_money: {} }, + transfer_balance_to_activity_details: { + transfer_from_gift_card_id: "transfer_from_gift_card_id", + amount_money: {}, + }, + transfer_balance_from_activity_details: { + transfer_to_gift_card_id: "transfer_to_gift_card_id", + amount_money: {}, + }, + }, + }; + server + .mockEndpoint() + .post("/v2/gift-cards/activities") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.giftCards.activities.create({ + idempotency_key: "U16kfr-kA70er-q4Rsym-7U7NnY", + gift_card_activity: { + type: "ACTIVATE", + location_id: "81FN9BNFZTKS4", + gift_card_id: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + activate_activity_details: { + order_id: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + line_item_uid: "eIWl7X0nMuO9Ewbh0ChIx", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + gift_card_activity: { + id: "gcact_c8f8cbf1f24b448d8ecf39ed03f97864", + type: "ACTIVATE", + location_id: "81FN9BNFZTKS4", + created_at: "2021-05-20T22:26:54.000Z", + gift_card_id: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + gift_card_gan: "7783320002929081", + gift_card_balance_money: { + amount: BigInt("1000"), + currency: "USD", + }, + load_activity_details: { + order_id: "order_id", + line_item_uid: "line_item_uid", + reference_id: "reference_id", + buyer_payment_instrument_ids: ["buyer_payment_instrument_ids"], + }, + activate_activity_details: { + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + order_id: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + line_item_uid: "eIWl7X0nMuO9Ewbh0ChIx", + reference_id: "reference_id", + buyer_payment_instrument_ids: ["buyer_payment_instrument_ids"], + }, + redeem_activity_details: { + amount_money: {}, + payment_id: "payment_id", + reference_id: "reference_id", + status: "PENDING", + }, + clear_balance_activity_details: { + reason: "SUSPICIOUS_ACTIVITY", + }, + deactivate_activity_details: { + reason: "SUSPICIOUS_ACTIVITY", + }, + adjust_increment_activity_details: { + amount_money: {}, + reason: "COMPLIMENTARY", + }, + adjust_decrement_activity_details: { + amount_money: {}, + reason: "SUSPICIOUS_ACTIVITY", + }, + refund_activity_details: { + redeem_activity_id: "redeem_activity_id", + reference_id: "reference_id", + payment_id: "payment_id", + }, + unlinked_activity_refund_activity_details: { + amount_money: {}, + reference_id: "reference_id", + payment_id: "payment_id", + }, + import_activity_details: { + amount_money: {}, + }, + block_activity_details: { + reason: "CHARGEBACK_BLOCK", + }, + unblock_activity_details: { + reason: "CHARGEBACK_UNBLOCK", + }, + import_reversal_activity_details: { + amount_money: {}, + }, + transfer_balance_to_activity_details: { + transfer_from_gift_card_id: "transfer_from_gift_card_id", + amount_money: {}, + }, + transfer_balance_from_activity_details: { + transfer_to_gift_card_id: "transfer_to_gift_card_id", + amount_money: {}, + }, + }, + }); + }); +}); diff --git a/tests/wire/inventory.test.ts b/tests/wire/inventory.test.ts new file mode 100644 index 000000000..3b4aff690 --- /dev/null +++ b/tests/wire/inventory.test.ts @@ -0,0 +1,730 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Inventory", () => { + test("DeprecatedGetAdjustment", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + adjustment: { + id: "UDMOEO78BG6GYWA2XDRYX3KB", + reference_id: "4a366069-4096-47a2-99a5-0084ac879509", + from_state: "IN_STOCK", + to_state: "SOLD", + location_id: "C6W5YS5QM06F5", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + quantity: "7", + total_price_money: { amount: BigInt(4550), currency: "USD" }, + occurred_at: "2016-11-16T25:44:22.837Z", + created_at: "2016-11-17T13:02:15.142Z", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + transaction_id: "transaction_id", + refund_id: "refund_id", + purchase_order_id: "purchase_order_id", + goods_receipt_id: "goods_receipt_id", + adjustment_group: { + id: "id", + root_adjustment_id: "root_adjustment_id", + from_state: "CUSTOM", + to_state: "CUSTOM", + }, + }, + }; + server + .mockEndpoint() + .get("/v2/inventory/adjustment/adjustment_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.deprecatedGetAdjustment({ + adjustment_id: "adjustment_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + adjustment: { + id: "UDMOEO78BG6GYWA2XDRYX3KB", + reference_id: "4a366069-4096-47a2-99a5-0084ac879509", + from_state: "IN_STOCK", + to_state: "SOLD", + location_id: "C6W5YS5QM06F5", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + quantity: "7", + total_price_money: { + amount: BigInt("4550"), + currency: "USD", + }, + occurred_at: "2016-11-16T25:44:22.837Z", + created_at: "2016-11-17T13:02:15.142Z", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + transaction_id: "transaction_id", + refund_id: "refund_id", + purchase_order_id: "purchase_order_id", + goods_receipt_id: "goods_receipt_id", + adjustment_group: { + id: "id", + root_adjustment_id: "root_adjustment_id", + from_state: "CUSTOM", + to_state: "CUSTOM", + }, + }, + }); + }); + + test("getAdjustment", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + adjustment: { + id: "UDMOEO78BG6GYWA2XDRYX3KB", + reference_id: "4a366069-4096-47a2-99a5-0084ac879509", + from_state: "IN_STOCK", + to_state: "SOLD", + location_id: "C6W5YS5QM06F5", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + quantity: "7", + total_price_money: { amount: BigInt(4550), currency: "USD" }, + occurred_at: "2016-11-16T25:44:22.837Z", + created_at: "2016-11-17T13:02:15.142Z", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + transaction_id: "transaction_id", + refund_id: "refund_id", + purchase_order_id: "purchase_order_id", + goods_receipt_id: "goods_receipt_id", + adjustment_group: { + id: "id", + root_adjustment_id: "root_adjustment_id", + from_state: "CUSTOM", + to_state: "CUSTOM", + }, + }, + }; + server + .mockEndpoint() + .get("/v2/inventory/adjustments/adjustment_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.getAdjustment({ + adjustment_id: "adjustment_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + adjustment: { + id: "UDMOEO78BG6GYWA2XDRYX3KB", + reference_id: "4a366069-4096-47a2-99a5-0084ac879509", + from_state: "IN_STOCK", + to_state: "SOLD", + location_id: "C6W5YS5QM06F5", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + quantity: "7", + total_price_money: { + amount: BigInt("4550"), + currency: "USD", + }, + occurred_at: "2016-11-16T25:44:22.837Z", + created_at: "2016-11-17T13:02:15.142Z", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + transaction_id: "transaction_id", + refund_id: "refund_id", + purchase_order_id: "purchase_order_id", + goods_receipt_id: "goods_receipt_id", + adjustment_group: { + id: "id", + root_adjustment_id: "root_adjustment_id", + from_state: "CUSTOM", + to_state: "CUSTOM", + }, + }, + }); + }); + + test("DeprecatedBatchChange", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + changes: [ + { + type: "PHYSICAL_COUNT", + physical_count: { + reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + }, + }, + ], + ignore_unchanged_counts: true, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + counts: [ + { + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + calculated_at: "2016-11-16T22:28:01.223Z", + is_estimated: true, + }, + ], + changes: [{ type: "PHYSICAL_COUNT", measurement_unit_id: "measurement_unit_id" }], + }; + server + .mockEndpoint() + .post("/v2/inventory/batch-change") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.deprecatedBatchChange({ + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + changes: [ + { + type: "PHYSICAL_COUNT", + physical_count: { + reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + }, + }, + ], + ignore_unchanged_counts: true, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + counts: [ + { + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + calculated_at: "2016-11-16T22:28:01.223Z", + is_estimated: true, + }, + ], + changes: [ + { + type: "PHYSICAL_COUNT", + measurement_unit_id: "measurement_unit_id", + }, + ], + }); + }); + + test("DeprecatedBatchGetChanges", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["C6W5YS5QM06F5"], + types: ["PHYSICAL_COUNT"], + states: ["IN_STOCK"], + updated_after: "2016-11-01T00:00:00.000Z", + updated_before: "2016-12-01T00:00:00.000Z", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + changes: [ + { + type: "PHYSICAL_COUNT", + physical_count: { + id: "46YDTW253DWGGK9HMAE6XCAO", + reference_id: "22c07cf4-5626-4224-89f9-691112019399", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "86", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:24:49.028Z", + created_at: "2016-11-16T22:25:24.878Z", + }, + measurement_unit_id: "measurement_unit_id", + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/inventory/batch-retrieve-changes") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.deprecatedBatchGetChanges({ + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["C6W5YS5QM06F5"], + types: ["PHYSICAL_COUNT"], + states: ["IN_STOCK"], + updated_after: "2016-11-01T00:00:00.000Z", + updated_before: "2016-12-01T00:00:00.000Z", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + changes: [ + { + type: "PHYSICAL_COUNT", + physical_count: { + id: "46YDTW253DWGGK9HMAE6XCAO", + reference_id: "22c07cf4-5626-4224-89f9-691112019399", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "86", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:24:49.028Z", + created_at: "2016-11-16T22:25:24.878Z", + }, + measurement_unit_id: "measurement_unit_id", + }, + ], + cursor: "cursor", + }); + }); + + test("DeprecatedBatchGetCounts", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["59TNP9SA8VGDA"], + updated_after: "2016-11-16T00:00:00.000Z", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + counts: [ + { + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "59TNP9SA8VGDA", + quantity: "79", + calculated_at: "2016-11-16T22:28:01.223Z", + is_estimated: true, + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/inventory/batch-retrieve-counts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.deprecatedBatchGetCounts({ + catalog_object_ids: ["W62UWFY35CWMYGVWK6TWJDNI"], + location_ids: ["59TNP9SA8VGDA"], + updated_after: "2016-11-16T00:00:00.000Z", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + counts: [ + { + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "59TNP9SA8VGDA", + quantity: "79", + calculated_at: "2016-11-16T22:28:01.223Z", + is_estimated: true, + }, + ], + cursor: "cursor", + }); + }); + + test("BatchCreateChanges", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + changes: [ + { + type: "PHYSICAL_COUNT", + physical_count: { + reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + }, + }, + ], + ignore_unchanged_counts: true, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + counts: [ + { + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + calculated_at: "2016-11-16T22:28:01.223Z", + is_estimated: true, + }, + ], + changes: [{ type: "PHYSICAL_COUNT", measurement_unit_id: "measurement_unit_id" }], + }; + server + .mockEndpoint() + .post("/v2/inventory/changes/batch-create") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.batchCreateChanges({ + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + changes: [ + { + type: "PHYSICAL_COUNT", + physical_count: { + reference_id: "1536bfbf-efed-48bf-b17d-a197141b2a92", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + }, + }, + ], + ignore_unchanged_counts: true, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + counts: [ + { + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "53", + calculated_at: "2016-11-16T22:28:01.223Z", + is_estimated: true, + }, + ], + changes: [ + { + type: "PHYSICAL_COUNT", + measurement_unit_id: "measurement_unit_id", + }, + ], + }); + }); + + test("deprecatedGetPhysicalCount", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + count: { + id: "ANZADNPLKADOJKJIUANKLMLQ", + reference_id: "f857ec37-f9a0-4458-8e23-5b5e0bea4e53", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "15", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + created_at: "2016-11-16T22:25:24.878Z", + }, + }; + server + .mockEndpoint() + .get("/v2/inventory/physical-count/physical_count_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.deprecatedGetPhysicalCount({ + physical_count_id: "physical_count_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + count: { + id: "ANZADNPLKADOJKJIUANKLMLQ", + reference_id: "f857ec37-f9a0-4458-8e23-5b5e0bea4e53", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "15", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + created_at: "2016-11-16T22:25:24.878Z", + }, + }); + }); + + test("getPhysicalCount", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + count: { + id: "ANZADNPLKADOJKJIUANKLMLQ", + reference_id: "f857ec37-f9a0-4458-8e23-5b5e0bea4e53", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "15", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + created_at: "2016-11-16T22:25:24.878Z", + }, + }; + server + .mockEndpoint() + .get("/v2/inventory/physical-counts/physical_count_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.getPhysicalCount({ + physical_count_id: "physical_count_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + count: { + id: "ANZADNPLKADOJKJIUANKLMLQ", + reference_id: "f857ec37-f9a0-4458-8e23-5b5e0bea4e53", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + state: "IN_STOCK", + location_id: "C6W5YS5QM06F5", + quantity: "15", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + occurred_at: "2016-11-16T22:25:24.878Z", + created_at: "2016-11-16T22:25:24.878Z", + }, + }); + }); + + test("getTransfer", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + transfer: { + id: "UDMOEO78BG6GYWA2XDRYX3KB", + reference_id: "4a366069-4096-47a2-99a5-0084ac879509", + state: "IN_STOCK", + from_location_id: "C6W5YS5QM06F5", + to_location_id: "59TNP9SA8VGDA", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + quantity: "7", + occurred_at: "2016-11-16T25:44:22.837Z", + created_at: "2016-11-17T13:02:15.142Z", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + }, + }; + server + .mockEndpoint() + .get("/v2/inventory/transfers/transfer_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.inventory.getTransfer({ + transfer_id: "transfer_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + transfer: { + id: "UDMOEO78BG6GYWA2XDRYX3KB", + reference_id: "4a366069-4096-47a2-99a5-0084ac879509", + state: "IN_STOCK", + from_location_id: "C6W5YS5QM06F5", + to_location_id: "59TNP9SA8VGDA", + catalog_object_id: "W62UWFY35CWMYGVWK6TWJDNI", + catalog_object_type: "ITEM_VARIATION", + quantity: "7", + occurred_at: "2016-11-16T25:44:22.837Z", + created_at: "2016-11-17T13:02:15.142Z", + source: { + product: "SQUARE_POS", + application_id: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", + name: "Square Point of Sale 4.37", + }, + employee_id: "employee_id", + team_member_id: "LRK57NSQ5X7PUD05", + }, + }); + }); +}); diff --git a/tests/wire/invoices.test.ts b/tests/wire/invoices.test.ts new file mode 100644 index 000000000..defa3060f --- /dev/null +++ b/tests/wire/invoices.test.ts @@ -0,0 +1,1328 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Invoices", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + invoice: { + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4" }, + payment_requests: [ + { + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [{ relative_scheduled_days: -1, message: "Your invoice is due tomorrow" }], + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { 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" }, + ], + sale_or_service_date: "2030-01-24", + store_payment_method_enabled: false, + }, + idempotency_key: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4", + }; + const rawResponseBody = { + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 0, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { amount: BigInt(10000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "DRAFT", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T17:45:13Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { 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" }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/invoices") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.create({ + invoice: { + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + }, + payment_requests: [ + { + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + }, + ], + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { + 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", + }, + ], + sale_or_service_date: "2030-01-24", + store_payment_method_enabled: false, + }, + idempotency_key: "ce3748f9-5fc1-4762-aa12-aae5e843f1f4", + }); + expect(response).toEqual({ + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 0, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { + amount: BigInt("10000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "DRAFT", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T17:45:13Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { + 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", + }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + query: { + filter: { location_ids: ["ES0RJRZYEC39A"], customer_ids: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"] }, + sort: { field: "INVOICE_SORT_DATE", order: "DESC" }, + }, + limit: 100, + }; + const rawResponseBody = { + invoices: [ + { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 0, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { amount: BigInt(10000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + status: "DRAFT", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T17:45:13Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { 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", + }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + { + id: "inv:0-ChC366qAfskpGrBI_1bozs9mEA3", + version: 3, + location_id: "ES0RJRZYEC39A", + order_id: "a65jnS8NXbfprvGJzY9F4fQTuaB", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + }, + payment_requests: [ + { + uid: "66c3bdfd-5090-4ff9-a8a0-c1e1a2ffa176", + request_type: "DEPOSIT", + due_date: "2021-01-23", + percentage_requested: "25", + tipping_enabled: false, + automatic_payment_source: "CARD_ON_FILE", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + computed_amount_money: { amount: BigInt(1000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(1000), currency: "USD" }, + }, + { + uid: "120c5e18-4f80-4f6b-b159-774cb9bf8f99", + request_type: "BALANCE", + due_date: "2021-06-15", + tipping_enabled: false, + automatic_payment_source: "CARD_ON_FILE", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + computed_amount_money: { amount: BigInt(3000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-455", + title: "title", + description: "description", + scheduled_at: "scheduled_at", + public_url: "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", + next_payment_amount_money: { amount: BigInt(3000), currency: "USD" }, + status: "PARTIALLY_PAID", + timezone: "America/Los_Angeles", + created_at: "2021-01-23T15:29:12Z", + updated_at: "2021-01-23T15:29:56Z", + accepted_payment_methods: { + card: true, + square_gift_card: true, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [{}], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + ], + cursor: "ChoIDhIWVm54ZVRhLXhySFBOejBBM2xJb2daUQoFCI4IGAE", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/invoices/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.search({ + query: { + filter: { + location_ids: ["ES0RJRZYEC39A"], + customer_ids: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"], + }, + sort: { + field: "INVOICE_SORT_DATE", + order: "DESC", + }, + }, + limit: 100, + }); + expect(response).toEqual({ + invoices: [ + { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 0, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { + amount: BigInt("10000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + status: "DRAFT", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T17:45:13Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { + 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", + }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + { + id: "inv:0-ChC366qAfskpGrBI_1bozs9mEA3", + version: 3, + location_id: "ES0RJRZYEC39A", + order_id: "a65jnS8NXbfprvGJzY9F4fQTuaB", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + }, + payment_requests: [ + { + uid: "66c3bdfd-5090-4ff9-a8a0-c1e1a2ffa176", + request_type: "DEPOSIT", + due_date: "2021-01-23", + percentage_requested: "25", + tipping_enabled: false, + automatic_payment_source: "CARD_ON_FILE", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + computed_amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + }, + { + uid: "120c5e18-4f80-4f6b-b159-774cb9bf8f99", + request_type: "BALANCE", + due_date: "2021-06-15", + tipping_enabled: false, + automatic_payment_source: "CARD_ON_FILE", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + computed_amount_money: { + amount: BigInt("3000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-455", + title: "title", + description: "description", + scheduled_at: "scheduled_at", + public_url: "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", + next_payment_amount_money: { + amount: BigInt("3000"), + currency: "USD", + }, + status: "PARTIALLY_PAID", + timezone: "America/Los_Angeles", + created_at: "2021-01-23T15:29:12Z", + updated_at: "2021-01-23T15:29:56Z", + accepted_payment_methods: { + card: true, + square_gift_card: true, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [{}], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + ], + cursor: "ChoIDhIWVm54ZVRhLXhySFBOejBBM2xJb2daUQoFCI4IGAE", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 0, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { amount: BigInt(10000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "DRAFT", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T17:45:13Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { 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" }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/invoices/invoice_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.get({ + invoice_id: "invoice_id", + }); + expect(response).toEqual({ + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 0, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { + amount: BigInt("10000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "DRAFT", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T17:45:13Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { + 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", + }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + invoice: { + version: 1, + payment_requests: [{ uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", tipping_enabled: false }], + }, + idempotency_key: "4ee82288-0910-499e-ab4c-5d0071dad1be", + }; + const rawResponseBody = { + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 2, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: false, + automatic_payment_source: "NONE", + computed_amount_money: { amount: BigInt(10000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { amount: BigInt(10000), currency: "USD" }, + status: "UNPAID", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T18:23:11Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { 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" }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/invoices/invoice_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.update({ + invoice_id: "invoice_id", + invoice: { + version: 1, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + tipping_enabled: false, + }, + ], + }, + idempotency_key: "4ee82288-0910-499e-ab4c-5d0071dad1be", + }); + expect(response).toEqual({ + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 2, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: false, + automatic_payment_source: "NONE", + computed_amount_money: { + amount: BigInt("10000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { + amount: BigInt("10000"), + currency: "USD", + }, + status: "UNPAID", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T18:23:11Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { + 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", + }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/invoices/invoice_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.delete({ + invoice_id: "invoice_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("DeleteInvoiceAttachment", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/invoices/invoice_id/attachments/attachment_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.deleteInvoiceAttachment({ + invoice_id: "invoice_id", + attachment_id: "attachment_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { version: 0 }; + const rawResponseBody = { + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 1, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { amount: BigInt(10000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "CANCELED", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T18:23:11Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { 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" }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/invoices/invoice_id/cancel") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.cancel({ + invoice_id: "invoice_id", + version: 0, + }); + expect(response).toEqual({ + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 1, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { + amount: BigInt("10000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "public_url", + next_payment_amount_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "CANCELED", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T18:23:11Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { + 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", + }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("publish", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { version: 1, idempotency_key: "32da42d0-1997-41b0-826b-f09464fc2c2e" }; + const rawResponseBody = { + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 1, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { amount: BigInt(10000), currency: "USD" }, + total_completed_amount_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", + next_payment_amount_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "SCHEDULED", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T18:23:11Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { 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" }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/invoices/invoice_id/publish") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.invoices.publish({ + invoice_id: "invoice_id", + version: 1, + idempotency_key: "32da42d0-1997-41b0-826b-f09464fc2c2e", + }); + expect(response).toEqual({ + invoice: { + id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + version: 1, + location_id: "ES0RJRZYEC39A", + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + primary_recipient: { + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + given_name: "Amelia", + family_name: "Earhart", + email_address: "Amelia.Earhart@example.com", + phone_number: "1-212-555-4240", + company_name: "company_name", + }, + payment_requests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + request_type: "BALANCE", + due_date: "2030-01-24", + tipping_enabled: true, + automatic_payment_source: "NONE", + reminders: [ + { + uid: "beebd363-e47f-4075-8785-c235aaa7df11", + relative_scheduled_days: -1, + message: "Your invoice is due tomorrow", + status: "PENDING", + }, + ], + computed_amount_money: { + amount: BigInt("10000"), + currency: "USD", + }, + total_completed_amount_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + delivery_method: "EMAIL", + invoice_number: "inv-100", + title: "Event Planning Services", + description: "We appreciate your business!", + scheduled_at: "2030-01-13T10:00:00Z", + public_url: "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", + next_payment_amount_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "SCHEDULED", + timezone: "America/Los_Angeles", + created_at: "2020-06-18T17:45:13Z", + updated_at: "2020-06-18T18:23:11Z", + accepted_payment_methods: { + card: true, + square_gift_card: false, + bank_account: false, + buy_now_pay_later: false, + cash_app_pay: false, + }, + custom_fields: [ + { + 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", + }, + ], + subscription_id: "subscription_id", + sale_or_service_date: "2030-01-24", + payment_conditions: "payment_conditions", + store_payment_method_enabled: false, + attachments: [{}], + creator_team_member_id: "creator_team_member_id", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/labor.test.ts b/tests/wire/labor.test.ts new file mode 100644 index 000000000..69054b4b5 --- /dev/null +++ b/tests/wire/labor.test.ts @@ -0,0 +1,1234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Labor", () => { + test("CreateScheduledShift", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "HIDSNG5KS478L", + scheduled_shift: { + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + }, + }, + }; + const rawResponseBody = { + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "team_member_id", + location_id: "location_id", + job_id: "job_id", + start_at: "start_at", + end_at: "end_at", + notes: "notes", + is_deleted: true, + timezone: "timezone", + }, + version: 1, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:00-05:00", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/scheduled-shifts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.createScheduledShift({ + idempotency_key: "HIDSNG5KS478L", + scheduled_shift: { + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + }, + }, + }); + expect(response).toEqual({ + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "team_member_id", + location_id: "location_id", + job_id: "job_id", + start_at: "start_at", + end_at: "end_at", + notes: "notes", + is_deleted: true, + timezone: "timezone", + }, + version: 1, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:00-05:00", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("BulkPublishScheduledShifts", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { scheduled_shifts: { key: {} }, scheduled_shift_notification_audience: "AFFECTED" }; + const rawResponseBody = { + responses: { + idp_key_1: { + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Don't forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Don't forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + version: 3, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:15-05:00", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + idp_key_2: { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "INVALID_VALUE", + detail: "Scheduled shift with id 'scheduled-shift-2' not found", + field: "scheduled-shifts.scheduled-shift-2", + }, + ], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/scheduled-shifts/bulk-publish") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.bulkPublishScheduledShifts({ + scheduled_shifts: { + key: {}, + }, + scheduled_shift_notification_audience: "AFFECTED", + }); + expect(response).toEqual({ + responses: { + idp_key_1: { + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Don't forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Don't forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + version: 3, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:15-05:00", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + idp_key_2: { + errors: [ + { + category: "INVALID_REQUEST_ERROR", + code: "INVALID_VALUE", + detail: "Scheduled shift with id 'scheduled-shift-2' not found", + field: "scheduled-shifts.scheduled-shift-2", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("SearchScheduledShifts", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + query: { filter: { assignment_status: "ASSIGNED" }, sort: { field: "CREATED_AT", order: "ASC" } }, + limit: 2, + cursor: "xoxp-1234-5678-90123", + }; + const rawResponseBody = { + scheduled_shifts: [ + { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + version: 1, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:00-05:00", + }, + ], + cursor: "xoxp-123-2123-123232", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/scheduled-shifts/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.searchScheduledShifts({ + query: { + filter: { + assignment_status: "ASSIGNED", + }, + sort: { + field: "CREATED_AT", + order: "ASC", + }, + }, + limit: 2, + cursor: "xoxp-1234-5678-90123", + }); + expect(response).toEqual({ + scheduled_shifts: [ + { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + version: 1, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:00-05:00", + }, + ], + cursor: "xoxp-123-2123-123232", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("RetrieveScheduledShift", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Don't forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "team_member_id", + location_id: "location_id", + job_id: "job_id", + start_at: "start_at", + end_at: "end_at", + notes: "notes", + is_deleted: true, + timezone: "timezone", + }, + version: 2, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:15-05:00", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/labor/scheduled-shifts/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.retrieveScheduledShift({ + id: "id", + }); + expect(response).toEqual({ + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Don't forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "team_member_id", + location_id: "location_id", + job_id: "job_id", + start_at: "start_at", + end_at: "end_at", + notes: "notes", + is_deleted: true, + timezone: "timezone", + }, + version: 2, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:15-05:00", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("UpdateScheduledShift", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + scheduled_shift: { + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + }, + version: 1, + }, + }; + const rawResponseBody = { + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "team_member_id", + location_id: "location_id", + job_id: "job_id", + start_at: "start_at", + end_at: "end_at", + notes: "notes", + is_deleted: true, + timezone: "timezone", + }, + version: 2, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:15-05:00", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/labor/scheduled-shifts/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.updateScheduledShift({ + id: "id", + scheduled_shift: { + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + }, + version: 1, + }, + }); + expect(response).toEqual({ + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-03-25T03:11:00-05:00", + end_at: "2019-03-25T13:18:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "team_member_id", + location_id: "location_id", + job_id: "job_id", + start_at: "start_at", + end_at: "end_at", + notes: "notes", + is_deleted: true, + timezone: "timezone", + }, + version: 2, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:15-05:00", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("PublishScheduledShift", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "HIDSNG5KS478L", + version: 2, + scheduled_shift_notification_audience: "ALL", + }; + const rawResponseBody = { + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + version: 2, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:00-05:00", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/scheduled-shifts/id/publish") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.publishScheduledShift({ + id: "id", + idempotency_key: "HIDSNG5KS478L", + version: 2, + scheduled_shift_notification_audience: "ALL", + }); + expect(response).toEqual({ + scheduled_shift: { + id: "K0YH4CV5462JB", + draft_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + published_shift_details: { + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + notes: "Dont forget to prep the vegetables", + is_deleted: false, + timezone: "America/New_York", + }, + version: 2, + created_at: "2019-02-25T03:11:00-05:00", + updated_at: "2019-02-25T03:11:00-05:00", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("CreateTimecard", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "HIDSNG5KS478L", + timecard: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { title: "Barista", hourly_rate: { amount: BigInt(1100), currency: "USD" }, tip_eligible: true }, + breaks: [ + { + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + }; + const rawResponseBody = { + timecard: { + id: "K0YH4CV5462JB", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { amount: BigInt(1100), currency: "USD" }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:39:02Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/timecards") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.createTimecard({ + idempotency_key: "HIDSNG5KS478L", + timecard: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { + amount: BigInt("1100"), + currency: "USD", + }, + tip_eligible: true, + }, + breaks: [ + { + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + }); + expect(response).toEqual({ + timecard: { + id: "K0YH4CV5462JB", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { + amount: BigInt("1100"), + currency: "USD", + }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:39:02Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("SearchTimecards", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + query: { + filter: { + workday: { + date_range: { start_date: "2019-01-20", end_date: "2019-02-03" }, + match_timecards_by: "START_AT", + default_timezone: "America/Los_Angeles", + }, + }, + }, + limit: 100, + }; + const rawResponseBody = { + timecards: [ + { + id: "X714F3HA6D1PT", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-21T03:11:00-05:00", + end_at: "2019-01-21T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { amount: BigInt(1100), currency: "USD" }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "SJW7X6AKEJQ65", + start_at: "2019-01-21T06:11:00-05:00", + end_at: "2019-01-21T06:11:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 6, + created_at: "2019-01-24T01:12:03Z", + updated_at: "2019-02-07T22:21:08Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + { + id: "GDHYBZYWK0P2V", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-22T12:02:00-05:00", + end_at: "2019-01-22T13:02:00-05:00", + wage: { + title: "Cook", + hourly_rate: { amount: BigInt(1600), currency: "USD" }, + job_id: "gcbz15vKGnMKmaWJJ152kjim", + tip_eligible: true, + }, + breaks: [ + { + id: "BKS6VR7WR748A", + start_at: "2019-01-22T14:30:00-05:00", + end_at: "2019-01-22T14:40:00-05:00", + break_type_id: "WQX00VR99F53J", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + { + id: "BQFEZSHFZSC51", + start_at: "2019-01-22T12:30:00-05:00", + end_at: "2019-01-22T12:44:00-05:00", + break_type_id: "P6Q468ZFRN1AC", + name: "Coffee Break", + expected_duration: "PT15M", + is_paid: false, + }, + ], + status: "CLOSED", + version: 16, + created_at: "2019-01-23T23:32:45Z", + updated_at: "2019-01-24T00:56:25Z", + team_member_id: "33fJchumvVdJwxV0H6L9", + declared_cash_tip_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + cursor: "cursor", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/timecards/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.searchTimecards({ + query: { + filter: { + workday: { + date_range: { + start_date: "2019-01-20", + end_date: "2019-02-03", + }, + match_timecards_by: "START_AT", + default_timezone: "America/Los_Angeles", + }, + }, + }, + limit: 100, + }); + expect(response).toEqual({ + timecards: [ + { + id: "X714F3HA6D1PT", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-21T03:11:00-05:00", + end_at: "2019-01-21T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { + amount: BigInt("1100"), + currency: "USD", + }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "SJW7X6AKEJQ65", + start_at: "2019-01-21T06:11:00-05:00", + end_at: "2019-01-21T06:11:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 6, + created_at: "2019-01-24T01:12:03Z", + updated_at: "2019-02-07T22:21:08Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + { + id: "GDHYBZYWK0P2V", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-22T12:02:00-05:00", + end_at: "2019-01-22T13:02:00-05:00", + wage: { + title: "Cook", + hourly_rate: { + amount: BigInt("1600"), + currency: "USD", + }, + job_id: "gcbz15vKGnMKmaWJJ152kjim", + tip_eligible: true, + }, + breaks: [ + { + id: "BKS6VR7WR748A", + start_at: "2019-01-22T14:30:00-05:00", + end_at: "2019-01-22T14:40:00-05:00", + break_type_id: "WQX00VR99F53J", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + { + id: "BQFEZSHFZSC51", + start_at: "2019-01-22T12:30:00-05:00", + end_at: "2019-01-22T12:44:00-05:00", + break_type_id: "P6Q468ZFRN1AC", + name: "Coffee Break", + expected_duration: "PT15M", + is_paid: false, + }, + ], + status: "CLOSED", + version: 16, + created_at: "2019-01-23T23:32:45Z", + updated_at: "2019-01-24T00:56:25Z", + team_member_id: "33fJchumvVdJwxV0H6L9", + declared_cash_tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + cursor: "cursor", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("RetrieveTimecard", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + timecard: { + id: "T35HMQSN89SV4", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-02-23T18:00:00-05:00", + end_at: "2019-02-23T21:00:00-05:00", + wage: { + title: "Cashier", + hourly_rate: { amount: BigInt(1457), currency: "USD" }, + job_id: "N4YKVLzFj3oGtNocqoYHYpW3", + tip_eligible: true, + }, + breaks: [ + { + id: "M9BBKEPQAQD2T", + start_at: "2019-02-23T19:00:00-05:00", + end_at: "2019-02-23T20:00:00-05:00", + break_type_id: "92EPDRQKJ5088", + name: "Lunch Break", + expected_duration: "PT1H", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-27T00:12:12Z", + updated_at: "2019-02-27T00:12:12Z", + team_member_id: "D71KRMQof6cXGUW0aAv7", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/labor/timecards/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.retrieveTimecard({ + id: "id", + }); + expect(response).toEqual({ + timecard: { + id: "T35HMQSN89SV4", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-02-23T18:00:00-05:00", + end_at: "2019-02-23T21:00:00-05:00", + wage: { + title: "Cashier", + hourly_rate: { + amount: BigInt("1457"), + currency: "USD", + }, + job_id: "N4YKVLzFj3oGtNocqoYHYpW3", + tip_eligible: true, + }, + breaks: [ + { + id: "M9BBKEPQAQD2T", + start_at: "2019-02-23T19:00:00-05:00", + end_at: "2019-02-23T20:00:00-05:00", + break_type_id: "92EPDRQKJ5088", + name: "Lunch Break", + expected_duration: "PT1H", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-27T00:12:12Z", + updated_at: "2019-02-27T00:12:12Z", + team_member_id: "D71KRMQof6cXGUW0aAv7", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("UpdateTimecard", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + timecard: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { amount: BigInt(1500), currency: "USD" }, + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + }; + const rawResponseBody = { + timecard: { + id: "K0YH4CV5462JB", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { amount: BigInt(1500), currency: "USD" }, + job_id: "dZtrPh5GSDGugyXGByesVp51", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 2, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:42:41Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/labor/timecards/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.updateTimecard({ + id: "id", + timecard: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { + amount: BigInt("1500"), + currency: "USD", + }, + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + }); + expect(response).toEqual({ + timecard: { + id: "K0YH4CV5462JB", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { + amount: BigInt("1500"), + currency: "USD", + }, + job_id: "dZtrPh5GSDGugyXGByesVp51", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 2, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:42:41Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("DeleteTimecard", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/labor/timecards/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.deleteTimecard({ + id: "id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/labor/breakTypes.test.ts b/tests/wire/labor/breakTypes.test.ts new file mode 100644 index 000000000..ee5a9cd5d --- /dev/null +++ b/tests/wire/labor/breakTypes.test.ts @@ -0,0 +1,219 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("BreakTypes", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "PAD3NG5KSN2GL", + break_type: { + location_id: "CGJN03P1D08GF", + break_name: "Lunch Break", + expected_duration: "PT30M", + is_paid: true, + }, + }; + const rawResponseBody = { + break_type: { + id: "49SSVDJG76WF3", + location_id: "CGJN03P1D08GF", + break_name: "Lunch Break", + expected_duration: "PT30M", + is_paid: true, + version: 1, + created_at: "2019-02-26T22:42:54Z", + updated_at: "2019-02-26T22:42:54Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/break-types") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.breakTypes.create({ + idempotency_key: "PAD3NG5KSN2GL", + break_type: { + location_id: "CGJN03P1D08GF", + break_name: "Lunch Break", + expected_duration: "PT30M", + is_paid: true, + }, + }); + expect(response).toEqual({ + break_type: { + id: "49SSVDJG76WF3", + location_id: "CGJN03P1D08GF", + break_name: "Lunch Break", + expected_duration: "PT30M", + is_paid: true, + version: 1, + created_at: "2019-02-26T22:42:54Z", + updated_at: "2019-02-26T22:42:54Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + break_type: { + id: "lA0mj_RSOprNPwMUXdYp", + location_id: "059SB0E0WCNWS", + break_name: "Lunch Break", + expected_duration: "PT30M", + is_paid: true, + version: 1, + created_at: "2019-02-21T17:50:00Z", + updated_at: "2019-02-21T17:50:00Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/labor/break-types/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.breakTypes.get({ + id: "id", + }); + expect(response).toEqual({ + break_type: { + id: "lA0mj_RSOprNPwMUXdYp", + location_id: "059SB0E0WCNWS", + break_name: "Lunch Break", + expected_duration: "PT30M", + is_paid: true, + version: 1, + created_at: "2019-02-21T17:50:00Z", + updated_at: "2019-02-21T17:50:00Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + break_type: { + location_id: "26M7H24AZ9N6R", + break_name: "Lunch", + expected_duration: "PT50M", + is_paid: true, + version: 1, + }, + }; + const rawResponseBody = { + break_type: { + id: "Q6JSJS6D4DBCH", + location_id: "26M7H24AZ9N6R", + break_name: "Lunch", + expected_duration: "PT50M", + is_paid: true, + version: 2, + created_at: "2018-06-12T20:19:12Z", + updated_at: "2019-02-26T23:12:59Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/labor/break-types/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.breakTypes.update({ + id: "id", + break_type: { + location_id: "26M7H24AZ9N6R", + break_name: "Lunch", + expected_duration: "PT50M", + is_paid: true, + version: 1, + }, + }); + expect(response).toEqual({ + break_type: { + id: "Q6JSJS6D4DBCH", + location_id: "26M7H24AZ9N6R", + break_name: "Lunch", + expected_duration: "PT50M", + is_paid: true, + version: 2, + created_at: "2018-06-12T20:19:12Z", + updated_at: "2019-02-26T23:12:59Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/labor/break-types/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.breakTypes.delete({ + id: "id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/labor/employeeWages.test.ts b/tests/wire/labor/employeeWages.test.ts new file mode 100644 index 000000000..9261ec223 --- /dev/null +++ b/tests/wire/labor/employeeWages.test.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("EmployeeWages", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + employee_wage: { + id: "pXS3qCv7BERPnEGedM4S8mhm", + employee_id: "33fJchumvVdJwxV0H6L9", + title: "Manager", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/labor/employee-wages/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.employeeWages.get({ + id: "id", + }); + expect(response).toEqual({ + employee_wage: { + id: "pXS3qCv7BERPnEGedM4S8mhm", + employee_id: "33fJchumvVdJwxV0H6L9", + title: "Manager", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/labor/shifts.test.ts b/tests/wire/labor/shifts.test.ts new file mode 100644 index 000000000..f1cbb0be2 --- /dev/null +++ b/tests/wire/labor/shifts.test.ts @@ -0,0 +1,651 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Shifts", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "HIDSNG5KS478L", + shift: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { title: "Barista", hourly_rate: { amount: BigInt(1100), currency: "USD" }, tip_eligible: true }, + breaks: [ + { + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + }; + const rawResponseBody = { + shift: { + id: "K0YH4CV5462JB", + employee_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { amount: BigInt(1100), currency: "USD" }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:39:02Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/shifts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.shifts.create({ + idempotency_key: "HIDSNG5KS478L", + shift: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { + amount: BigInt("1100"), + currency: "USD", + }, + tip_eligible: true, + }, + breaks: [ + { + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + }); + expect(response).toEqual({ + shift: { + id: "K0YH4CV5462JB", + employee_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { + amount: BigInt("1100"), + currency: "USD", + }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:39:02Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + query: { + filter: { + workday: { + date_range: { start_date: "2019-01-20", end_date: "2019-02-03" }, + match_shifts_by: "START_AT", + default_timezone: "America/Los_Angeles", + }, + }, + }, + limit: 100, + }; + const rawResponseBody = { + shifts: [ + { + id: "X714F3HA6D1PT", + employee_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-21T03:11:00-05:00", + end_at: "2019-01-21T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { amount: BigInt(1100), currency: "USD" }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "SJW7X6AKEJQ65", + start_at: "2019-01-21T06:11:00-05:00", + end_at: "2019-01-21T06:11:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 6, + created_at: "2019-01-24T01:12:03Z", + updated_at: "2019-02-07T22:21:08Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + { + id: "GDHYBZYWK0P2V", + employee_id: "33fJchumvVdJwxV0H6L9", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-22T12:02:00-05:00", + end_at: "2019-01-22T13:02:00-05:00", + wage: { + title: "Cook", + hourly_rate: { amount: BigInt(1600), currency: "USD" }, + job_id: "gcbz15vKGnMKmaWJJ152kjim", + tip_eligible: true, + }, + breaks: [ + { + id: "BKS6VR7WR748A", + start_at: "2019-01-23T14:30:00-05:00", + end_at: "2019-01-23T14:40:00-05:00", + break_type_id: "WQX00VR99F53J", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + { + id: "BQFEZSHFZSC51", + start_at: "2019-01-22T12:30:00-05:00", + end_at: "2019-01-22T12:44:00-05:00", + break_type_id: "P6Q468ZFRN1AC", + name: "Coffee Break", + expected_duration: "PT15M", + is_paid: false, + }, + ], + status: "CLOSED", + version: 16, + created_at: "2019-01-23T23:32:45Z", + updated_at: "2019-01-24T00:56:25Z", + team_member_id: "33fJchumvVdJwxV0H6L9", + declared_cash_tip_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + cursor: "cursor", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/labor/shifts/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.shifts.search({ + query: { + filter: { + workday: { + date_range: { + start_date: "2019-01-20", + end_date: "2019-02-03", + }, + match_shifts_by: "START_AT", + default_timezone: "America/Los_Angeles", + }, + }, + }, + limit: 100, + }); + expect(response).toEqual({ + shifts: [ + { + id: "X714F3HA6D1PT", + employee_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-21T03:11:00-05:00", + end_at: "2019-01-21T13:11:00-05:00", + wage: { + title: "Barista", + hourly_rate: { + amount: BigInt("1100"), + currency: "USD", + }, + job_id: "FzbJAtt9qEWncK1BWgVCxQ6M", + tip_eligible: true, + }, + breaks: [ + { + id: "SJW7X6AKEJQ65", + start_at: "2019-01-21T06:11:00-05:00", + end_at: "2019-01-21T06:11:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 6, + created_at: "2019-01-24T01:12:03Z", + updated_at: "2019-02-07T22:21:08Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + { + id: "GDHYBZYWK0P2V", + employee_id: "33fJchumvVdJwxV0H6L9", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-22T12:02:00-05:00", + end_at: "2019-01-22T13:02:00-05:00", + wage: { + title: "Cook", + hourly_rate: { + amount: BigInt("1600"), + currency: "USD", + }, + job_id: "gcbz15vKGnMKmaWJJ152kjim", + tip_eligible: true, + }, + breaks: [ + { + id: "BKS6VR7WR748A", + start_at: "2019-01-23T14:30:00-05:00", + end_at: "2019-01-23T14:40:00-05:00", + break_type_id: "WQX00VR99F53J", + name: "Tea Break", + expected_duration: "PT10M", + is_paid: true, + }, + { + id: "BQFEZSHFZSC51", + start_at: "2019-01-22T12:30:00-05:00", + end_at: "2019-01-22T12:44:00-05:00", + break_type_id: "P6Q468ZFRN1AC", + name: "Coffee Break", + expected_duration: "PT15M", + is_paid: false, + }, + ], + status: "CLOSED", + version: 16, + created_at: "2019-01-23T23:32:45Z", + updated_at: "2019-01-24T00:56:25Z", + team_member_id: "33fJchumvVdJwxV0H6L9", + declared_cash_tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + cursor: "cursor", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + shift: { + id: "T35HMQSN89SV4", + employee_id: "D71KRMQof6cXGUW0aAv7", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-02-23T18:00:00-05:00", + end_at: "2019-02-23T21:00:00-05:00", + wage: { + title: "Cashier", + hourly_rate: { amount: BigInt(1457), currency: "USD" }, + job_id: "N4YKVLzFj3oGtNocqoYHYpW3", + tip_eligible: true, + }, + breaks: [ + { + id: "M9BBKEPQAQD2T", + start_at: "2019-02-23T19:00:00-05:00", + end_at: "2019-02-23T20:00:00-05:00", + break_type_id: "92EPDRQKJ5088", + name: "Lunch Break", + expected_duration: "PT1H", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-27T00:12:12Z", + updated_at: "2019-02-27T00:12:12Z", + team_member_id: "D71KRMQof6cXGUW0aAv7", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/labor/shifts/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.shifts.get({ + id: "id", + }); + expect(response).toEqual({ + shift: { + id: "T35HMQSN89SV4", + employee_id: "D71KRMQof6cXGUW0aAv7", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-02-23T18:00:00-05:00", + end_at: "2019-02-23T21:00:00-05:00", + wage: { + title: "Cashier", + hourly_rate: { + amount: BigInt("1457"), + currency: "USD", + }, + job_id: "N4YKVLzFj3oGtNocqoYHYpW3", + tip_eligible: true, + }, + breaks: [ + { + id: "M9BBKEPQAQD2T", + start_at: "2019-02-23T19:00:00-05:00", + end_at: "2019-02-23T20:00:00-05:00", + break_type_id: "92EPDRQKJ5088", + name: "Lunch Break", + expected_duration: "PT1H", + is_paid: true, + }, + ], + status: "CLOSED", + version: 1, + created_at: "2019-02-27T00:12:12Z", + updated_at: "2019-02-27T00:12:12Z", + team_member_id: "D71KRMQof6cXGUW0aAv7", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + shift: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { amount: BigInt(1500), currency: "USD" }, + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + version: 1, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + }; + const rawResponseBody = { + shift: { + id: "K0YH4CV5462JB", + employee_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { amount: BigInt(1500), currency: "USD" }, + job_id: "dZtrPh5GSDGugyXGByesVp51", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 2, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:42:41Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { amount: BigInt(500), currency: "USD" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/labor/shifts/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.shifts.update({ + id: "id", + shift: { + location_id: "PAA1RJZZKXBFG", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { + amount: BigInt("1500"), + currency: "USD", + }, + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + version: 1, + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + }); + expect(response).toEqual({ + shift: { + id: "K0YH4CV5462JB", + employee_id: "ormj0jJJZ5OZIzxrZYJI", + location_id: "PAA1RJZZKXBFG", + timezone: "America/New_York", + start_at: "2019-01-25T03:11:00-05:00", + end_at: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourly_rate: { + amount: BigInt("1500"), + currency: "USD", + }, + job_id: "dZtrPh5GSDGugyXGByesVp51", + tip_eligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + start_at: "2019-01-25T06:11:00-05:00", + end_at: "2019-01-25T06:16:00-05:00", + break_type_id: "REGS1EQR1TPZ5", + name: "Tea Break", + expected_duration: "PT5M", + is_paid: true, + }, + ], + status: "CLOSED", + version: 2, + created_at: "2019-02-28T00:39:02Z", + updated_at: "2019-02-28T00:42:41Z", + team_member_id: "ormj0jJJZ5OZIzxrZYJI", + declared_cash_tip_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/labor/shifts/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.shifts.delete({ + id: "id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/labor/teamMemberWages.test.ts b/tests/wire/labor/teamMemberWages.test.ts new file mode 100644 index 000000000..b9bb1d07e --- /dev/null +++ b/tests/wire/labor/teamMemberWages.test.ts @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("TeamMemberWages", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + team_member_wage: { + id: "pXS3qCv7BERPnEGedM4S8mhm", + team_member_id: "33fJchumvVdJwxV0H6L9", + title: "Manager", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + job_id: "jxJNN6eCJsLrhg5UFJrDWDGE", + tip_eligible: false, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/labor/team-member-wages/id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.teamMemberWages.get({ + id: "id", + }); + expect(response).toEqual({ + team_member_wage: { + id: "pXS3qCv7BERPnEGedM4S8mhm", + team_member_id: "33fJchumvVdJwxV0H6L9", + title: "Manager", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + job_id: "jxJNN6eCJsLrhg5UFJrDWDGE", + tip_eligible: false, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/labor/workweekConfigs.test.ts b/tests/wire/labor/workweekConfigs.test.ts new file mode 100644 index 000000000..63757c405 --- /dev/null +++ b/tests/wire/labor/workweekConfigs.test.ts @@ -0,0 +1,62 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("WorkweekConfigs", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + workweek_config: { start_of_week: "MON", start_of_day_local_time: "10:00", version: 10 }, + }; + const rawResponseBody = { + workweek_config: { + id: "FY4VCAQN700GM", + start_of_week: "MON", + start_of_day_local_time: "10:00", + version: 11, + created_at: "2016-02-04T00:58:24Z", + updated_at: "2019-02-28T01:04:35Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/labor/workweek-configs/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.labor.workweekConfigs.get({ + id: "id", + workweek_config: { + start_of_week: "MON", + start_of_day_local_time: "10:00", + version: 10, + }, + }); + expect(response).toEqual({ + workweek_config: { + id: "FY4VCAQN700GM", + start_of_week: "MON", + start_of_day_local_time: "10:00", + version: 11, + created_at: "2016-02-04T00:58:24Z", + updated_at: "2019-02-28T01:04:35Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/locations.test.ts b/tests/wire/locations.test.ts new file mode 100644 index 000000000..438d60010 --- /dev/null +++ b/tests/wire/locations.test.ts @@ -0,0 +1,1109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Locations", () => { + test("list", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + locations: [ + { + id: "18YC4JDH91E1H", + name: "Grant Park", + address: { + address_line_1: "123 Main St", + locality: "San Francisco", + administrative_district_level_1: "CA", + postal_code: "94114", + country: "US", + }, + timezone: "America/Los_Angeles", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2016-09-19T17:33:12Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "+1 650-354-7217", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_email: "business_email", + description: "description", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "mcc", + full_format_logo_url: "full_format_logo_url", + }, + { + id: "3Z4V4WHQK64X9", + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + locality: "Atlanta", + administrative_district_level_1: "GA", + postal_code: "30309", + }, + timezone: "America/New_York", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2022-02-19T17:58:25Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "phone_number", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_email: "business_email", + description: "Midtown Atlanta store", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { latitude: 33.7889, longitude: -84.3841 }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "7299", + full_format_logo_url: "full_format_logo_url", + }, + ], + }; + server.mockEndpoint().get("/v2/locations").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.locations.list(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + locations: [ + { + id: "18YC4JDH91E1H", + name: "Grant Park", + address: { + address_line_1: "123 Main St", + locality: "San Francisco", + administrative_district_level_1: "CA", + postal_code: "94114", + country: "US", + }, + timezone: "America/Los_Angeles", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2016-09-19T17:33:12Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "+1 650-354-7217", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_email: "business_email", + description: "description", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "mcc", + full_format_logo_url: "full_format_logo_url", + }, + { + id: "3Z4V4WHQK64X9", + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + locality: "Atlanta", + administrative_district_level_1: "GA", + postal_code: "30309", + }, + timezone: "America/New_York", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2022-02-19T17:58:25Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "phone_number", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_email: "business_email", + description: "Midtown Atlanta store", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { + latitude: 33.7889, + longitude: -84.3841, + }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "7299", + full_format_logo_url: "full_format_logo_url", + }, + ], + }); + }); + + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + location: { + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + locality: "Atlanta", + administrative_district_level_1: "GA", + postal_code: "30309", + }, + description: "Midtown Atlanta store", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + location: { + id: "3Z4V4WHQK64X9", + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "Atlanta", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "GA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "30309", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + timezone: "America/New_York", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2022-02-19T17:58:25Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "phone_number", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_hours: { periods: [{}] }, + business_email: "business_email", + description: "Midtown Atlanta store", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { latitude: 33.7889, longitude: -84.3841 }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "7299", + full_format_logo_url: "full_format_logo_url", + tax_ids: { + eu_vat: "eu_vat", + fr_siret: "fr_siret", + fr_naf: "fr_naf", + es_nif: "es_nif", + jp_qii: "jp_qii", + }, + }, + }; + server + .mockEndpoint() + .post("/v2/locations") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.create({ + location: { + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + locality: "Atlanta", + administrative_district_level_1: "GA", + postal_code: "30309", + }, + description: "Midtown Atlanta store", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + location: { + id: "3Z4V4WHQK64X9", + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "Atlanta", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "GA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "30309", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + timezone: "America/New_York", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2022-02-19T17:58:25Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "phone_number", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_hours: { + periods: [{}], + }, + business_email: "business_email", + description: "Midtown Atlanta store", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { + latitude: 33.7889, + longitude: -84.3841, + }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "7299", + full_format_logo_url: "full_format_logo_url", + tax_ids: { + eu_vat: "eu_vat", + fr_siret: "fr_siret", + fr_naf: "fr_naf", + es_nif: "es_nif", + jp_qii: "jp_qii", + }, + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + location: { + id: "18YC4JDH91E1H", + name: "Grant Park", + address: { + address_line_1: "123 Main St", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "San Francisco", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "CA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "94114", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + timezone: "America/Los_Angeles", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2016-09-19T17:33:12Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "+1 650-354-7217", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_hours: { periods: [{}] }, + business_email: "business_email", + description: "description", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { latitude: 1.1, longitude: 1.1 }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "mcc", + full_format_logo_url: "full_format_logo_url", + tax_ids: { + eu_vat: "eu_vat", + fr_siret: "fr_siret", + fr_naf: "fr_naf", + es_nif: "es_nif", + jp_qii: "jp_qii", + }, + }, + }; + server + .mockEndpoint() + .get("/v2/locations/location_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.get({ + location_id: "location_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + location: { + id: "18YC4JDH91E1H", + name: "Grant Park", + address: { + address_line_1: "123 Main St", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "San Francisco", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "CA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "94114", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + timezone: "America/Los_Angeles", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2016-09-19T17:33:12Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "+1 650-354-7217", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_hours: { + periods: [{}], + }, + business_email: "business_email", + description: "description", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { + latitude: 1.1, + longitude: 1.1, + }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "mcc", + full_format_logo_url: "full_format_logo_url", + tax_ids: { + eu_vat: "eu_vat", + fr_siret: "fr_siret", + fr_naf: "fr_naf", + es_nif: "es_nif", + jp_qii: "jp_qii", + }, + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + location: { + business_hours: { + periods: [ + { day_of_week: "FRI", start_local_time: "07:00", end_local_time: "18:00" }, + { day_of_week: "SAT", start_local_time: "07:00", end_local_time: "18:00" }, + { day_of_week: "SUN", start_local_time: "09:00", end_local_time: "15:00" }, + ], + }, + description: "Midtown Atlanta store - Open weekends", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + location: { + id: "3Z4V4WHQK64X9", + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "Atlanta", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "GA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "30309", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + timezone: "America/New_York", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2022-02-19T17:58:25Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "phone_number", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_hours: { + periods: [ + { day_of_week: "FRI", start_local_time: "07:00", end_local_time: "18:00" }, + { day_of_week: "SAT", start_local_time: "07:00", end_local_time: "18:00" }, + { day_of_week: "SUN", start_local_time: "09:00", end_local_time: "15:00" }, + ], + }, + business_email: "business_email", + description: "Midtown Atlanta store - Open weekends", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { latitude: 33.7889, longitude: -84.3841 }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "7299", + full_format_logo_url: "full_format_logo_url", + tax_ids: { + eu_vat: "eu_vat", + fr_siret: "fr_siret", + fr_naf: "fr_naf", + es_nif: "es_nif", + jp_qii: "jp_qii", + }, + }, + }; + server + .mockEndpoint() + .put("/v2/locations/location_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.update({ + location_id: "location_id", + location: { + business_hours: { + periods: [ + { + day_of_week: "FRI", + start_local_time: "07:00", + end_local_time: "18:00", + }, + { + day_of_week: "SAT", + start_local_time: "07:00", + end_local_time: "18:00", + }, + { + day_of_week: "SUN", + start_local_time: "09:00", + end_local_time: "15:00", + }, + ], + }, + description: "Midtown Atlanta store - Open weekends", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + location: { + id: "3Z4V4WHQK64X9", + name: "Midtown", + address: { + address_line_1: "1234 Peachtree St. NE", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "Atlanta", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "GA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "30309", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + timezone: "America/New_York", + capabilities: ["CREDIT_CARD_PROCESSING"], + status: "ACTIVE", + created_at: "2022-02-19T17:58:25Z", + merchant_id: "3MYCJG5GVYQ8Q", + country: "US", + language_code: "en-US", + currency: "USD", + phone_number: "phone_number", + business_name: "Jet Fuel Coffee", + type: "PHYSICAL", + website_url: "website_url", + business_hours: { + periods: [ + { + day_of_week: "FRI", + start_local_time: "07:00", + end_local_time: "18:00", + }, + { + day_of_week: "SAT", + start_local_time: "07:00", + end_local_time: "18:00", + }, + { + day_of_week: "SUN", + start_local_time: "09:00", + end_local_time: "15:00", + }, + ], + }, + business_email: "business_email", + description: "Midtown Atlanta store - Open weekends", + twitter_username: "twitter_username", + instagram_username: "instagram_username", + facebook_url: "facebook_url", + coordinates: { + latitude: 33.7889, + longitude: -84.3841, + }, + logo_url: "logo_url", + pos_background_url: "pos_background_url", + mcc: "7299", + full_format_logo_url: "full_format_logo_url", + tax_ids: { + eu_vat: "eu_vat", + fr_siret: "fr_siret", + fr_naf: "fr_naf", + es_nif: "es_nif", + jp_qii: "jp_qii", + }, + }, + }); + }); + + test("checkouts", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + order: { + order: { + location_id: "location_id", + reference_id: "reference_id", + customer_id: "customer_id", + line_items: [ + { + name: "Printed T Shirt", + quantity: "2", + applied_taxes: [{ tax_uid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3" }], + applied_discounts: [{ discount_uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4" }], + base_price_money: { amount: BigInt(1500), currency: "USD" }, + }, + { + name: "Slim Jeans", + quantity: "1", + base_price_money: { amount: BigInt(2500), currency: "USD" }, + }, + { + name: "Woven Sweater", + quantity: "3", + base_price_money: { 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", + amount_money: { amount: BigInt(100), currency: "USD" }, + scope: "LINE_ITEM", + }, + ], + }, + idempotency_key: "12ae1696-z1e3-4328-af6d-f1e04d947gd4", + }, + ask_for_shipping_address: true, + merchant_support_email: "merchant+support@website.com", + pre_populate_buyer_email: "example@email.com", + pre_populate_shipping_address: { + address_line_1: "1455 Market St.", + address_line_2: "Suite 600", + locality: "San Francisco", + administrative_district_level_1: "CA", + postal_code: "94103", + country: "US", + first_name: "Jane", + last_name: "Doe", + }, + redirect_url: "https://merchant.website.com/order-confirm", + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { amount: BigInt(60), currency: "USD" }, + }, + ], + }; + const rawResponseBody = { + checkout: { + id: "CAISEHGimXh-C3RIT4og1a6u1qw", + checkout_page_url: + "https://connect.squareup.com/v2/checkout?c=CAISEHGimXh-C3RIT4og1a6u1qw&l=CYTKRM7R7JMV8", + ask_for_shipping_address: true, + merchant_support_email: "merchant+support@website.com", + pre_populate_buyer_email: "example@email.com", + pre_populate_shipping_address: { + address_line_1: "1455 Market St.", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "San Francisco", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "CA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "94103", + country: "US", + first_name: "Jane", + last_name: "Doe", + }, + redirect_url: "https://merchant.website.com/order-confirm", + order: { + id: "id", + location_id: "location_id", + reference_id: "reference_id", + customer_id: "customer_id", + line_items: [ + { + name: "Printed T Shirt", + quantity: "2", + applied_taxes: [ + { + tax_uid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3", + applied_money: { amount: BigInt(103), currency: "USD" }, + }, + ], + applied_discounts: [ + { + discount_uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", + applied_money: { amount: BigInt(100), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(1500), currency: "USD" }, + total_tax_money: { amount: BigInt(103), currency: "USD" }, + total_discount_money: { amount: BigInt(100), currency: "USD" }, + total_money: { amount: BigInt(1503), currency: "USD" }, + }, + { + name: "Slim Jeans", + quantity: "1", + base_price_money: { amount: BigInt(2500), currency: "USD" }, + total_money: { amount: BigInt(2500), currency: "USD" }, + }, + { + name: "Woven Sweater", + quantity: "3", + base_price_money: { amount: BigInt(3500), currency: "USD" }, + total_money: { amount: BigInt(10500), 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", + amount_money: { amount: BigInt(100), currency: "USD" }, + applied_money: { amount: BigInt(100), currency: "USD" }, + scope: "LINE_ITEM", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + created_at: "created_at", + updated_at: "updated_at", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { amount: BigInt(14503), currency: "USD" }, + total_tax_money: { amount: BigInt(103), currency: "USD" }, + total_discount_money: { amount: BigInt(100), currency: "USD" }, + ticket_name: "ticket_name", + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + }, + created_at: "2017-06-16T22:25:35Z", + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { amount: BigInt(60), currency: "USD" }, + }, + ], + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/locations/location_id/checkouts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.checkouts({ + location_id: "location_id", + idempotency_key: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + order: { + order: { + location_id: "location_id", + reference_id: "reference_id", + customer_id: "customer_id", + line_items: [ + { + name: "Printed T Shirt", + quantity: "2", + applied_taxes: [ + { + tax_uid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3", + }, + ], + applied_discounts: [ + { + discount_uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", + }, + ], + base_price_money: { + amount: BigInt("1500"), + currency: "USD", + }, + }, + { + name: "Slim Jeans", + quantity: "1", + base_price_money: { + amount: BigInt("2500"), + currency: "USD", + }, + }, + { + name: "Woven Sweater", + quantity: "3", + base_price_money: { + 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", + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + scope: "LINE_ITEM", + }, + ], + }, + idempotency_key: "12ae1696-z1e3-4328-af6d-f1e04d947gd4", + }, + ask_for_shipping_address: true, + merchant_support_email: "merchant+support@website.com", + pre_populate_buyer_email: "example@email.com", + pre_populate_shipping_address: { + address_line_1: "1455 Market St.", + address_line_2: "Suite 600", + locality: "San Francisco", + administrative_district_level_1: "CA", + postal_code: "94103", + country: "US", + first_name: "Jane", + last_name: "Doe", + }, + redirect_url: "https://merchant.website.com/order-confirm", + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { + amount: BigInt("60"), + currency: "USD", + }, + }, + ], + }); + expect(response).toEqual({ + checkout: { + id: "CAISEHGimXh-C3RIT4og1a6u1qw", + checkout_page_url: + "https://connect.squareup.com/v2/checkout?c=CAISEHGimXh-C3RIT4og1a6u1qw&l=CYTKRM7R7JMV8", + ask_for_shipping_address: true, + merchant_support_email: "merchant+support@website.com", + pre_populate_buyer_email: "example@email.com", + pre_populate_shipping_address: { + address_line_1: "1455 Market St.", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "San Francisco", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "CA", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "94103", + country: "US", + first_name: "Jane", + last_name: "Doe", + }, + redirect_url: "https://merchant.website.com/order-confirm", + order: { + id: "id", + location_id: "location_id", + reference_id: "reference_id", + customer_id: "customer_id", + line_items: [ + { + name: "Printed T Shirt", + quantity: "2", + applied_taxes: [ + { + tax_uid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3", + applied_money: { + amount: BigInt("103"), + currency: "USD", + }, + }, + ], + applied_discounts: [ + { + discount_uid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", + applied_money: { + amount: BigInt("100"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("1500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("103"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("100"), + currency: "USD", + }, + total_money: { + amount: BigInt("1503"), + currency: "USD", + }, + }, + { + name: "Slim Jeans", + quantity: "1", + base_price_money: { + amount: BigInt("2500"), + currency: "USD", + }, + total_money: { + amount: BigInt("2500"), + currency: "USD", + }, + }, + { + name: "Woven Sweater", + quantity: "3", + base_price_money: { + amount: BigInt("3500"), + currency: "USD", + }, + total_money: { + amount: BigInt("10500"), + 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", + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + applied_money: { + amount: BigInt("100"), + currency: "USD", + }, + scope: "LINE_ITEM", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + created_at: "created_at", + updated_at: "updated_at", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { + amount: BigInt("14503"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("103"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("100"), + currency: "USD", + }, + ticket_name: "ticket_name", + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + }, + created_at: "2017-06-16T22:25:35Z", + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { + amount: BigInt("60"), + currency: "USD", + }, + }, + ], + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/locations/customAttributeDefinitions.test.ts b/tests/wire/locations/customAttributeDefinitions.test.ts new file mode 100644 index 000000000..a558741df --- /dev/null +++ b/tests/wire/locations/customAttributeDefinitions.test.ts @@ -0,0 +1,229 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributeDefinitions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { + 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", + }, + }; + const rawResponseBody = { + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-12-02T19:06:36.559Z", + created_at: "2022-12-02T19:06:36.559Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/locations/custom-attribute-definitions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributeDefinitions.create({ + custom_attribute_definition: { + 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", + }, + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-12-02T19:06:36.559Z", + created_at: "2022-12-02T19:06:36.559Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-12-02T19:06:36.559Z", + created_at: "2022-12-02T19:06:36.559Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/locations/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributeDefinitions.get({ + key: "key", + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-12-02T19:06:36.559Z", + created_at: "2022-12-02T19:06:36.559Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, + }; + const rawResponseBody = { + custom_attribute_definition: { + key: "bestseller", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Bestseller", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2022-12-02T19:34:10.181Z", + created_at: "2022-12-02T19:06:36.559Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/locations/custom-attribute-definitions/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributeDefinitions.update({ + key: "key", + custom_attribute_definition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, + }); + expect(response).toEqual({ + custom_attribute_definition: { + key: "bestseller", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Bestseller", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2022-12-02T19:34:10.181Z", + created_at: "2022-12-02T19:06:36.559Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/locations/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributeDefinitions.delete({ + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/locations/customAttributes.test.ts b/tests/wire/locations/customAttributes.test.ts new file mode 100644 index 000000000..b4bbd2a35 --- /dev/null +++ b/tests/wire/locations/customAttributes.test.ts @@ -0,0 +1,417 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributes", () => { + test("batchDelete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + values: { id1: { key: "bestseller" }, id2: { key: "bestseller" }, id3: { key: "phone-number" } }, + }; + const rawResponseBody = { + values: { + id1: { + location_id: "L0TBCBTB7P8RQ", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id2: { + location_id: "L9XMD04V3STJX", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id3: { + location_id: "L0TBCBTB7P8RQ", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/locations/custom-attributes/bulk-delete") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributes.batchDelete({ + values: { + id1: { + key: "bestseller", + }, + id2: { + key: "bestseller", + }, + id3: { + key: "phone-number", + }, + }, + }); + expect(response).toEqual({ + values: { + id1: { + location_id: "L0TBCBTB7P8RQ", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id2: { + location_id: "L9XMD04V3STJX", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id3: { + location_id: "L0TBCBTB7P8RQ", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("batchUpsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + values: { + id1: { location_id: "L0TBCBTB7P8RQ", custom_attribute: { key: "bestseller", value: "hot cocoa" } }, + id2: { location_id: "L9XMD04V3STJX", custom_attribute: { key: "bestseller", value: "berry smoothie" } }, + id3: { location_id: "L0TBCBTB7P8RQ", custom_attribute: { key: "phone-number", value: "+12223334444" } }, + }, + }; + const rawResponseBody = { + values: { + id1: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { + key: "bestseller", + value: "hot cocoa", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id2: { + location_id: "L9XMD04V3STJX", + custom_attribute: { + key: "bestseller", + value: "berry smoothie", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id3: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { + key: "phone-number", + value: "+12239903892", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-01-09T19:21:04.563Z", + created_at: "2023-01-09T19:04:57.985Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/locations/custom-attributes/bulk-upsert") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributes.batchUpsert({ + values: { + id1: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { + key: "bestseller", + value: "hot cocoa", + }, + }, + id2: { + location_id: "L9XMD04V3STJX", + custom_attribute: { + key: "bestseller", + value: "berry smoothie", + }, + }, + id3: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { + key: "phone-number", + value: "+12223334444", + }, + }, + }, + }); + expect(response).toEqual({ + values: { + id1: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { + key: "bestseller", + value: "hot cocoa", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id2: { + location_id: "L9XMD04V3STJX", + custom_attribute: { + key: "bestseller", + value: "berry smoothie", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id3: { + location_id: "L0TBCBTB7P8RQ", + custom_attribute: { + key: "phone-number", + value: "+12239903892", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-01-09T19:21:04.563Z", + created_at: "2023-01-09T19:04:57.985Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute: { + key: "bestseller", + value: "hot cocoa", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/locations/location_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributes.get({ + location_id: "location_id", + key: "key", + }); + expect(response).toEqual({ + custom_attribute: { + key: "bestseller", + value: "hot cocoa", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("upsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { custom_attribute: { value: "hot cocoa" } }; + const rawResponseBody = { + custom_attribute: { + key: "bestseller", + value: "hot cocoa", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/locations/location_id/custom-attributes/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributes.upsert({ + location_id: "location_id", + key: "key", + custom_attribute: { + value: "hot cocoa", + }, + }); + expect(response).toEqual({ + custom_attribute: { + key: "bestseller", + value: "hot cocoa", + version: 2, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-01-09T19:21:04.551Z", + created_at: "2023-01-09T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/locations/location_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.customAttributes.delete({ + location_id: "location_id", + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/locations/transactions.test.ts b/tests/wire/locations/transactions.test.ts new file mode 100644 index 000000000..36e88338e --- /dev/null +++ b/tests/wire/locations/transactions.test.ts @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Transactions", () => { + test("list", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + transactions: [ + { + id: "KnL67ZIwXCPtzOrqj0HrkxMF", + location_id: "18YC4JDH91E1H", + created_at: "2016-01-20T22:57:56Z", + tenders: [ + { + id: "MtZRYYdDrYNQbOvV7nbuBvMF", + location_id: "18YC4JDH91E1H", + transaction_id: "KnL67ZIwXCPtzOrqj0HrkxMF", + created_at: "2016-01-20T22:57:56Z", + note: "some optional note", + amount_money: { amount: BigInt(5000), currency: "USD" }, + processing_fee_money: { amount: BigInt(138), currency: "USD" }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { card_brand: "VISA", last_4: "1111" }, + entry_method: "KEYED", + }, + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { amount: BigInt(20), currency: "USD" }, + }, + ], + }, + ], + refunds: [ + { + id: "7a5RcVI0CxbOcJ2wMOkE", + location_id: "18YC4JDH91E1H", + transaction_id: "KnL67ZIwXCPtzOrqj0HrkxMF", + tender_id: "MtZRYYdDrYNQbOvV7nbuBvMF", + created_at: "2016-01-20T22:59:20Z", + reason: "some reason why", + amount_money: { amount: BigInt(5000), currency: "USD" }, + status: "APPROVED", + processing_fee_money: { amount: BigInt(138), currency: "USD" }, + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { amount: BigInt(100), currency: "USD" }, + }, + ], + }, + ], + reference_id: "some optional reference id", + product: "EXTERNAL_API", + client_id: "client_id", + order_id: "order_id", + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .get("/v2/locations/location_id/transactions") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.transactions.list({ + location_id: "location_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + transactions: [ + { + id: "KnL67ZIwXCPtzOrqj0HrkxMF", + location_id: "18YC4JDH91E1H", + created_at: "2016-01-20T22:57:56Z", + tenders: [ + { + id: "MtZRYYdDrYNQbOvV7nbuBvMF", + location_id: "18YC4JDH91E1H", + transaction_id: "KnL67ZIwXCPtzOrqj0HrkxMF", + created_at: "2016-01-20T22:57:56Z", + note: "some optional note", + amount_money: { + amount: BigInt("5000"), + currency: "USD", + }, + processing_fee_money: { + amount: BigInt("138"), + currency: "USD", + }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + }, + entry_method: "KEYED", + }, + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { + amount: BigInt("20"), + currency: "USD", + }, + }, + ], + }, + ], + refunds: [ + { + id: "7a5RcVI0CxbOcJ2wMOkE", + location_id: "18YC4JDH91E1H", + transaction_id: "KnL67ZIwXCPtzOrqj0HrkxMF", + tender_id: "MtZRYYdDrYNQbOvV7nbuBvMF", + created_at: "2016-01-20T22:59:20Z", + reason: "some reason why", + amount_money: { + amount: BigInt("5000"), + currency: "USD", + }, + status: "APPROVED", + processing_fee_money: { + amount: BigInt("138"), + currency: "USD", + }, + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + }, + ], + }, + ], + reference_id: "some optional reference id", + product: "EXTERNAL_API", + client_id: "client_id", + order_id: "order_id", + }, + ], + cursor: "cursor", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + transaction: { + id: "KnL67ZIwXCPtzOrqj0HrkxMF", + location_id: "18YC4JDH91E1H", + created_at: "2016-03-10T22:57:56Z", + tenders: [ + { + id: "MtZRYYdDrYNQbOvV7nbuBvMF", + location_id: "18YC4JDH91E1H", + transaction_id: "KnL67ZIwXCPtzOrqj0HrkxMF", + created_at: "2016-03-10T22:57:56Z", + note: "some optional note", + amount_money: { amount: BigInt(5000), currency: "USD" }, + processing_fee_money: { amount: BigInt(138), currency: "USD" }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { card_brand: "VISA", last_4: "1111" }, + entry_method: "KEYED", + }, + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { amount: BigInt(20), currency: "USD" }, + }, + ], + }, + ], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + reference_id: "some optional reference id", + product: "EXTERNAL_API", + client_id: "client_id", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + order_id: "order_id", + }, + }; + server + .mockEndpoint() + .get("/v2/locations/location_id/transactions/transaction_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.transactions.get({ + location_id: "location_id", + transaction_id: "transaction_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + transaction: { + id: "KnL67ZIwXCPtzOrqj0HrkxMF", + location_id: "18YC4JDH91E1H", + created_at: "2016-03-10T22:57:56Z", + tenders: [ + { + id: "MtZRYYdDrYNQbOvV7nbuBvMF", + location_id: "18YC4JDH91E1H", + transaction_id: "KnL67ZIwXCPtzOrqj0HrkxMF", + created_at: "2016-03-10T22:57:56Z", + note: "some optional note", + amount_money: { + amount: BigInt("5000"), + currency: "USD", + }, + processing_fee_money: { + amount: BigInt("138"), + currency: "USD", + }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + }, + entry_method: "KEYED", + }, + additional_recipients: [ + { + location_id: "057P5VYJ4A5X1", + description: "Application fees", + amount_money: { + amount: BigInt("20"), + currency: "USD", + }, + }, + ], + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + reference_id: "some optional reference id", + product: "EXTERNAL_API", + client_id: "client_id", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + order_id: "order_id", + }, + }); + }); + + test("capture", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/locations/location_id/transactions/transaction_id/capture") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.transactions.capture({ + location_id: "location_id", + transaction_id: "transaction_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("void", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/locations/location_id/transactions/transaction_id/void") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.locations.transactions.void({ + location_id: "location_id", + transaction_id: "transaction_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/loyalty.test.ts b/tests/wire/loyalty.test.ts new file mode 100644 index 000000000..191aae6c3 --- /dev/null +++ b/tests/wire/loyalty.test.ts @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Loyalty", () => { + test("searchEvents", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + query: { filter: { order_filter: { order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY" } } }, + limit: 30, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + events: [ + { + id: "c27c8465-806e-36f2-b4b3-71f5887b5ba8", + type: "ACCUMULATE_POINTS", + created_at: "2020-05-08T22:01:30Z", + accumulate_points: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + points: 5, + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + }, + adjust_points: { points: 1 }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { points: 1 }, + other_event: { points: 1 }, + }, + { + id: "e4a5cbc3-a4d0-3779-98e9-e578885d9430", + type: "REDEEM_REWARD", + created_at: "2020-05-08T22:01:15Z", + redeem_reward: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + reward_id: "d03f79f4-815f-3500-b851-cc1e68a457f9", + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + }, + adjust_points: { points: 1 }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { points: 1 }, + other_event: { points: 1 }, + }, + { + id: "5e127479-0b03-3671-ab1e-15faea8b7188", + type: "CREATE_REWARD", + created_at: "2020-05-08T22:00:44Z", + create_reward: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + reward_id: "d03f79f4-815f-3500-b851-cc1e68a457f9", + points: -10, + }, + adjust_points: { points: 1 }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "location_id", + source: "LOYALTY_API", + expire_points: { points: 1 }, + other_event: { points: 1 }, + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/loyalty/events/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.searchEvents({ + query: { + filter: { + order_filter: { + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + }, + }, + }, + limit: 30, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + events: [ + { + id: "c27c8465-806e-36f2-b4b3-71f5887b5ba8", + type: "ACCUMULATE_POINTS", + created_at: "2020-05-08T22:01:30Z", + accumulate_points: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + points: 5, + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + }, + adjust_points: { + points: 1, + }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { + points: 1, + }, + other_event: { + points: 1, + }, + }, + { + id: "e4a5cbc3-a4d0-3779-98e9-e578885d9430", + type: "REDEEM_REWARD", + created_at: "2020-05-08T22:01:15Z", + redeem_reward: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + reward_id: "d03f79f4-815f-3500-b851-cc1e68a457f9", + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + }, + adjust_points: { + points: 1, + }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { + points: 1, + }, + other_event: { + points: 1, + }, + }, + { + id: "5e127479-0b03-3671-ab1e-15faea8b7188", + type: "CREATE_REWARD", + created_at: "2020-05-08T22:00:44Z", + create_reward: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + reward_id: "d03f79f4-815f-3500-b851-cc1e68a457f9", + points: -10, + }, + adjust_points: { + points: 1, + }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "location_id", + source: "LOYALTY_API", + expire_points: { + points: 1, + }, + other_event: { + points: 1, + }, + }, + ], + cursor: "cursor", + }); + }); +}); diff --git a/tests/wire/loyalty/accounts.test.ts b/tests/wire/loyalty/accounts.test.ts new file mode 100644 index 000000000..dffdafc35 --- /dev/null +++ b/tests/wire/loyalty/accounts.test.ts @@ -0,0 +1,505 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Accounts", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + loyalty_account: { + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + mapping: { phone_number: "+14155551234" }, + }, + idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + loyalty_account: { + id: "79b807d2-d786-46a9-933b-918028d7a8c5", + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + balance: 0, + lifetime_points: 0, + customer_id: "QPTXM8PQNX3Q726ZYHPMNP46XC", + enrolled_at: "enrolled_at", + created_at: "2020-05-08T21:44:32Z", + updated_at: "2020-05-08T21:44:32Z", + mapping: { + id: "66aaab3f-da99-49ed-8b19-b87f851c844f", + created_at: "2020-05-08T21:44:32Z", + phone_number: "+14155551234", + }, + expiring_point_deadlines: [{ points: 1, expires_at: "expires_at" }], + }, + }; + server + .mockEndpoint() + .post("/v2/loyalty/accounts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.accounts.create({ + loyalty_account: { + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + mapping: { + phone_number: "+14155551234", + }, + }, + idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + loyalty_account: { + id: "79b807d2-d786-46a9-933b-918028d7a8c5", + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + balance: 0, + lifetime_points: 0, + customer_id: "QPTXM8PQNX3Q726ZYHPMNP46XC", + enrolled_at: "enrolled_at", + created_at: "2020-05-08T21:44:32Z", + updated_at: "2020-05-08T21:44:32Z", + mapping: { + id: "66aaab3f-da99-49ed-8b19-b87f851c844f", + created_at: "2020-05-08T21:44:32Z", + phone_number: "+14155551234", + }, + expiring_point_deadlines: [ + { + points: 1, + expires_at: "expires_at", + }, + ], + }, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { query: { mappings: [{ phone_number: "+14155551234" }] }, limit: 10 }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + loyalty_accounts: [ + { + id: "79b807d2-d786-46a9-933b-918028d7a8c5", + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + balance: 10, + lifetime_points: 20, + customer_id: "Q8002FAM9V1EZ0ADB2T5609X6NET1H0", + enrolled_at: "enrolled_at", + created_at: "2020-05-08T21:44:32Z", + updated_at: "2020-05-08T21:44:32Z", + mapping: { + id: "66aaab3f-da99-49ed-8b19-b87f851c844f", + created_at: "2020-05-08T21:44:32Z", + phone_number: "+14155551234", + }, + expiring_point_deadlines: [{ points: 1, expires_at: "expires_at" }], + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/loyalty/accounts/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.accounts.search({ + query: { + mappings: [ + { + phone_number: "+14155551234", + }, + ], + }, + limit: 10, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + loyalty_accounts: [ + { + id: "79b807d2-d786-46a9-933b-918028d7a8c5", + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + balance: 10, + lifetime_points: 20, + customer_id: "Q8002FAM9V1EZ0ADB2T5609X6NET1H0", + enrolled_at: "enrolled_at", + created_at: "2020-05-08T21:44:32Z", + updated_at: "2020-05-08T21:44:32Z", + mapping: { + id: "66aaab3f-da99-49ed-8b19-b87f851c844f", + created_at: "2020-05-08T21:44:32Z", + phone_number: "+14155551234", + }, + expiring_point_deadlines: [ + { + points: 1, + expires_at: "expires_at", + }, + ], + }, + ], + cursor: "cursor", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + loyalty_account: { + id: "79b807d2-d786-46a9-933b-918028d7a8c5", + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + balance: 10, + lifetime_points: 20, + customer_id: "Q8002FAM9V1EZ0ADB2T5609X6NET1H0", + enrolled_at: "enrolled_at", + created_at: "2020-05-08T21:44:32Z", + updated_at: "2020-05-08T21:44:32Z", + mapping: { + id: "66aaab3f-da99-49ed-8b19-b87f851c844f", + created_at: "2020-05-08T21:44:32Z", + phone_number: "+14155551234", + }, + expiring_point_deadlines: [{ points: 1, expires_at: "expires_at" }], + }, + }; + server + .mockEndpoint() + .get("/v2/loyalty/accounts/account_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.accounts.get({ + account_id: "account_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + loyalty_account: { + id: "79b807d2-d786-46a9-933b-918028d7a8c5", + program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + balance: 10, + lifetime_points: 20, + customer_id: "Q8002FAM9V1EZ0ADB2T5609X6NET1H0", + enrolled_at: "enrolled_at", + created_at: "2020-05-08T21:44:32Z", + updated_at: "2020-05-08T21:44:32Z", + mapping: { + id: "66aaab3f-da99-49ed-8b19-b87f851c844f", + created_at: "2020-05-08T21:44:32Z", + phone_number: "+14155551234", + }, + expiring_point_deadlines: [ + { + points: 1, + expires_at: "expires_at", + }, + ], + }, + }); + }); + + test("accumulatePoints", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + accumulate_points: { order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" }, + idempotency_key: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + location_id: "P034NEENMD09F", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + event: { + id: "id", + type: "ACCUMULATE_POINTS", + created_at: "created_at", + accumulate_points: { loyalty_program_id: "loyalty_program_id", points: 1, order_id: "order_id" }, + create_reward: { loyalty_program_id: "loyalty_program_id", reward_id: "reward_id", points: 1 }, + redeem_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + order_id: "order_id", + }, + delete_reward: { loyalty_program_id: "loyalty_program_id", reward_id: "reward_id", points: 1 }, + adjust_points: { loyalty_program_id: "loyalty_program_id", points: 1, reason: "reason" }, + loyalty_account_id: "loyalty_account_id", + location_id: "location_id", + source: "SQUARE", + expire_points: { loyalty_program_id: "loyalty_program_id", points: 1 }, + other_event: { loyalty_program_id: "loyalty_program_id", points: 1 }, + accumulate_promotion_points: { + loyalty_program_id: "loyalty_program_id", + loyalty_promotion_id: "loyalty_promotion_id", + points: 1, + order_id: "order_id", + }, + }, + events: [ + { + id: "ee46aafd-1af6-3695-a385-276e2ef0be26", + type: "ACCUMULATE_POINTS", + created_at: "2020-05-08T21:41:12Z", + accumulate_points: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + points: 6, + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + }, + adjust_points: { points: 1 }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { points: 1 }, + other_event: { points: 1 }, + }, + ], + }; + server + .mockEndpoint() + .post("/v2/loyalty/accounts/account_id/accumulate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.accounts.accumulatePoints({ + account_id: "account_id", + accumulate_points: { + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + }, + idempotency_key: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + location_id: "P034NEENMD09F", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + event: { + id: "id", + type: "ACCUMULATE_POINTS", + created_at: "created_at", + accumulate_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + order_id: "order_id", + }, + create_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + points: 1, + }, + redeem_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + order_id: "order_id", + }, + delete_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + points: 1, + }, + adjust_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + reason: "reason", + }, + loyalty_account_id: "loyalty_account_id", + location_id: "location_id", + source: "SQUARE", + expire_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + }, + other_event: { + loyalty_program_id: "loyalty_program_id", + points: 1, + }, + accumulate_promotion_points: { + loyalty_program_id: "loyalty_program_id", + loyalty_promotion_id: "loyalty_promotion_id", + points: 1, + order_id: "order_id", + }, + }, + events: [ + { + id: "ee46aafd-1af6-3695-a385-276e2ef0be26", + type: "ACCUMULATE_POINTS", + created_at: "2020-05-08T21:41:12Z", + accumulate_points: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + points: 6, + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + }, + adjust_points: { + points: 1, + }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { + points: 1, + }, + other_event: { + points: 1, + }, + }, + ], + }); + }); + + test("adjust", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + adjust_points: { points: 10, reason: "Complimentary points" }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + event: { + id: "613a6fca-8d67-39d0-bad2-3b4bc45c8637", + type: "ADJUST_POINTS", + created_at: "2020-05-08T21:42:32Z", + accumulate_points: { loyalty_program_id: "loyalty_program_id", points: 1, order_id: "order_id" }, + create_reward: { loyalty_program_id: "loyalty_program_id", reward_id: "reward_id", points: 1 }, + redeem_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + order_id: "order_id", + }, + delete_reward: { loyalty_program_id: "loyalty_program_id", reward_id: "reward_id", points: 1 }, + adjust_points: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + points: 10, + reason: "Complimentary points", + }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "location_id", + source: "LOYALTY_API", + expire_points: { loyalty_program_id: "loyalty_program_id", points: 1 }, + other_event: { loyalty_program_id: "loyalty_program_id", points: 1 }, + accumulate_promotion_points: { + loyalty_program_id: "loyalty_program_id", + loyalty_promotion_id: "loyalty_promotion_id", + points: 1, + order_id: "order_id", + }, + }, + }; + server + .mockEndpoint() + .post("/v2/loyalty/accounts/account_id/adjust") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.accounts.adjust({ + account_id: "account_id", + idempotency_key: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + adjust_points: { + points: 10, + reason: "Complimentary points", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + event: { + id: "613a6fca-8d67-39d0-bad2-3b4bc45c8637", + type: "ADJUST_POINTS", + created_at: "2020-05-08T21:42:32Z", + accumulate_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + order_id: "order_id", + }, + create_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + points: 1, + }, + redeem_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + order_id: "order_id", + }, + delete_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + points: 1, + }, + adjust_points: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + points: 10, + reason: "Complimentary points", + }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "location_id", + source: "LOYALTY_API", + expire_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + }, + other_event: { + loyalty_program_id: "loyalty_program_id", + points: 1, + }, + accumulate_promotion_points: { + loyalty_program_id: "loyalty_program_id", + loyalty_promotion_id: "loyalty_promotion_id", + points: 1, + order_id: "order_id", + }, + }, + }); + }); +}); diff --git a/tests/wire/loyalty/programs.test.ts b/tests/wire/loyalty/programs.test.ts new file mode 100644 index 000000000..1657aaecf --- /dev/null +++ b/tests/wire/loyalty/programs.test.ts @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Programs", () => { + test("list", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + programs: [ + { + id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + status: "ACTIVE", + reward_tiers: [ + { + id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + name: "10% off entire sale", + created_at: "2020-04-20T16:55:11Z", + pricing_rule_reference: { + object_id: "74C4JSHESNLTB2A7ITO5HO6F", + catalog_version: BigInt(1000000), + }, + }, + ], + expiration_policy: { expiration_duration: "expiration_duration" }, + terminology: { one: "Point", other: "Points" }, + location_ids: ["P034NEENMD09F"], + created_at: "2020-04-20T16:55:11Z", + updated_at: "2020-05-01T02:00:02Z", + accrual_rules: [ + { + accrual_type: "SPEND", + points: 1, + spend_data: { + amount_money: { amount: BigInt(100), currency: "USD" }, + excluded_category_ids: ["7ZERJKO5PVYXCVUHV2JCZ2UG", "FQKAOJE5C4FIMF5A2URMLW6V"], + excluded_item_variation_ids: ["CBZXBUVVTYUBZGQO44RHMR6B", "EDILT24Z2NISEXDKGY6HP7XV"], + tax_mode: "BEFORE_TAX", + }, + }, + ], + }, + ], + }; + server + .mockEndpoint() + .get("/v2/loyalty/programs") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.programs.list(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + programs: [ + { + id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + status: "ACTIVE", + reward_tiers: [ + { + id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + name: "10% off entire sale", + created_at: "2020-04-20T16:55:11Z", + pricing_rule_reference: { + object_id: "74C4JSHESNLTB2A7ITO5HO6F", + catalog_version: BigInt("1000000"), + }, + }, + ], + expiration_policy: { + expiration_duration: "expiration_duration", + }, + terminology: { + one: "Point", + other: "Points", + }, + location_ids: ["P034NEENMD09F"], + created_at: "2020-04-20T16:55:11Z", + updated_at: "2020-05-01T02:00:02Z", + accrual_rules: [ + { + accrual_type: "SPEND", + points: 1, + spend_data: { + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + excluded_category_ids: ["7ZERJKO5PVYXCVUHV2JCZ2UG", "FQKAOJE5C4FIMF5A2URMLW6V"], + excluded_item_variation_ids: ["CBZXBUVVTYUBZGQO44RHMR6B", "EDILT24Z2NISEXDKGY6HP7XV"], + tax_mode: "BEFORE_TAX", + }, + }, + ], + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + program: { + id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + status: "ACTIVE", + reward_tiers: [ + { + id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + name: "10% off entire sale", + created_at: "2020-04-20T16:55:11Z", + pricing_rule_reference: { + object_id: "74C4JSHESNLTB2A7ITO5HO6F", + catalog_version: BigInt(1000000), + }, + }, + ], + expiration_policy: { expiration_duration: "expiration_duration" }, + terminology: { one: "Point", other: "Points" }, + location_ids: ["P034NEENMD09F"], + created_at: "2020-04-20T16:55:11Z", + updated_at: "2020-05-01T02:00:02Z", + accrual_rules: [ + { + accrual_type: "SPEND", + points: 1, + spend_data: { + amount_money: { amount: BigInt(100), currency: "USD" }, + excluded_category_ids: ["7ZERJKO5PVYXCVUHV2JCZ2UG", "FQKAOJE5C4FIMF5A2URMLW6V"], + excluded_item_variation_ids: ["CBZXBUVVTYUBZGQO44RHMR6B", "EDILT24Z2NISEXDKGY6HP7XV"], + tax_mode: "BEFORE_TAX", + }, + }, + ], + }, + }; + server + .mockEndpoint() + .get("/v2/loyalty/programs/program_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.programs.get({ + program_id: "program_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + program: { + id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + status: "ACTIVE", + reward_tiers: [ + { + id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + name: "10% off entire sale", + created_at: "2020-04-20T16:55:11Z", + pricing_rule_reference: { + object_id: "74C4JSHESNLTB2A7ITO5HO6F", + catalog_version: BigInt("1000000"), + }, + }, + ], + expiration_policy: { + expiration_duration: "expiration_duration", + }, + terminology: { + one: "Point", + other: "Points", + }, + location_ids: ["P034NEENMD09F"], + created_at: "2020-04-20T16:55:11Z", + updated_at: "2020-05-01T02:00:02Z", + accrual_rules: [ + { + accrual_type: "SPEND", + points: 1, + spend_data: { + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + excluded_category_ids: ["7ZERJKO5PVYXCVUHV2JCZ2UG", "FQKAOJE5C4FIMF5A2URMLW6V"], + excluded_item_variation_ids: ["CBZXBUVVTYUBZGQO44RHMR6B", "EDILT24Z2NISEXDKGY6HP7XV"], + tax_mode: "BEFORE_TAX", + }, + }, + ], + }, + }); + }); + + test("calculate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + loyalty_account_id: "79b807d2-d786-46a9-933b-918028d7a8c5", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + points: 6, + promotion_points: 12, + }; + server + .mockEndpoint() + .post("/v2/loyalty/programs/program_id/calculate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.programs.calculate({ + program_id: "program_id", + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + loyalty_account_id: "79b807d2-d786-46a9-933b-918028d7a8c5", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + points: 6, + promotion_points: 12, + }); + }); +}); diff --git a/tests/wire/loyalty/programs/promotions.test.ts b/tests/wire/loyalty/programs/promotions.test.ts new file mode 100644 index 000000000..04a5df784 --- /dev/null +++ b/tests/wire/loyalty/programs/promotions.test.ts @@ -0,0 +1,322 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../../mock-server/MockServerPool"; +import { SquareClient } from "../../../../src/Client"; + +describe("Promotions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + loyalty_promotion: { + name: "Tuesday Happy Hour Promo", + incentive: { type: "POINTS_MULTIPLIER", points_multiplier_data: { multiplier: "3.0" } }, + available_time: { + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { times: 1, interval: "DAY" }, + minimum_spend_amount_money: { amount: BigInt(2000), currency: "USD" }, + qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"], + }, + idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + loyalty_promotion: { + id: "loypromo_f0f9b849-725e-378d-b810-511237e07b67", + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + points_multiplier_data: { points_multiplier: 3, multiplier: "3.000" }, + points_addition_data: { points_addition: 1 }, + }, + available_time: { + start_date: "2022-08-16", + end_date: "end_date", + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { times: 1, interval: "DAY" }, + status: "ACTIVE", + created_at: "2022-08-16T08:38:54Z", + canceled_at: "canceled_at", + updated_at: "2022-08-16T08:38:54Z", + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + minimum_spend_amount_money: { amount: BigInt(2000), currency: "USD" }, + qualifying_item_variation_ids: ["qualifying_item_variation_ids"], + qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"], + }, + }; + server + .mockEndpoint() + .post("/v2/loyalty/programs/program_id/promotions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.programs.promotions.create({ + program_id: "program_id", + loyalty_promotion: { + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + points_multiplier_data: { + multiplier: "3.0", + }, + }, + available_time: { + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { + times: 1, + interval: "DAY", + }, + minimum_spend_amount_money: { + amount: BigInt("2000"), + currency: "USD", + }, + qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"], + }, + idempotency_key: "ec78c477-b1c3-4899-a209-a4e71337c996", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + loyalty_promotion: { + id: "loypromo_f0f9b849-725e-378d-b810-511237e07b67", + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + points_multiplier_data: { + points_multiplier: 3, + multiplier: "3.000", + }, + points_addition_data: { + points_addition: 1, + }, + }, + available_time: { + start_date: "2022-08-16", + end_date: "end_date", + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { + times: 1, + interval: "DAY", + }, + status: "ACTIVE", + created_at: "2022-08-16T08:38:54Z", + canceled_at: "canceled_at", + updated_at: "2022-08-16T08:38:54Z", + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + minimum_spend_amount_money: { + amount: BigInt("2000"), + currency: "USD", + }, + qualifying_item_variation_ids: ["qualifying_item_variation_ids"], + qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"], + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + loyalty_promotion: { + id: "loypromo_f0f9b849-725e-378d-b810-511237e07b67", + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + points_multiplier_data: { points_multiplier: 3, multiplier: "3.000" }, + points_addition_data: { points_addition: 1 }, + }, + available_time: { + start_date: "2022-08-16", + end_date: "end_date", + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { times: 1, interval: "DAY" }, + status: "ACTIVE", + created_at: "2022-08-16T08:38:54Z", + canceled_at: "canceled_at", + updated_at: "2022-08-16T08:38:54Z", + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + minimum_spend_amount_money: { amount: BigInt(2000), currency: "USD" }, + qualifying_item_variation_ids: ["CJ3RYL56ITAKMD4VRCM7XERS", "AT3RYLR3TUA9C34VRCB7X5RR"], + qualifying_category_ids: ["qualifying_category_ids"], + }, + }; + server + .mockEndpoint() + .get("/v2/loyalty/programs/program_id/promotions/promotion_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.programs.promotions.get({ + promotion_id: "promotion_id", + program_id: "program_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + loyalty_promotion: { + id: "loypromo_f0f9b849-725e-378d-b810-511237e07b67", + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + points_multiplier_data: { + points_multiplier: 3, + multiplier: "3.000", + }, + points_addition_data: { + points_addition: 1, + }, + }, + available_time: { + start_date: "2022-08-16", + end_date: "end_date", + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { + times: 1, + interval: "DAY", + }, + status: "ACTIVE", + created_at: "2022-08-16T08:38:54Z", + canceled_at: "canceled_at", + updated_at: "2022-08-16T08:38:54Z", + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + minimum_spend_amount_money: { + amount: BigInt("2000"), + currency: "USD", + }, + qualifying_item_variation_ids: ["CJ3RYL56ITAKMD4VRCM7XERS", "AT3RYLR3TUA9C34VRCB7X5RR"], + qualifying_category_ids: ["qualifying_category_ids"], + }, + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + loyalty_promotion: { + id: "loypromo_f0f9b849-725e-378d-b810-511237e07b67", + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + points_multiplier_data: { points_multiplier: 3, multiplier: "3.000" }, + points_addition_data: { points_addition: 1 }, + }, + available_time: { + start_date: "2022-08-16", + end_date: "end_date", + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { times: 1, interval: "DAY" }, + status: "CANCELED", + created_at: "2022-08-16T08:38:54Z", + canceled_at: "2022-08-17T12:42:49Z", + updated_at: "2022-08-17T12:42:49Z", + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + minimum_spend_amount_money: { amount: BigInt(2000), currency: "USD" }, + qualifying_item_variation_ids: ["qualifying_item_variation_ids"], + qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"], + }, + }; + server + .mockEndpoint() + .post("/v2/loyalty/programs/program_id/promotions/promotion_id/cancel") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.programs.promotions.cancel({ + promotion_id: "promotion_id", + program_id: "program_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + loyalty_promotion: { + id: "loypromo_f0f9b849-725e-378d-b810-511237e07b67", + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + points_multiplier_data: { + points_multiplier: 3, + multiplier: "3.000", + }, + points_addition_data: { + points_addition: 1, + }, + }, + available_time: { + start_date: "2022-08-16", + end_date: "end_date", + time_periods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + trigger_limit: { + times: 1, + interval: "DAY", + }, + status: "CANCELED", + created_at: "2022-08-16T08:38:54Z", + canceled_at: "2022-08-17T12:42:49Z", + updated_at: "2022-08-17T12:42:49Z", + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + minimum_spend_amount_money: { + amount: BigInt("2000"), + currency: "USD", + }, + qualifying_item_variation_ids: ["qualifying_item_variation_ids"], + qualifying_category_ids: ["XTQPYLR3IIU9C44VRCB3XD12"], + }, + }); + }); +}); diff --git a/tests/wire/loyalty/rewards.test.ts b/tests/wire/loyalty/rewards.test.ts new file mode 100644 index 000000000..b9aa6be56 --- /dev/null +++ b/tests/wire/loyalty/rewards.test.ts @@ -0,0 +1,391 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Rewards", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + reward: { + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + }, + idempotency_key: "18c2e5ea-a620-4b1f-ad60-7b167285e451", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + reward: { + id: "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943", + status: "ISSUED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + created_at: "2020-05-01T21:49:54Z", + updated_at: "2020-05-01T21:49:54Z", + redeemed_at: "redeemed_at", + }, + }; + server + .mockEndpoint() + .post("/v2/loyalty/rewards") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.rewards.create({ + reward: { + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + }, + idempotency_key: "18c2e5ea-a620-4b1f-ad60-7b167285e451", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + reward: { + id: "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943", + status: "ISSUED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + created_at: "2020-05-01T21:49:54Z", + updated_at: "2020-05-01T21:49:54Z", + redeemed_at: "redeemed_at", + }, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { query: { loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd" }, limit: 10 }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + rewards: [ + { + id: "d03f79f4-815f-3500-b851-cc1e68a457f9", + status: "REDEEMED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + created_at: "2020-05-08T22:00:44Z", + updated_at: "2020-05-08T22:01:17Z", + redeemed_at: "2020-05-08T22:01:17Z", + }, + { + id: "9f18ac21-233a-31c3-be77-b45840f5a810", + status: "REDEEMED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "order_id", + created_at: "2020-05-08T21:55:42Z", + updated_at: "2020-05-08T21:56:00Z", + redeemed_at: "2020-05-08T21:56:00Z", + }, + { + id: "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943", + status: "DELETED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "5NB69ZNh3FbsOs1ox43bh1xrli6YY", + created_at: "2020-05-01T21:49:54Z", + updated_at: "2020-05-08T21:55:10Z", + redeemed_at: "redeemed_at", + }, + { + id: "a051254c-f840-3b45-8cf1-50bcd38ff92a", + status: "ISSUED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "LQQ16znvi2VIUKPVhUfJefzr1eEZY", + created_at: "2020-05-01T20:20:37Z", + updated_at: "2020-05-01T20:20:40Z", + redeemed_at: "redeemed_at", + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/loyalty/rewards/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.rewards.search({ + query: { + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + }, + limit: 10, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + rewards: [ + { + id: "d03f79f4-815f-3500-b851-cc1e68a457f9", + status: "REDEEMED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + created_at: "2020-05-08T22:00:44Z", + updated_at: "2020-05-08T22:01:17Z", + redeemed_at: "2020-05-08T22:01:17Z", + }, + { + id: "9f18ac21-233a-31c3-be77-b45840f5a810", + status: "REDEEMED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "order_id", + created_at: "2020-05-08T21:55:42Z", + updated_at: "2020-05-08T21:56:00Z", + redeemed_at: "2020-05-08T21:56:00Z", + }, + { + id: "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943", + status: "DELETED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "5NB69ZNh3FbsOs1ox43bh1xrli6YY", + created_at: "2020-05-01T21:49:54Z", + updated_at: "2020-05-08T21:55:10Z", + redeemed_at: "redeemed_at", + }, + { + id: "a051254c-f840-3b45-8cf1-50bcd38ff92a", + status: "ISSUED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "LQQ16znvi2VIUKPVhUfJefzr1eEZY", + created_at: "2020-05-01T20:20:37Z", + updated_at: "2020-05-01T20:20:40Z", + redeemed_at: "redeemed_at", + }, + ], + cursor: "cursor", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + reward: { + id: "9f18ac21-233a-31c3-be77-b45840f5a810", + status: "REDEEMED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "order_id", + created_at: "2020-05-08T21:55:42Z", + updated_at: "2020-05-08T21:56:00Z", + redeemed_at: "2020-05-08T21:56:00Z", + }, + }; + server + .mockEndpoint() + .get("/v2/loyalty/rewards/reward_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.rewards.get({ + reward_id: "reward_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + reward: { + id: "9f18ac21-233a-31c3-be77-b45840f5a810", + status: "REDEEMED", + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + reward_tier_id: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + points: 10, + order_id: "order_id", + created_at: "2020-05-08T21:55:42Z", + updated_at: "2020-05-08T21:56:00Z", + redeemed_at: "2020-05-08T21:56:00Z", + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/loyalty/rewards/reward_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.rewards.delete({ + reward_id: "reward_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("redeem", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + location_id: "P034NEENMD09F", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + event: { + id: "67377a6e-dbdc-369d-aa16-2e7ed422e71f", + type: "REDEEM_REWARD", + created_at: "2020-05-08T21:56:00Z", + accumulate_points: { loyalty_program_id: "loyalty_program_id", points: 1, order_id: "order_id" }, + create_reward: { loyalty_program_id: "loyalty_program_id", reward_id: "reward_id", points: 1 }, + redeem_reward: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + reward_id: "9f18ac21-233a-31c3-be77-b45840f5a810", + order_id: "order_id", + }, + delete_reward: { loyalty_program_id: "loyalty_program_id", reward_id: "reward_id", points: 1 }, + adjust_points: { loyalty_program_id: "loyalty_program_id", points: 1, reason: "reason" }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { loyalty_program_id: "loyalty_program_id", points: 1 }, + other_event: { loyalty_program_id: "loyalty_program_id", points: 1 }, + accumulate_promotion_points: { + loyalty_program_id: "loyalty_program_id", + loyalty_promotion_id: "loyalty_promotion_id", + points: 1, + order_id: "order_id", + }, + }, + }; + server + .mockEndpoint() + .post("/v2/loyalty/rewards/reward_id/redeem") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.loyalty.rewards.redeem({ + reward_id: "reward_id", + idempotency_key: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + location_id: "P034NEENMD09F", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + event: { + id: "67377a6e-dbdc-369d-aa16-2e7ed422e71f", + type: "REDEEM_REWARD", + created_at: "2020-05-08T21:56:00Z", + accumulate_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + order_id: "order_id", + }, + create_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + points: 1, + }, + redeem_reward: { + loyalty_program_id: "d619f755-2d17-41f3-990d-c04ecedd64dd", + reward_id: "9f18ac21-233a-31c3-be77-b45840f5a810", + order_id: "order_id", + }, + delete_reward: { + loyalty_program_id: "loyalty_program_id", + reward_id: "reward_id", + points: 1, + }, + adjust_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + reason: "reason", + }, + loyalty_account_id: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + location_id: "P034NEENMD09F", + source: "LOYALTY_API", + expire_points: { + loyalty_program_id: "loyalty_program_id", + points: 1, + }, + other_event: { + loyalty_program_id: "loyalty_program_id", + points: 1, + }, + accumulate_promotion_points: { + loyalty_program_id: "loyalty_program_id", + loyalty_promotion_id: "loyalty_promotion_id", + points: 1, + order_id: "order_id", + }, + }, + }); + }); +}); diff --git a/tests/wire/merchants.test.ts b/tests/wire/merchants.test.ts new file mode 100644 index 000000000..88922277d --- /dev/null +++ b/tests/wire/merchants.test.ts @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Merchants", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + merchant: { + id: "DM7VKY8Q63GNP", + business_name: "Apple A Day", + country: "US", + language_code: "en-US", + currency: "USD", + status: "ACTIVE", + main_location_id: "9A65CGC72ZQG1", + created_at: "2021-12-10T19:25:52.484Z", + }, + }; + server + .mockEndpoint() + .get("/v2/merchants/merchant_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.get({ + merchant_id: "merchant_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + merchant: { + id: "DM7VKY8Q63GNP", + business_name: "Apple A Day", + country: "US", + language_code: "en-US", + currency: "USD", + status: "ACTIVE", + main_location_id: "9A65CGC72ZQG1", + created_at: "2021-12-10T19:25:52.484Z", + }, + }); + }); +}); diff --git a/tests/wire/merchants/customAttributeDefinitions.test.ts b/tests/wire/merchants/customAttributeDefinitions.test.ts new file mode 100644 index 000000000..25e970293 --- /dev/null +++ b/tests/wire/merchants/customAttributeDefinitions.test.ts @@ -0,0 +1,229 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributeDefinitions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { + 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", + }, + }; + const rawResponseBody = { + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2023-05-05T19:06:36.559Z", + created_at: "2023-05-05T19:06:36.559Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/merchants/custom-attribute-definitions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributeDefinitions.create({ + custom_attribute_definition: { + 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", + }, + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2023-05-05T19:06:36.559Z", + created_at: "2023-05-05T19:06:36.559Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2023-05-05T19:06:36.559Z", + created_at: "2023-05-05T19:06:36.559Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/merchants/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributeDefinitions.get({ + key: "key", + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2023-05-05T19:06:36.559Z", + created_at: "2023-05-05T19:06:36.559Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, + }; + const rawResponseBody = { + custom_attribute_definition: { + key: "alternative_seller_name", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Alternative Merchant Name", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2023-05-05T19:34:10.181Z", + created_at: "2023-05-05T19:06:36.559Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/merchants/custom-attribute-definitions/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributeDefinitions.update({ + key: "key", + custom_attribute_definition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, + }); + expect(response).toEqual({ + custom_attribute_definition: { + key: "alternative_seller_name", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Alternative Merchant Name", + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + version: 2, + updated_at: "2023-05-05T19:34:10.181Z", + created_at: "2023-05-05T19:06:36.559Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/merchants/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributeDefinitions.delete({ + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/merchants/customAttributes.test.ts b/tests/wire/merchants/customAttributes.test.ts new file mode 100644 index 000000000..2b4ba479c --- /dev/null +++ b/tests/wire/merchants/customAttributes.test.ts @@ -0,0 +1,359 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributes", () => { + test("batchDelete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + values: { id1: { key: "alternative_seller_name" }, id2: { key: "has_seen_tutorial" } }, + }; + const rawResponseBody = { + values: { + id1: { errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }] }, + id2: { errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }] }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/merchants/custom-attributes/bulk-delete") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributes.batchDelete({ + values: { + id1: { + key: "alternative_seller_name", + }, + id2: { + key: "has_seen_tutorial", + }, + }, + }); + expect(response).toEqual({ + values: { + id1: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id2: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("batchUpsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + values: { + id1: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { key: "alternative_seller_name", value: "Ultimate Sneaker Store" }, + }, + id2: { merchant_id: "DM7VKY8Q63GNP", custom_attribute: { key: "has_seen_tutorial", value: true } }, + }, + }; + const rawResponseBody = { + values: { + id1: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + version: 2, + visibility: "VISIBILITY_READ_ONLY", + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + id2: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { + key: "has_seen_tutorial", + value: true, + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/merchants/custom-attributes/bulk-upsert") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributes.batchUpsert({ + values: { + id1: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + }, + }, + id2: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { + key: "has_seen_tutorial", + value: true, + }, + }, + }, + }); + expect(response).toEqual({ + values: { + id1: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + version: 2, + visibility: "VISIBILITY_READ_ONLY", + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + id2: { + merchant_id: "DM7VKY8Q63GNP", + custom_attribute: { + key: "has_seen_tutorial", + value: true, + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + version: 2, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/merchants/merchant_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributes.get({ + merchant_id: "merchant_id", + key: "key", + }); + expect(response).toEqual({ + custom_attribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + version: 2, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("upsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { custom_attribute: { value: "Ultimate Sneaker Store" } }; + const rawResponseBody = { + custom_attribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + version: 2, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/merchants/merchant_id/custom-attributes/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributes.upsert({ + merchant_id: "merchant_id", + key: "key", + custom_attribute: { + value: "Ultimate Sneaker Store", + }, + }); + expect(response).toEqual({ + custom_attribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + version: 2, + visibility: "VISIBILITY_READ_ONLY", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2023-05-06T19:21:04.551Z", + created_at: "2023-05-06T19:02:58.647Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/merchants/merchant_id/custom-attributes/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.merchants.customAttributes.delete({ + merchant_id: "merchant_id", + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/mobile.test.ts b/tests/wire/mobile.test.ts new file mode 100644 index 000000000..82e8c6c0b --- /dev/null +++ b/tests/wire/mobile.test.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Mobile", () => { + test("authorizationCode", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { location_id: "YOUR_LOCATION_ID" }; + const rawResponseBody = { + authorization_code: "YOUR_MOBILE_AUTHORIZATION_CODE", + expires_at: "2019-01-10T19:42:08Z", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/mobile/authorization-code") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.mobile.authorizationCode({ + location_id: "YOUR_LOCATION_ID", + }); + expect(response).toEqual({ + authorization_code: "YOUR_MOBILE_AUTHORIZATION_CODE", + expires_at: "2019-01-10T19:42:08Z", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/oAuth.test.ts b/tests/wire/oAuth.test.ts new file mode 100644 index 000000000..c8faf4da6 --- /dev/null +++ b/tests/wire/oAuth.test.ts @@ -0,0 +1,147 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("OAuth", () => { + test("revokeToken", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { client_id: "CLIENT_ID", access_token: "ACCESS_TOKEN" }; + const rawResponseBody = { + success: true, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/oauth2/revoke") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.oAuth.revokeToken({ + client_id: "CLIENT_ID", + access_token: "ACCESS_TOKEN", + }); + expect(response).toEqual({ + success: true, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("obtainToken", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + client_id: "sq0idp-uaPHILoPzWZk3tlJqlML0g", + client_secret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", + code: "sq0cgb-l0SBqxs4uwxErTVyYOdemg", + grant_type: "authorization_code", + }; + const rawResponseBody = { + access_token: "EAAl3ikZIe18J-2-cHlV2bL4-EaZHGoJUhtEBT7QA6-7AgwIHw8Xe1IoUvGsNxA", + token_type: "bearer", + expires_at: "2025-04-03T18:31:06Z", + merchant_id: "MLQW2MYBY81PZ", + subscription_id: "subscription_id", + plan_id: "plan_id", + id_token: "id_token", + refresh_token: "EQAAl0OcByu3IYJYScGGg-8E5YNf0r0b6jCTCMy5nOcRZ4ok0wbWAL8vY3tZWNcc", + short_lived: false, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refresh_token_expires_at: "refresh_token_expires_at", + }; + server + .mockEndpoint() + .post("/oauth2/token") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.oAuth.obtainToken({ + client_id: "sq0idp-uaPHILoPzWZk3tlJqlML0g", + client_secret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", + code: "sq0cgb-l0SBqxs4uwxErTVyYOdemg", + grant_type: "authorization_code", + }); + expect(response).toEqual({ + access_token: "EAAl3ikZIe18J-2-cHlV2bL4-EaZHGoJUhtEBT7QA6-7AgwIHw8Xe1IoUvGsNxA", + token_type: "bearer", + expires_at: "2025-04-03T18:31:06Z", + merchant_id: "MLQW2MYBY81PZ", + subscription_id: "subscription_id", + plan_id: "plan_id", + id_token: "id_token", + refresh_token: "EQAAl0OcByu3IYJYScGGg-8E5YNf0r0b6jCTCMy5nOcRZ4ok0wbWAL8vY3tZWNcc", + short_lived: false, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refresh_token_expires_at: "refresh_token_expires_at", + }); + }); + + test("RetrieveTokenStatus", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + scopes: ["PAYMENTS_READ", "PAYMENTS_WRITE"], + expires_at: "2022-10-14T14:44:00Z", + client_id: "CLIENT_ID", + merchant_id: "MERCHANT_ID", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/oauth2/token/status") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.oAuth.retrieveTokenStatus(); + expect(response).toEqual({ + scopes: ["PAYMENTS_READ", "PAYMENTS_WRITE"], + expires_at: "2022-10-14T14:44:00Z", + client_id: "CLIENT_ID", + merchant_id: "MERCHANT_ID", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("authorize", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + server.mockEndpoint().get("/oauth2/authorize").respondWith().statusCode(200).build(); + + const response = await client.oAuth.authorize(); + expect(response).toEqual(undefined); + }); +}); diff --git a/tests/wire/orders.test.ts b/tests/wire/orders.test.ts new file mode 100644 index 000000000..0cb49550a --- /dev/null +++ b/tests/wire/orders.test.ts @@ -0,0 +1,2662 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Orders", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + order: { + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + line_items: [ + { + name: "New York Strip Steak", + quantity: "1", + base_price_money: { amount: BigInt(1599), currency: "USD" }, + }, + { + quantity: "2", + catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", + modifiers: [{ catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ" }], + applied_discounts: [{ discount_uid: "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", catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", scope: "ORDER" }, + { + uid: "one-dollar-off", + name: "Sale - $1.00 off", + amount_money: { amount: BigInt(100), currency: "USD" }, + scope: "LINE_ITEM", + }, + ], + }, + idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", + }; + const rawResponseBody = { + order: { + id: "CAISENgvlJ6jLWAzERDzjyHVybY", + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + source: { name: "My App" }, + customer_id: "customer_id", + line_items: [ + { + uid: "8uSwfzvUImn3IRrvciqlXC", + name: "New York Strip Steak", + quantity: "1", + applied_taxes: [ + { + uid: "aKG87ArnDpvMLSZJHxWUl", + tax_uid: "state-sales-tax", + applied_money: { amount: BigInt(136), currency: "USD" }, + }, + ], + applied_discounts: [ + { + uid: "jWdgP1TpHPFBuVrz81mXVC", + discount_uid: "membership-discount", + applied_money: { amount: BigInt(8), currency: "USD" }, + }, + { + uid: "jnZOjjVY57eRcQAVgEwFuC", + discount_uid: "labor-day-sale", + applied_money: { amount: BigInt(79), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(1599), currency: "USD" }, + variation_total_price_money: { amount: BigInt(1599), currency: "USD" }, + gross_sales_money: { amount: BigInt(1599), currency: "USD" }, + total_tax_money: { amount: BigInt(136), currency: "USD" }, + total_discount_money: { amount: BigInt(87), currency: "USD" }, + total_money: { amount: BigInt(1648), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + { + uid: "v8ZuEXpOJpb0bazLuvrLDB", + name: "New York Steak", + quantity: "2", + catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", + variation_name: "Larger", + modifiers: [ + { + uid: "Lo3qMMckDluu9Qsb58d4CC", + catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ", + name: "Well", + base_price_money: { amount: BigInt(50), currency: "USD" }, + total_price_money: { amount: BigInt(100), currency: "USD" }, + }, + ], + applied_taxes: [ + { + uid: "v1dAgrfUVUPTnVTf9sRPz", + tax_uid: "state-sales-tax", + applied_money: { amount: BigInt(374), currency: "USD" }, + }, + ], + applied_discounts: [ + { + uid: "nUXvdsIItfKko0dbYtY58C", + discount_uid: "membership-discount", + applied_money: { amount: BigInt(22), currency: "USD" }, + }, + { + uid: "qSdkOOOernlVQqsJ94SPjB", + discount_uid: "labor-day-sale", + applied_money: { amount: BigInt(224), currency: "USD" }, + }, + { + uid: "y7bVl4njrWAnfDwmz19izB", + discount_uid: "one-dollar-off", + applied_money: { amount: BigInt(100), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(2200), currency: "USD" }, + variation_total_price_money: { amount: BigInt(4400), currency: "USD" }, + gross_sales_money: { amount: BigInt(4500), currency: "USD" }, + total_tax_money: { amount: BigInt(374), currency: "USD" }, + total_discount_money: { amount: BigInt(346), currency: "USD" }, + total_money: { amount: BigInt(4528), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + taxes: [ + { + uid: "state-sales-tax", + name: "State Sales Tax", + type: "ADDITIVE", + percentage: "9", + applied_money: { amount: BigInt(510), currency: "USD" }, + scope: "ORDER", + }, + ], + discounts: [ + { + uid: "membership-discount", + catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", + name: "Membership Discount", + type: "FIXED_PERCENTAGE", + percentage: "0.5", + applied_money: { amount: BigInt(30), currency: "USD" }, + scope: "ORDER", + }, + { + uid: "labor-day-sale", + name: "Labor Day Sale", + type: "FIXED_PERCENTAGE", + percentage: "5", + applied_money: { amount: BigInt(303), currency: "USD" }, + scope: "ORDER", + }, + { + uid: "one-dollar-off", + name: "Sale - $1.00 off", + type: "FIXED_AMOUNT", + amount_money: { amount: BigInt(100), currency: "USD" }, + applied_money: { amount: BigInt(100), currency: "USD" }, + scope: "LINE_ITEM", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { amount: BigInt(6176), currency: "USD" }, + tax_money: { amount: BigInt(510), currency: "USD" }, + discount_money: { amount: BigInt(433), currency: "USD" }, + tip_money: { amount: BigInt(0), currency: "USD" }, + service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + rounding_adjustment: { uid: "uid", name: "name" }, + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + metadata: { key: "value" }, + created_at: "2020-01-17T20:47:53.293Z", + updated_at: "2020-01-17T20:47:53.293Z", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { amount: BigInt(6176), currency: "USD" }, + total_tax_money: { amount: BigInt(510), currency: "USD" }, + total_discount_money: { amount: BigInt(433), currency: "USD" }, + total_tip_money: { amount: BigInt(0), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + ticket_name: "ticket_name", + pricing_options: { auto_apply_discounts: true, auto_apply_taxes: true }, + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + net_amount_due_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/orders") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.create({ + order: { + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + line_items: [ + { + name: "New York Strip Steak", + quantity: "1", + base_price_money: { + amount: BigInt("1599"), + currency: "USD", + }, + }, + { + quantity: "2", + catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", + modifiers: [ + { + catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ", + }, + ], + applied_discounts: [ + { + discount_uid: "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", + catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", + scope: "ORDER", + }, + { + uid: "one-dollar-off", + name: "Sale - $1.00 off", + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + scope: "LINE_ITEM", + }, + ], + }, + idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", + }); + expect(response).toEqual({ + order: { + id: "CAISENgvlJ6jLWAzERDzjyHVybY", + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + source: { + name: "My App", + }, + customer_id: "customer_id", + line_items: [ + { + uid: "8uSwfzvUImn3IRrvciqlXC", + name: "New York Strip Steak", + quantity: "1", + applied_taxes: [ + { + uid: "aKG87ArnDpvMLSZJHxWUl", + tax_uid: "state-sales-tax", + applied_money: { + amount: BigInt("136"), + currency: "USD", + }, + }, + ], + applied_discounts: [ + { + uid: "jWdgP1TpHPFBuVrz81mXVC", + discount_uid: "membership-discount", + applied_money: { + amount: BigInt("8"), + currency: "USD", + }, + }, + { + uid: "jnZOjjVY57eRcQAVgEwFuC", + discount_uid: "labor-day-sale", + applied_money: { + amount: BigInt("79"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("1599"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("1599"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("1599"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("136"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("87"), + currency: "USD", + }, + total_money: { + amount: BigInt("1648"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + { + uid: "v8ZuEXpOJpb0bazLuvrLDB", + name: "New York Steak", + quantity: "2", + catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", + variation_name: "Larger", + modifiers: [ + { + uid: "Lo3qMMckDluu9Qsb58d4CC", + catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ", + name: "Well", + base_price_money: { + amount: BigInt("50"), + currency: "USD", + }, + total_price_money: { + amount: BigInt("100"), + currency: "USD", + }, + }, + ], + applied_taxes: [ + { + uid: "v1dAgrfUVUPTnVTf9sRPz", + tax_uid: "state-sales-tax", + applied_money: { + amount: BigInt("374"), + currency: "USD", + }, + }, + ], + applied_discounts: [ + { + uid: "nUXvdsIItfKko0dbYtY58C", + discount_uid: "membership-discount", + applied_money: { + amount: BigInt("22"), + currency: "USD", + }, + }, + { + uid: "qSdkOOOernlVQqsJ94SPjB", + discount_uid: "labor-day-sale", + applied_money: { + amount: BigInt("224"), + currency: "USD", + }, + }, + { + uid: "y7bVl4njrWAnfDwmz19izB", + discount_uid: "one-dollar-off", + applied_money: { + amount: BigInt("100"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("2200"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("4400"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("4500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("374"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("346"), + currency: "USD", + }, + total_money: { + amount: BigInt("4528"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + taxes: [ + { + uid: "state-sales-tax", + name: "State Sales Tax", + type: "ADDITIVE", + percentage: "9", + applied_money: { + amount: BigInt("510"), + currency: "USD", + }, + scope: "ORDER", + }, + ], + discounts: [ + { + uid: "membership-discount", + catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", + name: "Membership Discount", + type: "FIXED_PERCENTAGE", + percentage: "0.5", + applied_money: { + amount: BigInt("30"), + currency: "USD", + }, + scope: "ORDER", + }, + { + uid: "labor-day-sale", + name: "Labor Day Sale", + type: "FIXED_PERCENTAGE", + percentage: "5", + applied_money: { + amount: BigInt("303"), + currency: "USD", + }, + scope: "ORDER", + }, + { + uid: "one-dollar-off", + name: "Sale - $1.00 off", + type: "FIXED_AMOUNT", + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + applied_money: { + amount: BigInt("100"), + currency: "USD", + }, + scope: "LINE_ITEM", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { + amount: BigInt("6176"), + currency: "USD", + }, + tax_money: { + amount: BigInt("510"), + currency: "USD", + }, + discount_money: { + amount: BigInt("433"), + currency: "USD", + }, + tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + rounding_adjustment: { + uid: "uid", + name: "name", + }, + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + metadata: { + key: "value", + }, + created_at: "2020-01-17T20:47:53.293Z", + updated_at: "2020-01-17T20:47:53.293Z", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { + amount: BigInt("6176"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("510"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("433"), + currency: "USD", + }, + total_tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + ticket_name: "ticket_name", + pricing_options: { + auto_apply_discounts: true, + auto_apply_taxes: true, + }, + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + net_amount_due_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("batchGet", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + location_id: "057P5VYJ4A5X1", + order_ids: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"], + }; + const rawResponseBody = { + orders: [ + { + id: "CAISEM82RcpmcFBM0TfOyiHV3es", + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + customer_id: "customer_id", + line_items: [ + { + uid: "945986d1-9586-11e6-ad5a-28cfe92138cf", + name: "Awesome product", + quantity: "1", + base_price_money: { amount: BigInt(1599), currency: "USD" }, + total_money: { amount: BigInt(1599), currency: "USD" }, + }, + { + uid: "a8f4168c-9586-11e6-bdf0-28cfe92138cf", + name: "Another awesome product", + quantity: "3", + base_price_money: { amount: BigInt(2000), currency: "USD" }, + total_money: { amount: BigInt(6000), currency: "USD" }, + }, + ], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + created_at: "created_at", + updated_at: "updated_at", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { amount: BigInt(7599), currency: "USD" }, + ticket_name: "ticket_name", + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + }, + ], + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/orders/batch-retrieve") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.batchGet({ + location_id: "057P5VYJ4A5X1", + order_ids: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"], + }); + expect(response).toEqual({ + orders: [ + { + id: "CAISEM82RcpmcFBM0TfOyiHV3es", + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + customer_id: "customer_id", + line_items: [ + { + uid: "945986d1-9586-11e6-ad5a-28cfe92138cf", + name: "Awesome product", + quantity: "1", + base_price_money: { + amount: BigInt("1599"), + currency: "USD", + }, + total_money: { + amount: BigInt("1599"), + currency: "USD", + }, + }, + { + uid: "a8f4168c-9586-11e6-bdf0-28cfe92138cf", + name: "Another awesome product", + quantity: "3", + base_price_money: { + amount: BigInt("2000"), + currency: "USD", + }, + total_money: { + amount: BigInt("6000"), + currency: "USD", + }, + }, + ], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + created_at: "created_at", + updated_at: "updated_at", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { + amount: BigInt("7599"), + currency: "USD", + }, + ticket_name: "ticket_name", + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + }, + ], + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("calculate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + order: { + location_id: "D7AVYMEAPJ3A3", + line_items: [ + { name: "Item 1", quantity: "1", base_price_money: { amount: BigInt(500), currency: "USD" } }, + { name: "Item 2", quantity: "2", base_price_money: { amount: BigInt(300), currency: "USD" } }, + ], + discounts: [{ name: "50% Off", percentage: "50", scope: "ORDER" }], + }, + }; + const rawResponseBody = { + order: { + id: "id", + location_id: "D7AVYMEAPJ3A3", + reference_id: "reference_id", + source: { name: "name" }, + customer_id: "customer_id", + line_items: [ + { + uid: "ULkg0tQTRK2bkU9fNv3IJD", + name: "Item 1", + quantity: "1", + applied_discounts: [ + { + uid: "9zr9S4dxvPAixvn0lpa1VC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { amount: BigInt(250), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(500), currency: "USD" }, + variation_total_price_money: { amount: BigInt(500), currency: "USD" }, + gross_sales_money: { amount: BigInt(500), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(250), currency: "USD" }, + total_money: { amount: BigInt(250), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + { + uid: "mumY8Nun4BC5aKe2yyx5a", + name: "Item 2", + quantity: "2", + applied_discounts: [ + { + uid: "qa8LwwZK82FgSEkQc2HYVC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { amount: BigInt(300), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(300), currency: "USD" }, + variation_total_price_money: { amount: BigInt(600), currency: "USD" }, + gross_sales_money: { amount: BigInt(600), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(300), currency: "USD" }, + total_money: { amount: BigInt(300), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + taxes: [{}], + discounts: [ + { + uid: "zGsRZP69aqSSR9lq9euSPB", + name: "50% Off", + type: "FIXED_PERCENTAGE", + percentage: "50", + applied_money: { amount: BigInt(550), currency: "USD" }, + scope: "ORDER", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { amount: BigInt(550), currency: "USD" }, + tax_money: { amount: BigInt(0), currency: "USD" }, + discount_money: { amount: BigInt(550), currency: "USD" }, + tip_money: { amount: BigInt(0), currency: "USD" }, + service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + rounding_adjustment: { uid: "uid", name: "name" }, + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + metadata: { key: "value" }, + created_at: "2020-05-18T16:30:49.614Z", + updated_at: "2020-05-18T16:30:49.614Z", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { amount: BigInt(550), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(550), currency: "USD" }, + total_tip_money: { amount: BigInt(0), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + ticket_name: "ticket_name", + pricing_options: { auto_apply_discounts: true, auto_apply_taxes: true }, + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + net_amount_due_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/orders/calculate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.calculate({ + order: { + location_id: "D7AVYMEAPJ3A3", + line_items: [ + { + name: "Item 1", + quantity: "1", + base_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + }, + { + name: "Item 2", + quantity: "2", + base_price_money: { + amount: BigInt("300"), + currency: "USD", + }, + }, + ], + discounts: [ + { + name: "50% Off", + percentage: "50", + scope: "ORDER", + }, + ], + }, + }); + expect(response).toEqual({ + order: { + id: "id", + location_id: "D7AVYMEAPJ3A3", + reference_id: "reference_id", + source: { + name: "name", + }, + customer_id: "customer_id", + line_items: [ + { + uid: "ULkg0tQTRK2bkU9fNv3IJD", + name: "Item 1", + quantity: "1", + applied_discounts: [ + { + uid: "9zr9S4dxvPAixvn0lpa1VC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { + amount: BigInt("250"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("250"), + currency: "USD", + }, + total_money: { + amount: BigInt("250"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + { + uid: "mumY8Nun4BC5aKe2yyx5a", + name: "Item 2", + quantity: "2", + applied_discounts: [ + { + uid: "qa8LwwZK82FgSEkQc2HYVC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { + amount: BigInt("300"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("300"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("600"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("600"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("300"), + currency: "USD", + }, + total_money: { + amount: BigInt("300"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + taxes: [{}], + discounts: [ + { + uid: "zGsRZP69aqSSR9lq9euSPB", + name: "50% Off", + type: "FIXED_PERCENTAGE", + percentage: "50", + applied_money: { + amount: BigInt("550"), + currency: "USD", + }, + scope: "ORDER", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { + amount: BigInt("550"), + currency: "USD", + }, + tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + discount_money: { + amount: BigInt("550"), + currency: "USD", + }, + tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + rounding_adjustment: { + uid: "uid", + name: "name", + }, + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + metadata: { + key: "value", + }, + created_at: "2020-05-18T16:30:49.614Z", + updated_at: "2020-05-18T16:30:49.614Z", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { + amount: BigInt("550"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("550"), + currency: "USD", + }, + total_tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + ticket_name: "ticket_name", + pricing_options: { + auto_apply_discounts: true, + auto_apply_taxes: true, + }, + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + net_amount_due_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("clone", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + order_id: "ZAISEM52YcpmcWAzERDOyiWS123", + version: 3, + idempotency_key: "UNIQUE_STRING", + }; + const rawResponseBody = { + order: { + id: "CAISENgvlJ6jLWAzERDzjyHVybY", + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + source: { name: "My App" }, + customer_id: "customer_id", + line_items: [ + { + uid: "8uSwfzvUImn3IRrvciqlXC", + name: "New York Strip Steak", + quantity: "1", + applied_taxes: [ + { + uid: "aKG87ArnDpvMLSZJHxWUl", + tax_uid: "state-sales-tax", + applied_money: { amount: BigInt(136), currency: "USD" }, + }, + ], + applied_discounts: [ + { + uid: "jWdgP1TpHPFBuVrz81mXVC", + discount_uid: "membership-discount", + applied_money: { amount: BigInt(8), currency: "USD" }, + }, + { + uid: "jnZOjjVY57eRcQAVgEwFuC", + discount_uid: "labor-day-sale", + applied_money: { amount: BigInt(79), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(1599), currency: "USD" }, + variation_total_price_money: { amount: BigInt(1599), currency: "USD" }, + gross_sales_money: { amount: BigInt(1599), currency: "USD" }, + total_tax_money: { amount: BigInt(136), currency: "USD" }, + total_discount_money: { amount: BigInt(87), currency: "USD" }, + total_money: { amount: BigInt(1648), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + { + uid: "v8ZuEXpOJpb0bazLuvrLDB", + name: "New York Steak", + quantity: "2", + catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", + variation_name: "Larger", + modifiers: [ + { + uid: "Lo3qMMckDluu9Qsb58d4CC", + catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ", + name: "Well", + base_price_money: { amount: BigInt(50), currency: "USD" }, + total_price_money: { amount: BigInt(100), currency: "USD" }, + }, + ], + applied_taxes: [ + { + uid: "v1dAgrfUVUPTnVTf9sRPz", + tax_uid: "state-sales-tax", + applied_money: { amount: BigInt(374), currency: "USD" }, + }, + ], + applied_discounts: [ + { + uid: "nUXvdsIItfKko0dbYtY58C", + discount_uid: "membership-discount", + applied_money: { amount: BigInt(22), currency: "USD" }, + }, + { + uid: "qSdkOOOernlVQqsJ94SPjB", + discount_uid: "labor-day-sale", + applied_money: { amount: BigInt(224), currency: "USD" }, + }, + { + uid: "y7bVl4njrWAnfDwmz19izB", + discount_uid: "one-dollar-off", + applied_money: { amount: BigInt(100), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(2200), currency: "USD" }, + variation_total_price_money: { amount: BigInt(4400), currency: "USD" }, + gross_sales_money: { amount: BigInt(4500), currency: "USD" }, + total_tax_money: { amount: BigInt(374), currency: "USD" }, + total_discount_money: { amount: BigInt(346), currency: "USD" }, + total_money: { amount: BigInt(4528), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + taxes: [ + { + uid: "state-sales-tax", + name: "State Sales Tax", + type: "ADDITIVE", + percentage: "9", + applied_money: { amount: BigInt(510), currency: "USD" }, + scope: "ORDER", + }, + ], + discounts: [ + { + uid: "membership-discount", + catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", + name: "Membership Discount", + type: "FIXED_PERCENTAGE", + percentage: "0.5", + applied_money: { amount: BigInt(30), currency: "USD" }, + scope: "ORDER", + }, + { + uid: "labor-day-sale", + name: "Labor Day Sale", + type: "FIXED_PERCENTAGE", + percentage: "5", + applied_money: { amount: BigInt(303), currency: "USD" }, + scope: "ORDER", + }, + { + uid: "one-dollar-off", + name: "Sale - $1.00 off", + type: "FIXED_AMOUNT", + amount_money: { amount: BigInt(100), currency: "USD" }, + applied_money: { amount: BigInt(100), currency: "USD" }, + scope: "LINE_ITEM", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { amount: BigInt(6176), currency: "USD" }, + tax_money: { amount: BigInt(510), currency: "USD" }, + discount_money: { amount: BigInt(433), currency: "USD" }, + tip_money: { amount: BigInt(0), currency: "USD" }, + service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + rounding_adjustment: { uid: "uid", name: "name" }, + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + metadata: { key: "value" }, + created_at: "2020-01-17T20:47:53.293Z", + updated_at: "2020-01-17T20:47:53.293Z", + closed_at: "closed_at", + state: "DRAFT", + version: 1, + total_money: { amount: BigInt(6176), currency: "USD" }, + total_tax_money: { amount: BigInt(510), currency: "USD" }, + total_discount_money: { amount: BigInt(433), currency: "USD" }, + total_tip_money: { amount: BigInt(0), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + ticket_name: "ticket_name", + pricing_options: { auto_apply_discounts: true, auto_apply_taxes: true }, + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + net_amount_due_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/orders/clone") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.clone({ + order_id: "ZAISEM52YcpmcWAzERDOyiWS123", + version: 3, + idempotency_key: "UNIQUE_STRING", + }); + expect(response).toEqual({ + order: { + id: "CAISENgvlJ6jLWAzERDzjyHVybY", + location_id: "057P5VYJ4A5X1", + reference_id: "my-order-001", + source: { + name: "My App", + }, + customer_id: "customer_id", + line_items: [ + { + uid: "8uSwfzvUImn3IRrvciqlXC", + name: "New York Strip Steak", + quantity: "1", + applied_taxes: [ + { + uid: "aKG87ArnDpvMLSZJHxWUl", + tax_uid: "state-sales-tax", + applied_money: { + amount: BigInt("136"), + currency: "USD", + }, + }, + ], + applied_discounts: [ + { + uid: "jWdgP1TpHPFBuVrz81mXVC", + discount_uid: "membership-discount", + applied_money: { + amount: BigInt("8"), + currency: "USD", + }, + }, + { + uid: "jnZOjjVY57eRcQAVgEwFuC", + discount_uid: "labor-day-sale", + applied_money: { + amount: BigInt("79"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("1599"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("1599"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("1599"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("136"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("87"), + currency: "USD", + }, + total_money: { + amount: BigInt("1648"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + { + uid: "v8ZuEXpOJpb0bazLuvrLDB", + name: "New York Steak", + quantity: "2", + catalog_object_id: "BEMYCSMIJL46OCDV4KYIKXIB", + variation_name: "Larger", + modifiers: [ + { + uid: "Lo3qMMckDluu9Qsb58d4CC", + catalog_object_id: "CHQX7Y4KY6N5KINJKZCFURPZ", + name: "Well", + base_price_money: { + amount: BigInt("50"), + currency: "USD", + }, + total_price_money: { + amount: BigInt("100"), + currency: "USD", + }, + }, + ], + applied_taxes: [ + { + uid: "v1dAgrfUVUPTnVTf9sRPz", + tax_uid: "state-sales-tax", + applied_money: { + amount: BigInt("374"), + currency: "USD", + }, + }, + ], + applied_discounts: [ + { + uid: "nUXvdsIItfKko0dbYtY58C", + discount_uid: "membership-discount", + applied_money: { + amount: BigInt("22"), + currency: "USD", + }, + }, + { + uid: "qSdkOOOernlVQqsJ94SPjB", + discount_uid: "labor-day-sale", + applied_money: { + amount: BigInt("224"), + currency: "USD", + }, + }, + { + uid: "y7bVl4njrWAnfDwmz19izB", + discount_uid: "one-dollar-off", + applied_money: { + amount: BigInt("100"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("2200"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("4400"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("4500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("374"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("346"), + currency: "USD", + }, + total_money: { + amount: BigInt("4528"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + taxes: [ + { + uid: "state-sales-tax", + name: "State Sales Tax", + type: "ADDITIVE", + percentage: "9", + applied_money: { + amount: BigInt("510"), + currency: "USD", + }, + scope: "ORDER", + }, + ], + discounts: [ + { + uid: "membership-discount", + catalog_object_id: "DB7L55ZH2BGWI4H23ULIWOQ7", + name: "Membership Discount", + type: "FIXED_PERCENTAGE", + percentage: "0.5", + applied_money: { + amount: BigInt("30"), + currency: "USD", + }, + scope: "ORDER", + }, + { + uid: "labor-day-sale", + name: "Labor Day Sale", + type: "FIXED_PERCENTAGE", + percentage: "5", + applied_money: { + amount: BigInt("303"), + currency: "USD", + }, + scope: "ORDER", + }, + { + uid: "one-dollar-off", + name: "Sale - $1.00 off", + type: "FIXED_AMOUNT", + amount_money: { + amount: BigInt("100"), + currency: "USD", + }, + applied_money: { + amount: BigInt("100"), + currency: "USD", + }, + scope: "LINE_ITEM", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { + amount: BigInt("6176"), + currency: "USD", + }, + tax_money: { + amount: BigInt("510"), + currency: "USD", + }, + discount_money: { + amount: BigInt("433"), + currency: "USD", + }, + tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + rounding_adjustment: { + uid: "uid", + name: "name", + }, + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + metadata: { + key: "value", + }, + created_at: "2020-01-17T20:47:53.293Z", + updated_at: "2020-01-17T20:47:53.293Z", + closed_at: "closed_at", + state: "DRAFT", + version: 1, + total_money: { + amount: BigInt("6176"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("510"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("433"), + currency: "USD", + }, + total_tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + ticket_name: "ticket_name", + pricing_options: { + auto_apply_discounts: true, + auto_apply_taxes: true, + }, + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + net_amount_due_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + location_ids: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], + query: { + filter: { + state_filter: { states: ["COMPLETED"] }, + date_time_filter: { + closed_at: { start_at: "2018-03-03T20:00:00+00:00", end_at: "2019-03-04T21:54:45+00:00" }, + }, + }, + sort: { sort_field: "CLOSED_AT", sort_order: "DESC" }, + }, + limit: 3, + return_entries: true, + }; + const rawResponseBody = { + order_entries: [ + { order_id: "CAISEM82RcpmcFBM0TfOyiHV3es", version: 1, location_id: "057P5VYJ4A5X1" }, + { order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", version: 1, location_id: "18YC4JDH91E1H" }, + { order_id: "CAISEM52YcpmcWAzERDOyiWS3ty", version: 1, location_id: "057P5VYJ4A5X1" }, + ], + orders: [ + { + id: "id", + location_id: "location_id", + reference_id: "reference_id", + customer_id: "customer_id", + line_items: [{ quantity: "quantity" }], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + created_at: "created_at", + updated_at: "updated_at", + closed_at: "closed_at", + state: "OPEN", + version: 1, + ticket_name: "ticket_name", + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + }, + ], + cursor: "123", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/orders/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.search({ + location_ids: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], + query: { + filter: { + state_filter: { + states: ["COMPLETED"], + }, + date_time_filter: { + closed_at: { + start_at: "2018-03-03T20:00:00+00:00", + end_at: "2019-03-04T21:54:45+00:00", + }, + }, + }, + sort: { + sort_field: "CLOSED_AT", + sort_order: "DESC", + }, + }, + limit: 3, + return_entries: true, + }); + expect(response).toEqual({ + order_entries: [ + { + order_id: "CAISEM82RcpmcFBM0TfOyiHV3es", + version: 1, + location_id: "057P5VYJ4A5X1", + }, + { + order_id: "CAISENgvlJ6jLWAzERDzjyHVybY", + version: 1, + location_id: "18YC4JDH91E1H", + }, + { + order_id: "CAISEM52YcpmcWAzERDOyiWS3ty", + version: 1, + location_id: "057P5VYJ4A5X1", + }, + ], + orders: [ + { + id: "id", + location_id: "location_id", + reference_id: "reference_id", + customer_id: "customer_id", + line_items: [ + { + quantity: "quantity", + }, + ], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + created_at: "created_at", + updated_at: "updated_at", + closed_at: "closed_at", + state: "OPEN", + version: 1, + ticket_name: "ticket_name", + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + }, + ], + cursor: "123", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + order: { + id: "CAISENgvlJ6jLWAzERDzjyHVybY", + location_id: "D7AVYMEAPJ3A3", + reference_id: "reference_id", + source: { name: "name" }, + customer_id: "customer_id", + line_items: [ + { + uid: "ULkg0tQTRK2bkU9fNv3IJD", + name: "Item 1", + quantity: "1", + applied_discounts: [ + { + uid: "9zr9S4dxvPAixvn0lpa1VC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { amount: BigInt(250), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(500), currency: "USD" }, + variation_total_price_money: { amount: BigInt(500), currency: "USD" }, + gross_sales_money: { amount: BigInt(500), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(250), currency: "USD" }, + total_money: { amount: BigInt(250), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + { + uid: "mumY8Nun4BC5aKe2yyx5a", + name: "Item 2", + quantity: "2", + applied_discounts: [ + { + uid: "qa8LwwZK82FgSEkQc2HYVC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { amount: BigInt(300), currency: "USD" }, + }, + ], + base_price_money: { amount: BigInt(300), currency: "USD" }, + variation_total_price_money: { amount: BigInt(600), currency: "USD" }, + gross_sales_money: { amount: BigInt(600), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(300), currency: "USD" }, + total_money: { amount: BigInt(300), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + taxes: [{}], + discounts: [ + { + uid: "zGsRZP69aqSSR9lq9euSPB", + name: "50% Off", + type: "FIXED_PERCENTAGE", + percentage: "50", + applied_money: { amount: BigInt(550), currency: "USD" }, + scope: "ORDER", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { amount: BigInt(550), currency: "USD" }, + tax_money: { amount: BigInt(0), currency: "USD" }, + discount_money: { amount: BigInt(550), currency: "USD" }, + tip_money: { amount: BigInt(0), currency: "USD" }, + service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + rounding_adjustment: { uid: "uid", name: "name" }, + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + metadata: { key: "value" }, + created_at: "2020-05-18T16:30:49.614Z", + updated_at: "2020-05-18T16:30:49.614Z", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { amount: BigInt(550), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(550), currency: "USD" }, + total_tip_money: { amount: BigInt(0), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + ticket_name: "ticket_name", + pricing_options: { auto_apply_discounts: true, auto_apply_taxes: true }, + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + net_amount_due_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/orders/order_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.get({ + order_id: "order_id", + }); + expect(response).toEqual({ + order: { + id: "CAISENgvlJ6jLWAzERDzjyHVybY", + location_id: "D7AVYMEAPJ3A3", + reference_id: "reference_id", + source: { + name: "name", + }, + customer_id: "customer_id", + line_items: [ + { + uid: "ULkg0tQTRK2bkU9fNv3IJD", + name: "Item 1", + quantity: "1", + applied_discounts: [ + { + uid: "9zr9S4dxvPAixvn0lpa1VC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { + amount: BigInt("250"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("250"), + currency: "USD", + }, + total_money: { + amount: BigInt("250"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + { + uid: "mumY8Nun4BC5aKe2yyx5a", + name: "Item 2", + quantity: "2", + applied_discounts: [ + { + uid: "qa8LwwZK82FgSEkQc2HYVC", + discount_uid: "zGsRZP69aqSSR9lq9euSPB", + applied_money: { + amount: BigInt("300"), + currency: "USD", + }, + }, + ], + base_price_money: { + amount: BigInt("300"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("600"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("600"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("300"), + currency: "USD", + }, + total_money: { + amount: BigInt("300"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + taxes: [{}], + discounts: [ + { + uid: "zGsRZP69aqSSR9lq9euSPB", + name: "50% Off", + type: "FIXED_PERCENTAGE", + percentage: "50", + applied_money: { + amount: BigInt("550"), + currency: "USD", + }, + scope: "ORDER", + }, + ], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { + amount: BigInt("550"), + currency: "USD", + }, + tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + discount_money: { + amount: BigInt("550"), + currency: "USD", + }, + tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + rounding_adjustment: { + uid: "uid", + name: "name", + }, + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + metadata: { + key: "value", + }, + created_at: "2020-05-18T16:30:49.614Z", + updated_at: "2020-05-18T16:30:49.614Z", + closed_at: "closed_at", + state: "OPEN", + version: 1, + total_money: { + amount: BigInt("550"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("550"), + currency: "USD", + }, + total_tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + ticket_name: "ticket_name", + pricing_options: { + auto_apply_discounts: true, + auto_apply_taxes: true, + }, + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + net_amount_due_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + order: { + location_id: "location_id", + line_items: [ + { + uid: "cookie_uid", + name: "COOKIE", + quantity: "2", + base_price_money: { amount: BigInt(200), currency: "USD" }, + }, + ], + version: 1, + }, + fields_to_clear: ["discounts"], + idempotency_key: "UNIQUE_STRING", + }; + const rawResponseBody = { + order: { + id: "DREk7wJcyXNHqULq8JJ2iPAsluJZY", + location_id: "MXVQSVNDGN3C8", + reference_id: "reference_id", + source: { name: "Cookies" }, + customer_id: "customer_id", + line_items: [ + { + uid: "EuYkakhmu3ksHIds5Hiot", + name: "Small Coffee", + quantity: "1", + base_price_money: { amount: BigInt(500), currency: "USD" }, + variation_total_price_money: { amount: BigInt(500), currency: "USD" }, + gross_sales_money: { amount: BigInt(500), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_money: { amount: BigInt(500), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + { + uid: "cookie_uid", + name: "COOKIE", + quantity: "2", + base_price_money: { amount: BigInt(200), currency: "USD" }, + variation_total_price_money: { amount: BigInt(400), currency: "USD" }, + gross_sales_money: { amount: BigInt(400), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_money: { amount: BigInt(400), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { amount: BigInt(900), currency: "USD" }, + tax_money: { amount: BigInt(0), currency: "USD" }, + discount_money: { amount: BigInt(0), currency: "USD" }, + service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + rounding_adjustment: { uid: "uid", name: "name" }, + tenders: [{ type: "CARD" }], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + metadata: { key: "value" }, + created_at: "2019-08-23T18:26:18.243Z", + updated_at: "2019-08-23T18:33:47.523Z", + closed_at: "closed_at", + state: "OPEN", + version: 2, + total_money: { amount: BigInt(900), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + ticket_name: "ticket_name", + pricing_options: { auto_apply_discounts: true, auto_apply_taxes: true }, + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + net_amount_due_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/orders/order_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.update({ + order_id: "order_id", + order: { + location_id: "location_id", + line_items: [ + { + uid: "cookie_uid", + name: "COOKIE", + quantity: "2", + base_price_money: { + amount: BigInt("200"), + currency: "USD", + }, + }, + ], + version: 1, + }, + fields_to_clear: ["discounts"], + idempotency_key: "UNIQUE_STRING", + }); + expect(response).toEqual({ + order: { + id: "DREk7wJcyXNHqULq8JJ2iPAsluJZY", + location_id: "MXVQSVNDGN3C8", + reference_id: "reference_id", + source: { + name: "Cookies", + }, + customer_id: "customer_id", + line_items: [ + { + uid: "EuYkakhmu3ksHIds5Hiot", + name: "Small Coffee", + quantity: "1", + base_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_money: { + amount: BigInt("500"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + { + uid: "cookie_uid", + name: "COOKIE", + quantity: "2", + base_price_money: { + amount: BigInt("200"), + currency: "USD", + }, + variation_total_price_money: { + amount: BigInt("400"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("400"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_money: { + amount: BigInt("400"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { + amount: BigInt("900"), + currency: "USD", + }, + tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + rounding_adjustment: { + uid: "uid", + name: "name", + }, + tenders: [ + { + type: "CARD", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + metadata: { + key: "value", + }, + created_at: "2019-08-23T18:26:18.243Z", + updated_at: "2019-08-23T18:33:47.523Z", + closed_at: "closed_at", + state: "OPEN", + version: 2, + total_money: { + amount: BigInt("900"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + ticket_name: "ticket_name", + pricing_options: { + auto_apply_discounts: true, + auto_apply_taxes: true, + }, + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + net_amount_due_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("pay", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + payment_ids: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"], + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + order: { + id: "lgwOlEityYPJtcuvKTVKT1pA986YY", + location_id: "P3CCK6HSNDAS7", + reference_id: "reference_id", + source: { name: "Source Name" }, + customer_id: "customer_id", + line_items: [ + { + uid: "QW6kofLHJK7JEKMjlSVP5C", + name: "Item 1", + quantity: "1", + base_price_money: { amount: BigInt(500), currency: "USD" }, + gross_sales_money: { amount: BigInt(500), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_money: { amount: BigInt(500), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + { + uid: "zhw8MNfRGdFQMI2WE1UBJD", + name: "Item 2", + quantity: "2", + base_price_money: { amount: BigInt(750), currency: "USD" }, + gross_sales_money: { amount: BigInt(1500), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_money: { amount: BigInt(1500), currency: "USD" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + ], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { amount: BigInt(2000), currency: "USD" }, + tax_money: { amount: BigInt(0), currency: "USD" }, + discount_money: { amount: BigInt(0), currency: "USD" }, + tip_money: { amount: BigInt(0), currency: "USD" }, + service_charge_money: { amount: BigInt(0), currency: "USD" }, + }, + rounding_adjustment: { uid: "uid", name: "name" }, + tenders: [ + { + id: "EnZdNAlWCmfh6Mt5FMNST1o7taB", + location_id: "P3CCK6HSNDAS7", + transaction_id: "lgwOlEityYPJtcuvKTVKT1pA986YY", + created_at: "2019-08-06T02:47:36.293Z", + amount_money: { amount: BigInt(1000), currency: "USD" }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(2), + exp_year: BigInt(2022), + fingerprint: "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ", + }, + entry_method: "KEYED", + }, + payment_id: "EnZdNAlWCmfh6Mt5FMNST1o7taB", + }, + { + id: "0LRiVlbXVwe8ozu4KbZxd12mvaB", + location_id: "P3CCK6HSNDAS7", + transaction_id: "lgwOlEityYPJtcuvKTVKT1pA986YY", + created_at: "2019-08-06T02:47:36.809Z", + amount_money: { amount: BigInt(1000), currency: "USD" }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(2), + exp_year: BigInt(2022), + fingerprint: "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ", + }, + entry_method: "KEYED", + }, + payment_id: "0LRiVlbXVwe8ozu4KbZxd12mvaB", + }, + ], + refunds: [ + { id: "id", location_id: "location_id", reason: "reason", amount_money: {}, status: "PENDING" }, + ], + metadata: { key: "value" }, + created_at: "2019-08-06T02:47:35.693Z", + updated_at: "2019-08-06T02:47:37.140Z", + closed_at: "2019-08-06T02:47:37.140Z", + state: "COMPLETED", + version: 4, + total_money: { amount: BigInt(2000), currency: "USD" }, + total_tax_money: { amount: BigInt(0), currency: "USD" }, + total_discount_money: { amount: BigInt(0), currency: "USD" }, + total_tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + total_service_charge_money: { amount: BigInt(0), currency: "USD" }, + ticket_name: "ticket_name", + pricing_options: { auto_apply_discounts: true, auto_apply_taxes: true }, + rewards: [{ id: "id", reward_tier_id: "reward_tier_id" }], + net_amount_due_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + }; + server + .mockEndpoint() + .post("/v2/orders/order_id/pay") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.pay({ + order_id: "order_id", + idempotency_key: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + payment_ids: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + order: { + id: "lgwOlEityYPJtcuvKTVKT1pA986YY", + location_id: "P3CCK6HSNDAS7", + reference_id: "reference_id", + source: { + name: "Source Name", + }, + customer_id: "customer_id", + line_items: [ + { + uid: "QW6kofLHJK7JEKMjlSVP5C", + name: "Item 1", + quantity: "1", + base_price_money: { + amount: BigInt("500"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_money: { + amount: BigInt("500"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + { + uid: "zhw8MNfRGdFQMI2WE1UBJD", + name: "Item 2", + quantity: "2", + base_price_money: { + amount: BigInt("750"), + currency: "USD", + }, + gross_sales_money: { + amount: BigInt("1500"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_money: { + amount: BigInt("1500"), + currency: "USD", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + ], + taxes: [{}], + discounts: [{}], + service_charges: [{}], + fulfillments: [{}], + returns: [{}], + net_amounts: { + total_money: { + amount: BigInt("2000"), + currency: "USD", + }, + tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + tip_money: { + amount: BigInt("0"), + currency: "USD", + }, + service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + }, + rounding_adjustment: { + uid: "uid", + name: "name", + }, + tenders: [ + { + id: "EnZdNAlWCmfh6Mt5FMNST1o7taB", + location_id: "P3CCK6HSNDAS7", + transaction_id: "lgwOlEityYPJtcuvKTVKT1pA986YY", + created_at: "2019-08-06T02:47:36.293Z", + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("2"), + exp_year: BigInt("2022"), + fingerprint: "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ", + }, + entry_method: "KEYED", + }, + payment_id: "EnZdNAlWCmfh6Mt5FMNST1o7taB", + }, + { + id: "0LRiVlbXVwe8ozu4KbZxd12mvaB", + location_id: "P3CCK6HSNDAS7", + transaction_id: "lgwOlEityYPJtcuvKTVKT1pA986YY", + created_at: "2019-08-06T02:47:36.809Z", + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("2"), + exp_year: BigInt("2022"), + fingerprint: "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ", + }, + entry_method: "KEYED", + }, + payment_id: "0LRiVlbXVwe8ozu4KbZxd12mvaB", + }, + ], + refunds: [ + { + id: "id", + location_id: "location_id", + reason: "reason", + amount_money: {}, + status: "PENDING", + }, + ], + metadata: { + key: "value", + }, + created_at: "2019-08-06T02:47:35.693Z", + updated_at: "2019-08-06T02:47:37.140Z", + closed_at: "2019-08-06T02:47:37.140Z", + state: "COMPLETED", + version: 4, + total_money: { + amount: BigInt("2000"), + currency: "USD", + }, + total_tax_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_discount_money: { + amount: BigInt("0"), + currency: "USD", + }, + total_tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + total_service_charge_money: { + amount: BigInt("0"), + currency: "USD", + }, + ticket_name: "ticket_name", + pricing_options: { + auto_apply_discounts: true, + auto_apply_taxes: true, + }, + rewards: [ + { + id: "id", + reward_tier_id: "reward_tier_id", + }, + ], + net_amount_due_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + }); + }); +}); diff --git a/tests/wire/orders/customAttributeDefinitions.test.ts b/tests/wire/orders/customAttributeDefinitions.test.ts new file mode 100644 index 000000000..a6acb0336 --- /dev/null +++ b/tests/wire/orders/customAttributeDefinitions.test.ts @@ -0,0 +1,231 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributeDefinitions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { + 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", + }, + idempotency_key: "IDEMPOTENCY_KEY", + }; + const rawResponseBody = { + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-10-06T16:53:23.141Z", + created_at: "2022-10-06T16:53:23.141Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/orders/custom-attribute-definitions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributeDefinitions.create({ + custom_attribute_definition: { + 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", + }, + idempotency_key: "IDEMPOTENCY_KEY", + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-10-06T16:53:23.141Z", + created_at: "2022-10-06T16:53:23.141Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-10-06T16:53:23.141Z", + created_at: "2022-10-06T16:53:23.141Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/orders/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributeDefinitions.get({ + key: "key", + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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", + version: 1, + updated_at: "2022-10-06T16:53:23.141Z", + created_at: "2022-10-06T16:53:23.141Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + custom_attribute_definition: { key: "cover-count", visibility: "VISIBILITY_READ_ONLY", version: 1 }, + idempotency_key: "IDEMPOTENCY_KEY", + }; + const rawResponseBody = { + custom_attribute_definition: { + 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_ONLY", + version: 2, + updated_at: "2022-11-16T17:44:11.436Z", + created_at: "2022-11-16T16:53:23.141Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/orders/custom-attribute-definitions/key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributeDefinitions.update({ + key: "key", + custom_attribute_definition: { + key: "cover-count", + visibility: "VISIBILITY_READ_ONLY", + version: 1, + }, + idempotency_key: "IDEMPOTENCY_KEY", + }); + expect(response).toEqual({ + custom_attribute_definition: { + 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_ONLY", + version: 2, + updated_at: "2022-11-16T17:44:11.436Z", + created_at: "2022-11-16T16:53:23.141Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/orders/custom-attribute-definitions/key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributeDefinitions.delete({ + key: "key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/orders/customAttributes.test.ts b/tests/wire/orders/customAttributes.test.ts new file mode 100644 index 000000000..5be5c0d0f --- /dev/null +++ b/tests/wire/orders/customAttributes.test.ts @@ -0,0 +1,363 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("CustomAttributes", () => { + test("batchDelete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + values: { + "cover-count": { key: "cover-count", order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" }, + "table-number": { key: "table-number", order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + values: { + "cover-count": { errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }] }, + "table-number": { errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }] }, + }, + }; + server + .mockEndpoint() + .post("/v2/orders/custom-attributes/bulk-delete") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributes.batchDelete({ + values: { + "cover-count": { + key: "cover-count", + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + "table-number": { + key: "table-number", + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + values: { + "cover-count": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + "table-number": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + }); + }); + + test("batchUpsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + values: { + "cover-count": { + custom_attribute: { key: "cover-count", value: "6", version: 2 }, + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + "table-number": { + custom_attribute: { key: "table-number", value: "11", version: 4 }, + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + values: { + "cover-count": { + custom_attribute: { + key: "cover-count", + value: "6", + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-22T21:28:35.721Z", + created_at: "2022-11-22T21:27:33.429Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + "table-number": { + custom_attribute: { + key: "table-number", + value: "11", + visibility: "VISIBILITY_HIDDEN", + updated_at: "2022-11-22T21:28:35.726Z", + created_at: "2022-11-22T21:24:57.823Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + }; + server + .mockEndpoint() + .post("/v2/orders/custom-attributes/bulk-upsert") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributes.batchUpsert({ + values: { + "cover-count": { + custom_attribute: { + key: "cover-count", + value: "6", + version: 2, + }, + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + "table-number": { + custom_attribute: { + key: "table-number", + value: "11", + version: 4, + }, + order_id: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + values: { + "cover-count": { + custom_attribute: { + key: "cover-count", + value: "6", + visibility: "VISIBILITY_READ_WRITE_VALUES", + updated_at: "2022-11-22T21:28:35.721Z", + created_at: "2022-11-22T21:27:33.429Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + "table-number": { + custom_attribute: { + key: "table-number", + value: "11", + visibility: "VISIBILITY_HIDDEN", + updated_at: "2022-11-22T21:28:35.726Z", + created_at: "2022-11-22T21:24:57.823Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + custom_attribute: { + key: "cover-count", + value: "6", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-11-22T21:28:35.721Z", + created_at: "2022-11-22T21:27:33.429Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/orders/order_id/custom-attributes/custom_attribute_key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributes.get({ + order_id: "order_id", + custom_attribute_key: "custom_attribute_key", + }); + expect(response).toEqual({ + custom_attribute: { + key: "cover-count", + value: "6", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-11-22T21:28:35.721Z", + created_at: "2022-11-22T21:27:33.429Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("upsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { custom_attribute: { key: "table-number", value: "42", version: 1 } }; + const rawResponseBody = { + custom_attribute: { + key: "table-number", + value: "42", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { key: "value" }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-10-06T20:41:22.673Z", + created_at: "2022-10-06T20:41:22.673Z", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/orders/order_id/custom-attributes/custom_attribute_key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributes.upsert({ + order_id: "order_id", + custom_attribute_key: "custom_attribute_key", + custom_attribute: { + key: "table-number", + value: "42", + version: 1, + }, + }); + expect(response).toEqual({ + custom_attribute: { + key: "table-number", + value: "42", + version: 1, + visibility: "VISIBILITY_READ_WRITE_VALUES", + definition: { + key: "key", + schema: { + key: "value", + }, + name: "name", + description: "description", + visibility: "VISIBILITY_HIDDEN", + version: 1, + updated_at: "updated_at", + created_at: "created_at", + }, + updated_at: "2022-10-06T20:41:22.673Z", + created_at: "2022-10-06T20:41:22.673Z", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/orders/order_id/custom-attributes/custom_attribute_key") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.orders.customAttributes.delete({ + order_id: "order_id", + custom_attribute_key: "custom_attribute_key", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/payments.test.ts b/tests/wire/payments.test.ts new file mode 100644 index 000000000..79e8396da --- /dev/null +++ b/tests/wire/payments.test.ts @@ -0,0 +1,1726 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Payments", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + source_id: "ccof:GaJGNaZa8x4OgDJn4GB", + idempotency_key: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + amount_money: { amount: BigInt(1000), currency: "USD" }, + app_fee_money: { amount: BigInt(10), currency: "USD" }, + autocomplete: true, + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + location_id: "L88917AVBK2S5", + reference_id: "123456", + note: "Brief description", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment: { + id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + created_at: "2021-10-13T21:14:29.577Z", + updated_at: "2021-10-13T21:14:30.504Z", + amount_money: { amount: BigInt(1000), currency: "USD" }, + tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + total_money: { amount: BigInt(1000), currency: "USD" }, + app_fee_money: { amount: BigInt(10), currency: "USD" }, + approved_money: { amount: BigInt(1000), currency: "USD" }, + processing_fee: [{}], + refunded_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "COMPLETED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T21:14:29.577Z", + source_type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "ON_FILE", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "vNEn2f", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T21:14:29.732Z", + captured_at: "2021-10-13T21:14:30.504Z", + }, + refund_requires_card_presence: true, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + cash_details: { buyer_supplied_money: {} }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + external_details: { type: "type", source: "source", source_id: "source_id" }, + wallet_details: { status: "status", brand: "brand" }, + buy_now_pay_later_details: { brand: "brand" }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + location_id: "L88917AVBK2S5", + order_id: "pRsjRTgFWATl7so6DxdKBJa7ssbZY", + reference_id: "123456", + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + employee_id: "employee_id", + team_member_id: "team_member_id", + refund_ids: ["refund_ids"], + risk_evaluation: { created_at: "2021-10-13T21:14:30.423Z", risk_level: "NORMAL" }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Brief Description", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "R2B3", + receipt_url: "https://squareup.com/receipt/preview/EXAMPLE_RECEIPT_ID", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "ECOMMERCE_API", + application_id: "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", + }, + is_offline_payment: true, + offline_payment_details: { client_created_at: "client_created_at" }, + version_token: "TPtNEOBOa6Qq6E3C3IjckSVOM6b3hMbfhjvTxHBQUsB6o", + }, + }; + server + .mockEndpoint() + .post("/v2/payments") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.payments.create({ + source_id: "ccof:GaJGNaZa8x4OgDJn4GB", + idempotency_key: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("10"), + currency: "USD", + }, + autocomplete: true, + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + location_id: "L88917AVBK2S5", + reference_id: "123456", + note: "Brief description", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment: { + id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + created_at: "2021-10-13T21:14:29.577Z", + updated_at: "2021-10-13T21:14:30.504Z", + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + total_money: { + amount: BigInt("1000"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("10"), + currency: "USD", + }, + approved_money: { + amount: BigInt("1000"), + currency: "USD", + }, + processing_fee: [{}], + refunded_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "COMPLETED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T21:14:29.577Z", + source_type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "ON_FILE", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "vNEn2f", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T21:14:29.732Z", + captured_at: "2021-10-13T21:14:30.504Z", + }, + refund_requires_card_presence: true, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + cash_details: { + buyer_supplied_money: {}, + }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + external_details: { + type: "type", + source: "source", + source_id: "source_id", + }, + wallet_details: { + status: "status", + brand: "brand", + }, + buy_now_pay_later_details: { + brand: "brand", + }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + location_id: "L88917AVBK2S5", + order_id: "pRsjRTgFWATl7so6DxdKBJa7ssbZY", + reference_id: "123456", + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + employee_id: "employee_id", + team_member_id: "team_member_id", + refund_ids: ["refund_ids"], + risk_evaluation: { + created_at: "2021-10-13T21:14:30.423Z", + risk_level: "NORMAL", + }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Brief Description", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "R2B3", + receipt_url: "https://squareup.com/receipt/preview/EXAMPLE_RECEIPT_ID", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "ECOMMERCE_API", + application_id: "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", + }, + is_offline_payment: true, + offline_payment_details: { + client_created_at: "client_created_at", + }, + version_token: "TPtNEOBOa6Qq6E3C3IjckSVOM6b3hMbfhjvTxHBQUsB6o", + }, + }); + }); + + test("cancelByIdempotencyKey", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { idempotency_key: "a7e36d40-d24b-11e8-b568-0800200c9a66" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/payments/cancel") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.payments.cancelByIdempotencyKey({ + idempotency_key: "a7e36d40-d24b-11e8-b568-0800200c9a66", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment: { + id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + created_at: "2021-10-13T19:34:33.524Z", + updated_at: "2021-10-13T19:34:34.339Z", + amount_money: { amount: BigInt(555), currency: "USD" }, + tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + total_money: { amount: BigInt(555), currency: "USD" }, + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + approved_money: { amount: BigInt(555), currency: "USD" }, + processing_fee: [ + { + effective_at: "2021-10-13T21:34:35.000Z", + type: "INITIAL", + amount_money: { amount: BigInt(34), currency: "USD" }, + }, + ], + refunded_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "COMPLETED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T19:34:33.524Z", + source_type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "KEYED", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "2Nkw7q", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T19:34:33.680Z", + captured_at: "2021-10-13T19:34:34.340Z", + }, + refund_requires_card_presence: true, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + cash_details: { buyer_supplied_money: {} }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + external_details: { type: "type", source: "source", source_id: "source_id" }, + wallet_details: { status: "status", brand: "brand" }, + buy_now_pay_later_details: { brand: "brand" }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + location_id: "L88917AVBK2S5", + order_id: "d7eKah653Z579f3gVtjlxpSlmUcZY", + reference_id: "reference_id", + customer_id: "customer_id", + employee_id: "TMoK_ogh6rH1o4dV", + team_member_id: "TMoK_ogh6rH1o4dV", + refund_ids: ["refund_ids"], + risk_evaluation: { created_at: "created_at", risk_level: "PENDING" }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Test Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "bP9m", + receipt_url: "https://squareup.com/receipt/preview/bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "VIRTUAL_TERMINAL", + application_id: "sq0ids-Pw67AZAlLVB7hsRmwlJPuA", + }, + is_offline_payment: true, + offline_payment_details: { client_created_at: "client_created_at" }, + version_token: "56pRkL3slrzet2iQrTp9n0bdJVYTB9YEWdTNjQfZOPV6o", + }, + }; + server + .mockEndpoint() + .get("/v2/payments/payment_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.payments.get({ + payment_id: "payment_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment: { + id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + created_at: "2021-10-13T19:34:33.524Z", + updated_at: "2021-10-13T19:34:34.339Z", + amount_money: { + amount: BigInt("555"), + currency: "USD", + }, + tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + total_money: { + amount: BigInt("555"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + approved_money: { + amount: BigInt("555"), + currency: "USD", + }, + processing_fee: [ + { + effective_at: "2021-10-13T21:34:35.000Z", + type: "INITIAL", + amount_money: { + amount: BigInt("34"), + currency: "USD", + }, + }, + ], + refunded_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "COMPLETED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T19:34:33.524Z", + source_type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "KEYED", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "2Nkw7q", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T19:34:33.680Z", + captured_at: "2021-10-13T19:34:34.340Z", + }, + refund_requires_card_presence: true, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + cash_details: { + buyer_supplied_money: {}, + }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + external_details: { + type: "type", + source: "source", + source_id: "source_id", + }, + wallet_details: { + status: "status", + brand: "brand", + }, + buy_now_pay_later_details: { + brand: "brand", + }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + location_id: "L88917AVBK2S5", + order_id: "d7eKah653Z579f3gVtjlxpSlmUcZY", + reference_id: "reference_id", + customer_id: "customer_id", + employee_id: "TMoK_ogh6rH1o4dV", + team_member_id: "TMoK_ogh6rH1o4dV", + refund_ids: ["refund_ids"], + risk_evaluation: { + created_at: "created_at", + risk_level: "PENDING", + }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Test Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "bP9m", + receipt_url: "https://squareup.com/receipt/preview/bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "VIRTUAL_TERMINAL", + application_id: "sq0ids-Pw67AZAlLVB7hsRmwlJPuA", + }, + is_offline_payment: true, + offline_payment_details: { + client_created_at: "client_created_at", + }, + version_token: "56pRkL3slrzet2iQrTp9n0bdJVYTB9YEWdTNjQfZOPV6o", + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + payment: { + amount_money: { amount: BigInt(1000), currency: "USD" }, + tip_money: { amount: BigInt(100), currency: "USD" }, + version_token: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o", + }, + idempotency_key: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment: { + id: "1QjqpBVyrI9S4H9sTGDWU9JeiWdZY", + created_at: "2021-10-13T20:26:44.191Z", + updated_at: "2021-10-13T20:26:44.364Z", + amount_money: { amount: BigInt(1000), currency: "USD" }, + tip_money: { amount: BigInt(100), currency: "USD" }, + total_money: { amount: BigInt(1100), currency: "USD" }, + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + approved_money: { amount: BigInt(1000), currency: "USD" }, + processing_fee: [{}], + refunded_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "APPROVED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T20:26:44.191Z", + source_type: "CARD", + card_details: { + status: "AUTHORIZED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "ON_FILE", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "68aLBM", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { authorized_at: "2021-10-13T20:26:44.364Z" }, + refund_requires_card_presence: true, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + cash_details: { buyer_supplied_money: {} }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + external_details: { type: "type", source: "source", source_id: "source_id" }, + wallet_details: { status: "status", brand: "brand" }, + buy_now_pay_later_details: { brand: "brand" }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + location_id: "L88917AVBK2S5", + order_id: "nUSN9TdxpiK3SrQg3wzmf6r8LP9YY", + reference_id: "reference_id", + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + employee_id: "employee_id", + team_member_id: "team_member_id", + refund_ids: ["refund_ids"], + risk_evaluation: { created_at: "2021-10-13T20:26:45.271Z", risk_level: "NORMAL" }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Example Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["EDIT_AMOUNT_UP", "EDIT_AMOUNT_DOWN", "EDIT_TIP_AMOUNT_UP", "EDIT_TIP_AMOUNT_DOWN"], + receipt_number: "1Qjq", + receipt_url: "receipt_url", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "ECOMMERCE_API", + application_id: "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", + }, + is_offline_payment: true, + offline_payment_details: { client_created_at: "client_created_at" }, + version_token: "rDrXnqiS7fJgexccgdpzmwqTiXui1aIKCp9EchZ7trE6o", + }, + }; + server + .mockEndpoint() + .put("/v2/payments/payment_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.payments.update({ + payment_id: "payment_id", + payment: { + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + tip_money: { + amount: BigInt("100"), + currency: "USD", + }, + version_token: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o", + }, + idempotency_key: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment: { + id: "1QjqpBVyrI9S4H9sTGDWU9JeiWdZY", + created_at: "2021-10-13T20:26:44.191Z", + updated_at: "2021-10-13T20:26:44.364Z", + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + tip_money: { + amount: BigInt("100"), + currency: "USD", + }, + total_money: { + amount: BigInt("1100"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + approved_money: { + amount: BigInt("1000"), + currency: "USD", + }, + processing_fee: [{}], + refunded_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "APPROVED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T20:26:44.191Z", + source_type: "CARD", + card_details: { + status: "AUTHORIZED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "ON_FILE", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "68aLBM", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T20:26:44.364Z", + }, + refund_requires_card_presence: true, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + cash_details: { + buyer_supplied_money: {}, + }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + external_details: { + type: "type", + source: "source", + source_id: "source_id", + }, + wallet_details: { + status: "status", + brand: "brand", + }, + buy_now_pay_later_details: { + brand: "brand", + }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + location_id: "L88917AVBK2S5", + order_id: "nUSN9TdxpiK3SrQg3wzmf6r8LP9YY", + reference_id: "reference_id", + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + employee_id: "employee_id", + team_member_id: "team_member_id", + refund_ids: ["refund_ids"], + risk_evaluation: { + created_at: "2021-10-13T20:26:45.271Z", + risk_level: "NORMAL", + }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Example Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["EDIT_AMOUNT_UP", "EDIT_AMOUNT_DOWN", "EDIT_TIP_AMOUNT_UP", "EDIT_TIP_AMOUNT_DOWN"], + receipt_number: "1Qjq", + receipt_url: "receipt_url", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "ECOMMERCE_API", + application_id: "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", + }, + is_offline_payment: true, + offline_payment_details: { + client_created_at: "client_created_at", + }, + version_token: "rDrXnqiS7fJgexccgdpzmwqTiXui1aIKCp9EchZ7trE6o", + }, + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment: { + id: "1QjqpBVyrI9S4H9sTGDWU9JeiWdZY", + created_at: "2021-10-13T20:26:44.191Z", + updated_at: "2021-10-13T20:31:21.597Z", + amount_money: { amount: BigInt(1000), currency: "USD" }, + tip_money: { amount: BigInt(100), currency: "USD" }, + total_money: { amount: BigInt(1100), currency: "USD" }, + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + approved_money: { amount: BigInt(1000), currency: "USD" }, + processing_fee: [{}], + refunded_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "CANCELED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T20:26:44.191Z", + source_type: "CARD", + card_details: { + status: "VOIDED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "ON_FILE", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "68aLBM", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T20:26:44.364Z", + voided_at: "2021-10-13T20:31:21.597Z", + }, + refund_requires_card_presence: true, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + cash_details: { buyer_supplied_money: {} }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + external_details: { type: "type", source: "source", source_id: "source_id" }, + wallet_details: { status: "status", brand: "brand" }, + buy_now_pay_later_details: { brand: "brand" }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + location_id: "L88917AVBK2S5", + order_id: "nUSN9TdxpiK3SrQg3wzmf6r8LP9YY", + reference_id: "reference_id", + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + employee_id: "employee_id", + team_member_id: "team_member_id", + refund_ids: ["refund_ids"], + risk_evaluation: { created_at: "2021-10-13T20:26:45.271Z", risk_level: "NORMAL" }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Example Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "receipt_number", + receipt_url: "receipt_url", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "ECOMMERCE_API", + application_id: "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", + }, + is_offline_payment: true, + offline_payment_details: { client_created_at: "client_created_at" }, + version_token: "N8AGYgEjCiY9Q57Jw7aVHEpBq8bzGCDCQMRX8Vs56N06o", + }, + }; + server + .mockEndpoint() + .post("/v2/payments/payment_id/cancel") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.payments.cancel({ + payment_id: "payment_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment: { + id: "1QjqpBVyrI9S4H9sTGDWU9JeiWdZY", + created_at: "2021-10-13T20:26:44.191Z", + updated_at: "2021-10-13T20:31:21.597Z", + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + tip_money: { + amount: BigInt("100"), + currency: "USD", + }, + total_money: { + amount: BigInt("1100"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + approved_money: { + amount: BigInt("1000"), + currency: "USD", + }, + processing_fee: [{}], + refunded_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "CANCELED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T20:26:44.191Z", + source_type: "CARD", + card_details: { + status: "VOIDED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "ON_FILE", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "68aLBM", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T20:26:44.364Z", + voided_at: "2021-10-13T20:31:21.597Z", + }, + refund_requires_card_presence: true, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + cash_details: { + buyer_supplied_money: {}, + }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + external_details: { + type: "type", + source: "source", + source_id: "source_id", + }, + wallet_details: { + status: "status", + brand: "brand", + }, + buy_now_pay_later_details: { + brand: "brand", + }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + location_id: "L88917AVBK2S5", + order_id: "nUSN9TdxpiK3SrQg3wzmf6r8LP9YY", + reference_id: "reference_id", + customer_id: "W92WH6P11H4Z77CTET0RNTGFW8", + employee_id: "employee_id", + team_member_id: "team_member_id", + refund_ids: ["refund_ids"], + risk_evaluation: { + created_at: "2021-10-13T20:26:45.271Z", + risk_level: "NORMAL", + }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Example Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "receipt_number", + receipt_url: "receipt_url", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "ECOMMERCE_API", + application_id: "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", + }, + is_offline_payment: true, + offline_payment_details: { + client_created_at: "client_created_at", + }, + version_token: "N8AGYgEjCiY9Q57Jw7aVHEpBq8bzGCDCQMRX8Vs56N06o", + }, + }); + }); + + test("complete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + payment: { + id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + created_at: "2021-10-13T19:34:33.524Z", + updated_at: "2021-10-13T19:34:34.339Z", + amount_money: { amount: BigInt(555), currency: "USD" }, + tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + total_money: { amount: BigInt(555), currency: "USD" }, + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + approved_money: { amount: BigInt(555), currency: "USD" }, + processing_fee: [ + { + effective_at: "2021-10-13T21:34:35.000Z", + type: "INITIAL", + amount_money: { amount: BigInt(34), currency: "USD" }, + }, + ], + refunded_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + status: "COMPLETED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T19:34:33.524Z", + source_type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt(11), + exp_year: BigInt(2022), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "KEYED", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "2Nkw7q", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T19:34:33.680Z", + captured_at: "2021-10-13T19:34:34.340Z", + }, + refund_requires_card_presence: true, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + cash_details: { buyer_supplied_money: {} }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + external_details: { type: "type", source: "source", source_id: "source_id" }, + wallet_details: { status: "status", brand: "brand" }, + buy_now_pay_later_details: { brand: "brand" }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + location_id: "L88917AVBK2S5", + order_id: "d7eKah653Z579f3gVtjlxpSlmUcZY", + reference_id: "reference_id", + customer_id: "customer_id", + employee_id: "TMoK_ogh6rH1o4dV", + team_member_id: "TMoK_ogh6rH1o4dV", + refund_ids: ["refund_ids"], + risk_evaluation: { created_at: "created_at", risk_level: "PENDING" }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Test Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "bP9m", + receipt_url: "https://squareup.com/receipt/preview/bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "VIRTUAL_TERMINAL", + application_id: "sq0ids-Pw67AZAlLVB7hsRmwlJPuA", + }, + is_offline_payment: true, + offline_payment_details: { client_created_at: "client_created_at" }, + version_token: "56pRkL3slrzet2iQrTp9n0bdJVYTB9YEWdTNjQfZOPV6o", + }, + }; + server + .mockEndpoint() + .post("/v2/payments/payment_id/complete") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.payments.complete({ + payment_id: "payment_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + payment: { + id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + created_at: "2021-10-13T19:34:33.524Z", + updated_at: "2021-10-13T19:34:34.339Z", + amount_money: { + amount: BigInt("555"), + currency: "USD", + }, + tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + total_money: { + amount: BigInt("555"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + approved_money: { + amount: BigInt("555"), + currency: "USD", + }, + processing_fee: [ + { + effective_at: "2021-10-13T21:34:35.000Z", + type: "INITIAL", + amount_money: { + amount: BigInt("34"), + currency: "USD", + }, + }, + ], + refunded_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + status: "COMPLETED", + delay_duration: "PT168H", + delay_action: "CANCEL", + delayed_until: "2021-10-20T19:34:33.524Z", + source_type: "CARD", + card_details: { + status: "CAPTURED", + card: { + card_brand: "VISA", + last_4: "1111", + exp_month: BigInt("11"), + exp_year: BigInt("2022"), + fingerprint: "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", + card_type: "DEBIT", + prepaid_type: "NOT_PREPAID", + bin: "411111", + }, + entry_method: "KEYED", + cvv_status: "CVV_ACCEPTED", + avs_status: "AVS_ACCEPTED", + auth_result_code: "2Nkw7q", + application_identifier: "application_identifier", + application_name: "application_name", + application_cryptogram: "application_cryptogram", + verification_method: "verification_method", + verification_results: "verification_results", + statement_description: "SQ *EXAMPLE TEST GOSQ.C", + card_payment_timeline: { + authorized_at: "2021-10-13T19:34:33.680Z", + captured_at: "2021-10-13T19:34:34.340Z", + }, + refund_requires_card_presence: true, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + cash_details: { + buyer_supplied_money: {}, + }, + bank_account_details: { + bank_name: "bank_name", + transfer_type: "transfer_type", + account_ownership_type: "account_ownership_type", + fingerprint: "fingerprint", + country: "country", + statement_description: "statement_description", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + external_details: { + type: "type", + source: "source", + source_id: "source_id", + }, + wallet_details: { + status: "status", + brand: "brand", + }, + buy_now_pay_later_details: { + brand: "brand", + }, + square_account_details: { + payment_source_token: "payment_source_token", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + location_id: "L88917AVBK2S5", + order_id: "d7eKah653Z579f3gVtjlxpSlmUcZY", + reference_id: "reference_id", + customer_id: "customer_id", + employee_id: "TMoK_ogh6rH1o4dV", + team_member_id: "TMoK_ogh6rH1o4dV", + refund_ids: ["refund_ids"], + risk_evaluation: { + created_at: "created_at", + risk_level: "PENDING", + }, + terminal_checkout_id: "terminal_checkout_id", + buyer_email_address: "buyer_email_address", + billing_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + note: "Test Note", + statement_description_identifier: "statement_description_identifier", + capabilities: ["capabilities"], + receipt_number: "bP9m", + receipt_url: "https://squareup.com/receipt/preview/bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + device_details: { + device_id: "device_id", + device_installation_id: "device_installation_id", + device_name: "device_name", + }, + application_details: { + square_product: "VIRTUAL_TERMINAL", + application_id: "sq0ids-Pw67AZAlLVB7hsRmwlJPuA", + }, + is_offline_payment: true, + offline_payment_details: { + client_created_at: "client_created_at", + }, + version_token: "56pRkL3slrzet2iQrTp9n0bdJVYTB9YEWdTNjQfZOPV6o", + }, + }); + }); +}); diff --git a/tests/wire/payouts.test.ts b/tests/wire/payouts.test.ts new file mode 100644 index 000000000..840559179 --- /dev/null +++ b/tests/wire/payouts.test.ts @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Payouts", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + payout: { + id: "po_f3c0fb38-a5ce-427d-b858-52b925b72e45", + status: "PAID", + location_id: "L88917AVBK2S5", + created_at: "2022-03-24T03:07:09Z", + updated_at: "2022-03-24T03:07:09Z", + amount_money: { amount: BigInt(-103), currency: "UNKNOWN_CURRENCY" }, + destination: { type: "BANK_ACCOUNT", id: "bact:ZPp3oedR3AeEUNd3z7" }, + version: 1, + type: "BATCH", + payout_fee: [{}], + arrival_date: "2022-03-24", + end_to_end_id: "end_to_end_id", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/payouts/payout_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.payouts.get({ + payout_id: "payout_id", + }); + expect(response).toEqual({ + payout: { + id: "po_f3c0fb38-a5ce-427d-b858-52b925b72e45", + status: "PAID", + location_id: "L88917AVBK2S5", + created_at: "2022-03-24T03:07:09Z", + updated_at: "2022-03-24T03:07:09Z", + amount_money: { + amount: BigInt("-103"), + currency: "UNKNOWN_CURRENCY", + }, + destination: { + type: "BANK_ACCOUNT", + id: "bact:ZPp3oedR3AeEUNd3z7", + }, + version: 1, + type: "BATCH", + payout_fee: [{}], + arrival_date: "2022-03-24", + end_to_end_id: "end_to_end_id", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/refunds.test.ts b/tests/wire/refunds.test.ts new file mode 100644 index 000000000..c397e3f68 --- /dev/null +++ b/tests/wire/refunds.test.ts @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Refunds", () => { + test("RefundPayment", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + amount_money: { amount: BigInt(1000), currency: "USD" }, + app_fee_money: { amount: BigInt(10), currency: "USD" }, + payment_id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + reason: "Example", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refund: { + id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY_KlWP8IC1557ddwc9QWTKrCVU6m0JXDz15R2Qym5eQfR", + status: "PENDING", + location_id: "L88917AVBK2S5", + unlinked: true, + destination_type: "destination_type", + destination_details: { + cash_details: { seller_supplied_money: {} }, + external_details: { type: "type", source: "source" }, + }, + amount_money: { amount: BigInt(1000), currency: "USD" }, + app_fee_money: { amount: BigInt(10), currency: "USD" }, + processing_fee: [{}], + payment_id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + order_id: "1JLEUZeEooAIX8HMqm9kvWd69aQZY", + reason: "Example", + created_at: "2021-10-13T21:23:19.116Z", + updated_at: "2021-10-13T21:23:19.508Z", + team_member_id: "team_member_id", + terminal_refund_id: "terminal_refund_id", + }, + }; + server + .mockEndpoint() + .post("/v2/refunds") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.refunds.refundPayment({ + idempotency_key: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("10"), + currency: "USD", + }, + payment_id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + reason: "Example", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refund: { + id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY_KlWP8IC1557ddwc9QWTKrCVU6m0JXDz15R2Qym5eQfR", + status: "PENDING", + location_id: "L88917AVBK2S5", + unlinked: true, + destination_type: "destination_type", + destination_details: { + cash_details: { + seller_supplied_money: {}, + }, + external_details: { + type: "type", + source: "source", + }, + }, + amount_money: { + amount: BigInt("1000"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("10"), + currency: "USD", + }, + processing_fee: [{}], + payment_id: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + order_id: "1JLEUZeEooAIX8HMqm9kvWd69aQZY", + reason: "Example", + created_at: "2021-10-13T21:23:19.116Z", + updated_at: "2021-10-13T21:23:19.508Z", + team_member_id: "team_member_id", + terminal_refund_id: "terminal_refund_id", + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refund: { + id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY_69MmgHubkLqx9wGhnmenRUHOaKitE6llfZuxcWYjGxd", + status: "COMPLETED", + location_id: "L88917AVBK2S5", + unlinked: true, + destination_type: "destination_type", + destination_details: { + cash_details: { seller_supplied_money: {} }, + external_details: { type: "type", source: "source" }, + }, + amount_money: { amount: BigInt(555), currency: "USD" }, + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + processing_fee: [ + { + effective_at: "2021-10-13T21:34:35.000Z", + type: "INITIAL", + amount_money: { amount: BigInt(-34), currency: "USD" }, + }, + ], + payment_id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + order_id: "9ltv0bx5PuvGXUYHYHxYSKEqC3IZY", + reason: "Example Refund", + created_at: "2021-10-13T19:59:05.073Z", + updated_at: "2021-10-13T20:00:02.442Z", + team_member_id: "team_member_id", + terminal_refund_id: "terminal_refund_id", + }, + }; + server + .mockEndpoint() + .get("/v2/refunds/refund_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.refunds.get({ + refund_id: "refund_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refund: { + id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY_69MmgHubkLqx9wGhnmenRUHOaKitE6llfZuxcWYjGxd", + status: "COMPLETED", + location_id: "L88917AVBK2S5", + unlinked: true, + destination_type: "destination_type", + destination_details: { + cash_details: { + seller_supplied_money: {}, + }, + external_details: { + type: "type", + source: "source", + }, + }, + amount_money: { + amount: BigInt("555"), + currency: "USD", + }, + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + processing_fee: [ + { + effective_at: "2021-10-13T21:34:35.000Z", + type: "INITIAL", + amount_money: { + amount: BigInt("-34"), + currency: "USD", + }, + }, + ], + payment_id: "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", + order_id: "9ltv0bx5PuvGXUYHYHxYSKEqC3IZY", + reason: "Example Refund", + created_at: "2021-10-13T19:59:05.073Z", + updated_at: "2021-10-13T20:00:02.442Z", + team_member_id: "team_member_id", + terminal_refund_id: "terminal_refund_id", + }, + }); + }); +}); diff --git a/tests/wire/sites.test.ts b/tests/wire/sites.test.ts new file mode 100644 index 000000000..369e9fbe3 --- /dev/null +++ b/tests/wire/sites.test.ts @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Sites", () => { + test("list", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + sites: [ + { + id: "site_278075276488921835", + site_title: "My Second Site", + domain: "mysite2.square.site", + is_published: false, + created_at: "2020-10-28T13:22:51.000000Z", + updated_at: "2020-10-28T13:22:51.000000Z", + }, + { + id: "site_102725345836253849", + site_title: "My First Site", + domain: "mysite1.square.site", + is_published: true, + created_at: "2020-06-18T17:45:13.000000Z", + updated_at: "2020-11-23T02:19:10.000000Z", + }, + ], + }; + server.mockEndpoint().get("/v2/sites").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.sites.list(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + sites: [ + { + id: "site_278075276488921835", + site_title: "My Second Site", + domain: "mysite2.square.site", + is_published: false, + created_at: "2020-10-28T13:22:51.000000Z", + updated_at: "2020-10-28T13:22:51.000000Z", + }, + { + id: "site_102725345836253849", + site_title: "My First Site", + domain: "mysite1.square.site", + is_published: true, + created_at: "2020-06-18T17:45:13.000000Z", + updated_at: "2020-11-23T02:19:10.000000Z", + }, + ], + }); + }); +}); diff --git a/tests/wire/snippets.test.ts b/tests/wire/snippets.test.ts new file mode 100644 index 000000000..2a66a62af --- /dev/null +++ b/tests/wire/snippets.test.ts @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Snippets", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + snippet: { + id: "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7", + site_id: "site_278075276488921835", + content: "", + created_at: "2021-03-11T25:40:09.000000Z", + updated_at: "2021-03-11T25:40:09.000000Z", + }, + }; + server + .mockEndpoint() + .get("/v2/sites/site_id/snippet") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.snippets.get({ + site_id: "site_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + snippet: { + id: "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7", + site_id: "site_278075276488921835", + content: "", + created_at: "2021-03-11T25:40:09.000000Z", + updated_at: "2021-03-11T25:40:09.000000Z", + }, + }); + }); + + test("upsert", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { snippet: { content: "" } }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + snippet: { + id: "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7", + site_id: "site_278075276488921835", + content: "", + created_at: "2021-03-11T25:40:09.000000Z", + updated_at: "2021-03-11T25:40:09.000000Z", + }, + }; + server + .mockEndpoint() + .post("/v2/sites/site_id/snippet") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.snippets.upsert({ + site_id: "site_id", + snippet: { + content: "", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + snippet: { + id: "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7", + site_id: "site_278075276488921835", + content: "", + created_at: "2021-03-11T25:40:09.000000Z", + updated_at: "2021-03-11T25:40:09.000000Z", + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/sites/site_id/snippet") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.snippets.delete({ + site_id: "site_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/subscriptions.test.ts b/tests/wire/subscriptions.test.ts new file mode 100644 index 000000000..c0d7abfce --- /dev/null +++ b/tests/wire/subscriptions.test.ts @@ -0,0 +1,1157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Subscriptions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + phases: [{ ordinal: BigInt(0), order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY" }], + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + version: BigInt(1), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt(0), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + }; + server + .mockEndpoint() + .post("/v2/subscriptions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.create({ + idempotency_key: "8193148c-9586-11e6-99f9-28cfe92138cf", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + phases: [ + { + ordinal: BigInt("0"), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + }, + ], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + version: BigInt("1"), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt("0"), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + }); + }); + + test("BulkSwapPlan", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + old_plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + location_id: "S8GWD5R9QB376", + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + affected_subscriptions: 12, + }; + server + .mockEndpoint() + .post("/v2/subscriptions/bulk-swap-plan") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.bulkSwapPlan({ + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + old_plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + location_id: "S8GWD5R9QB376", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + affected_subscriptions: 12, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + query: { + filter: { + customer_ids: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + location_ids: ["S8GWD5R9QB376"], + source_names: ["My App"], + }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscriptions: [ + { + id: "de86fc96-8664-474b-af1a-abbe59cacf0e", + location_id: "S8GWD5R9QB376", + plan_variation_id: "L3TJVDHVBEQEGQDEZL2JJM7R", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2021-10-20", + canceled_date: "2021-10-30", + charged_through_date: "2021-11-20", + status: "CANCELED", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + version: BigInt(1000000), + created_at: "2021-10-20T21:53:10Z", + card_id: "ccof:mueUsvgajChmjEbp4GB", + timezone: "UTC", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2022-01-19", + canceled_date: "canceled_date", + charged_through_date: "2022-08-19", + status: "PAUSED", + tax_percentage: "5", + invoice_ids: ["grebK0Q_l8H4fqoMMVvt-Q", "rcX_i3sNmHTGKhI4W2mceA"], + price_override_money: { amount: BigInt(1000), currency: "USD" }, + version: BigInt(2), + created_at: "2022-01-19T21:53:10Z", + card_id: "card_id", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + version: BigInt(1), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt(0), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/subscriptions/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.search({ + query: { + filter: { + customer_ids: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + location_ids: ["S8GWD5R9QB376"], + source_names: ["My App"], + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscriptions: [ + { + id: "de86fc96-8664-474b-af1a-abbe59cacf0e", + location_id: "S8GWD5R9QB376", + plan_variation_id: "L3TJVDHVBEQEGQDEZL2JJM7R", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2021-10-20", + canceled_date: "2021-10-30", + charged_through_date: "2021-11-20", + status: "CANCELED", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + version: BigInt("1000000"), + created_at: "2021-10-20T21:53:10Z", + card_id: "ccof:mueUsvgajChmjEbp4GB", + timezone: "UTC", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2022-01-19", + canceled_date: "canceled_date", + charged_through_date: "2022-08-19", + status: "PAUSED", + tax_percentage: "5", + invoice_ids: ["grebK0Q_l8H4fqoMMVvt-Q", "rcX_i3sNmHTGKhI4W2mceA"], + price_override_money: { + amount: BigInt("1000"), + currency: "USD", + }, + version: BigInt("2"), + created_at: "2022-01-19T21:53:10Z", + card_id: "card_id", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + version: BigInt("1"), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt("0"), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + ], + cursor: "cursor", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "8151fc89-da15-4eb9-a685-1a70883cebfc", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + start_date: "2022-07-27", + canceled_date: "canceled_date", + charged_through_date: "2023-11-20", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA"], + price_override_money: { amount: BigInt(25000), currency: "USD" }, + version: BigInt(1000000), + created_at: "2022-07-27T21:53:10Z", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + }; + server + .mockEndpoint() + .get("/v2/subscriptions/subscription_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.get({ + subscription_id: "subscription_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "8151fc89-da15-4eb9-a685-1a70883cebfc", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + start_date: "2022-07-27", + canceled_date: "canceled_date", + charged_through_date: "2023-11-20", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA"], + price_override_money: { + amount: BigInt("25000"), + currency: "USD", + }, + version: BigInt("1000000"), + created_at: "2022-07-27T21:53:10Z", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { subscription: { card_id: "{NEW CARD ID}" } }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "7217d8ca-1fee-4446-a9e5-8540b5d8c9bb", + location_id: "LPJKHYR7WFDKN", + plan_variation_id: "XOUNEKCE6NSXQW5NTSQ73MMX", + customer_id: "AM69AB81FT4479YH9HGWS1HZY8", + start_date: "2023-01-30", + canceled_date: "canceled_date", + charged_through_date: "2023-03-13", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChAPSfVYvNewckgf3x4iigN_ENMM", "inv:0-ChBQaCCLfjcm9WEUBGxvuydJENMM"], + price_override_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + version: BigInt(3), + created_at: "2023-01-30T19:27:32Z", + card_id: "{NEW CARD ID}", + timezone: "UTC", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + }; + server + .mockEndpoint() + .put("/v2/subscriptions/subscription_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.update({ + subscription_id: "subscription_id", + subscription: { + card_id: "{NEW CARD ID}", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "7217d8ca-1fee-4446-a9e5-8540b5d8c9bb", + location_id: "LPJKHYR7WFDKN", + plan_variation_id: "XOUNEKCE6NSXQW5NTSQ73MMX", + customer_id: "AM69AB81FT4479YH9HGWS1HZY8", + start_date: "2023-01-30", + canceled_date: "canceled_date", + charged_through_date: "2023-03-13", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChAPSfVYvNewckgf3x4iigN_ENMM", "inv:0-ChBQaCCLfjcm9WEUBGxvuydJENMM"], + price_override_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + version: BigInt("3"), + created_at: "2023-01-30T19:27:32Z", + card_id: "{NEW CARD ID}", + timezone: "UTC", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + }); + }); + + test("DeleteAction", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "8151fc89-da15-4eb9-a685-1a70883cebfc", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + start_date: "2022-07-27", + canceled_date: "canceled_date", + charged_through_date: "2023-11-20", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA"], + price_override_money: { amount: BigInt(25000), currency: "USD" }, + version: BigInt(1000000), + created_at: "2022-07-27T21:53:10Z", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + }; + server + .mockEndpoint() + .delete("/v2/subscriptions/subscription_id/actions/action_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.deleteAction({ + subscription_id: "subscription_id", + action_id: "action_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "8151fc89-da15-4eb9-a685-1a70883cebfc", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", + start_date: "2022-07-27", + canceled_date: "canceled_date", + charged_through_date: "2023-11-20", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA"], + price_override_money: { + amount: BigInt("25000"), + currency: "USD", + }, + version: BigInt("1000000"), + created_at: "2022-07-27T21:53:10Z", + card_id: "ccof:IkWfpLj4tNHMyFii3GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + }); + }); + + test("ChangeBillingAnchorDate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { monthly_billing_anchor_date: 1 }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "9ba40961-995a-4a3d-8c53-048c40cafc13", + location_id: "S8GWD5R9QB376", + plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "start_date", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { amount: BigInt(2000), currency: "USD" }, + version: BigInt(3), + created_at: "2023-06-20T21:53:10Z", + card_id: "card_id", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 20, + phases: [ + { + uid: "98d6f53b-40e1-4714-8827-032fd923be25", + ordinal: BigInt(0), + order_template_id: "E6oBY5WfQ2eN4pkYZwq4ka6n7KeZY", + plan_phase_uid: "C66BKH3ASTDYGJJCEZXQQSS7", + }, + ], + }, + actions: [ + { + id: "f0a1dfdc-675b-3a14-a640-99f7ac1cee83", + type: "CHANGE_BILLING_ANCHOR_DATE", + effective_date: "2023-11-01", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }; + server + .mockEndpoint() + .post("/v2/subscriptions/subscription_id/billing-anchor") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.changeBillingAnchorDate({ + subscription_id: "subscription_id", + monthly_billing_anchor_date: 1, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "9ba40961-995a-4a3d-8c53-048c40cafc13", + location_id: "S8GWD5R9QB376", + plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "start_date", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { + amount: BigInt("2000"), + currency: "USD", + }, + version: BigInt("3"), + created_at: "2023-06-20T21:53:10Z", + card_id: "card_id", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 20, + phases: [ + { + uid: "98d6f53b-40e1-4714-8827-032fd923be25", + ordinal: BigInt("0"), + order_template_id: "E6oBY5WfQ2eN4pkYZwq4ka6n7KeZY", + plan_phase_uid: "C66BKH3ASTDYGJJCEZXQQSS7", + }, + ], + }, + actions: [ + { + id: "f0a1dfdc-675b-3a14-a640-99f7ac1cee83", + type: "CHANGE_BILLING_ANCHOR_DATE", + effective_date: "2023-11-01", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "910afd30-464a-4e00-a8d8-2296e", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2022-01-19", + canceled_date: "2023-06-05", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA"], + price_override_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + version: BigInt(3), + created_at: "2022-01-19T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + actions: [ + { + id: "id", + type: "CANCEL", + effective_date: "effective_date", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }; + server + .mockEndpoint() + .post("/v2/subscriptions/subscription_id/cancel") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.cancel({ + subscription_id: "subscription_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "910afd30-464a-4e00-a8d8-2296e", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2022-01-19", + canceled_date: "2023-06-05", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA"], + price_override_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + version: BigInt("3"), + created_at: "2022-01-19T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [{}], + }, + actions: [ + { + id: "id", + type: "CANCEL", + effective_date: "effective_date", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }); + }); + + test("pause", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + version: BigInt(1), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt(0), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + actions: [ + { + id: "99b2439e-63f7-3ad5-95f7-ab2447a80673", + type: "PAUSE", + effective_date: "2023-11-17", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }; + server + .mockEndpoint() + .post("/v2/subscriptions/subscription_id/pause") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.pause({ + subscription_id: "subscription_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + version: BigInt("1"), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt("0"), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + actions: [ + { + id: "99b2439e-63f7-3ad5-95f7-ab2447a80673", + type: "PAUSE", + effective_date: "2023-11-17", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }); + }); + + test("resume", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + version: BigInt(1), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt(0), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + actions: [ + { + id: "18ff74f4-3da4-30c5-929f-7d6fca84f115", + type: "RESUME", + effective_date: "2023-09-01", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }; + server + .mockEndpoint() + .post("/v2/subscriptions/subscription_id/resume") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.resume({ + subscription_id: "subscription_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", + location_id: "S8GWD5R9QB376", + plan_variation_id: "6JHXF3B2CW3YKHDV4XEM674H", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "2023-06-20", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + version: BigInt("1"), + created_at: "2023-06-20T21:53:10Z", + card_id: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "873451e0-745b-4e87-ab0b-c574933fe616", + ordinal: BigInt("0"), + order_template_id: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + plan_phase_uid: "X2Q2AONPB3RB64Y27S25QCZP", + }, + ], + }, + actions: [ + { + id: "18ff74f4-3da4-30c5-929f-7d6fca84f115", + type: "RESUME", + effective_date: "2023-09-01", + monthly_billing_anchor_date: 1, + phases: [{}], + new_plan_variation_id: "new_plan_variation_id", + }, + ], + }); + }); + + test("SwapPlan", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + phases: [{ ordinal: BigInt(0), order_template_id: "uhhnjH9osVv3shUADwaC0b3hNxQZY" }], + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "9ba40961-995a-4a3d-8c53-048c40cafc13", + location_id: "S8GWD5R9QB376", + plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "start_date", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { amount: BigInt(2000), currency: "USD" }, + version: BigInt(3), + created_at: "2023-06-20T21:53:10Z", + card_id: "card_id", + timezone: "America/Los_Angeles", + source: { name: "My Application" }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "98d6f53b-40e1-4714-8827-032fd923be25", + ordinal: BigInt(0), + order_template_id: "E6oBY5WfQ2eN4pkYZwq4ka6n7KeZY", + plan_phase_uid: "C66BKH3ASTDYGJJCEZXQQSS7", + }, + ], + }, + actions: [ + { + id: "f0a1dfdc-675b-3a14-a640-99f7ac1cee83", + type: "SWAP_PLAN", + effective_date: "2023-11-17", + monthly_billing_anchor_date: 1, + phases: [{ ordinal: BigInt(0), order_template_id: "uhhnjH9osVv3shUADwaC0b3hNxQZY" }], + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + }, + ], + }; + server + .mockEndpoint() + .post("/v2/subscriptions/subscription_id/swap-plan") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscriptions.swapPlan({ + subscription_id: "subscription_id", + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + phases: [ + { + ordinal: BigInt("0"), + order_template_id: "uhhnjH9osVv3shUADwaC0b3hNxQZY", + }, + ], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "9ba40961-995a-4a3d-8c53-048c40cafc13", + location_id: "S8GWD5R9QB376", + plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + customer_id: "CHFGVKYY8RSV93M5KCYTG4PN0G", + start_date: "start_date", + canceled_date: "canceled_date", + charged_through_date: "charged_through_date", + status: "ACTIVE", + tax_percentage: "tax_percentage", + invoice_ids: ["invoice_ids"], + price_override_money: { + amount: BigInt("2000"), + currency: "USD", + }, + version: BigInt("3"), + created_at: "2023-06-20T21:53:10Z", + card_id: "card_id", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + actions: [{}], + monthly_billing_anchor_date: 1, + phases: [ + { + uid: "98d6f53b-40e1-4714-8827-032fd923be25", + ordinal: BigInt("0"), + order_template_id: "E6oBY5WfQ2eN4pkYZwq4ka6n7KeZY", + plan_phase_uid: "C66BKH3ASTDYGJJCEZXQQSS7", + }, + ], + }, + actions: [ + { + id: "f0a1dfdc-675b-3a14-a640-99f7ac1cee83", + type: "SWAP_PLAN", + effective_date: "2023-11-17", + monthly_billing_anchor_date: 1, + phases: [ + { + ordinal: BigInt("0"), + order_template_id: "uhhnjH9osVv3shUADwaC0b3hNxQZY", + }, + ], + new_plan_variation_id: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + }, + ], + }); + }); +}); diff --git a/tests/wire/team.test.ts b/tests/wire/team.test.ts new file mode 100644 index 000000000..44c441832 --- /dev/null +++ b/tests/wire/team.test.ts @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Team", () => { + test("ListJobs", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + jobs: [ + { + id: "VDNpRv8da51NU8qZFC5zDWpF", + title: "Cashier", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 2, + }, + { + id: "FjS8x95cqHiMenw4f1NAUH4P", + title: "Chef", + is_tip_eligible: false, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 1, + }, + ], + cursor: "cursor", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/team-members/jobs") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.team.listJobs(); + expect(response).toEqual({ + jobs: [ + { + id: "VDNpRv8da51NU8qZFC5zDWpF", + title: "Cashier", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 2, + }, + { + id: "FjS8x95cqHiMenw4f1NAUH4P", + title: "Chef", + is_tip_eligible: false, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 1, + }, + ], + cursor: "cursor", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("CreateJob", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + job: { title: "Cashier", is_tip_eligible: true }, + idempotency_key: "idempotency-key-0", + }; + const rawResponseBody = { + job: { + id: "1yJlHapkseYnNPETIU1B", + title: "Cashier", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 1, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/team-members/jobs") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.team.createJob({ + job: { + title: "Cashier", + is_tip_eligible: true, + }, + idempotency_key: "idempotency-key-0", + }); + expect(response).toEqual({ + job: { + id: "1yJlHapkseYnNPETIU1B", + title: "Cashier", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 1, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("RetrieveJob", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + job: { + id: "1yJlHapkseYnNPETIU1B", + title: "Cashier 1", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 2, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/team-members/jobs/job_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.team.retrieveJob({ + job_id: "job_id", + }); + expect(response).toEqual({ + job: { + id: "1yJlHapkseYnNPETIU1B", + title: "Cashier 1", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + version: 2, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("UpdateJob", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { job: { title: "Cashier 1", is_tip_eligible: true } }; + const rawResponseBody = { + job: { + id: "1yJlHapkseYnNPETIU1B", + title: "Cashier 1", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-13T12:55:45Z", + version: 2, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/team-members/jobs/job_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.team.updateJob({ + job_id: "job_id", + job: { + title: "Cashier 1", + is_tip_eligible: true, + }, + }); + expect(response).toEqual({ + job: { + id: "1yJlHapkseYnNPETIU1B", + title: "Cashier 1", + is_tip_eligible: true, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-13T12:55:45Z", + version: 2, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/teamMembers.test.ts b/tests/wire/teamMembers.test.ts new file mode 100644 index 000000000..115ff1afa --- /dev/null +++ b/tests/wire/teamMembers.test.ts @@ -0,0 +1,1338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("TeamMembers", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "idempotency-key-0", + team_member: { + reference_id: "reference_id_1", + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + wage_setting: { + job_assignments: [ + { + pay_type: "SALARY", + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + }, + }, + }; + const rawResponseBody = { + team_member: { + id: "1yJlHapkseYnNPETIU1B", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { amount: BigInt(1443), currency: "USD" }, + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/team-members") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.create({ + idempotency_key: "idempotency-key-0", + team_member: { + reference_id: "reference_id_1", + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + wage_setting: { + job_assignments: [ + { + pay_type: "SALARY", + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + }, + }, + }); + expect(response).toEqual({ + team_member: { + id: "1yJlHapkseYnNPETIU1B", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { + amount: BigInt("1443"), + currency: "USD", + }, + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("batchCreate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + team_members: { + "idempotency-key-1": { + team_member: { + reference_id: "reference_id_1", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + }, + }, + "idempotency-key-2": { + team_member: { + reference_id: "reference_id_2", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + }, + }, + }; + const rawResponseBody = { + team_members: { + "idempotency-key-1": { + team_member: { + id: "ywhG1qfIOoqsHfVRubFV", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + "idempotency-key-2": { + team_member: { + id: "IF_Ncrg7fHhCqxVI9T6R", + reference_id: "reference_id_2", + is_owner: false, + status: "ACTIVE", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/team-members/bulk-create") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.batchCreate({ + team_members: { + "idempotency-key-1": { + team_member: { + reference_id: "reference_id_1", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + }, + }, + "idempotency-key-2": { + team_member: { + reference_id: "reference_id_2", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + }, + }, + }); + expect(response).toEqual({ + team_members: { + "idempotency-key-1": { + team_member: { + id: "ywhG1qfIOoqsHfVRubFV", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + "idempotency-key-2": { + team_member: { + id: "IF_Ncrg7fHhCqxVI9T6R", + reference_id: "reference_id_2", + is_owner: false, + status: "ACTIVE", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("batchUpdate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + team_members: { + "AFMwA08kR-MIF-3Vs0OE": { + team_member: { + reference_id: "reference_id_2", + is_owner: false, + status: "ACTIVE", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + }, + "fpgteZNMaf0qOK-a4t6P": { + team_member: { + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + }, + }, + }, + }; + const rawResponseBody = { + team_members: { + "AFMwA08kR-MIF-3Vs0OE": { + team_member: { + id: "AFMwA08kR-MIF-3Vs0OE", + reference_id: "reference_id_2", + is_owner: false, + status: "ACTIVE", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@example.com", + phone_number: "+14159223334", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:18:00Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + "fpgteZNMaf0qOK-a4t6P": { + team_member: { + id: "fpgteZNMaf0qOK-a4t6P", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:18:00Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/team-members/bulk-update") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.batchUpdate({ + team_members: { + "AFMwA08kR-MIF-3Vs0OE": { + team_member: { + reference_id: "reference_id_2", + is_owner: false, + status: "ACTIVE", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@gmail.com", + phone_number: "+14159223334", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + }, + "fpgteZNMaf0qOK-a4t6P": { + team_member: { + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + }, + }, + }, + }); + expect(response).toEqual({ + team_members: { + "AFMwA08kR-MIF-3Vs0OE": { + team_member: { + id: "AFMwA08kR-MIF-3Vs0OE", + reference_id: "reference_id_2", + is_owner: false, + status: "ACTIVE", + given_name: "Jane", + family_name: "Smith", + email_address: "jane_smith@example.com", + phone_number: "+14159223334", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:18:00Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + "fpgteZNMaf0qOK-a4t6P": { + team_member: { + id: "fpgteZNMaf0qOK-a4t6P", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:18:00Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { query: { filter: { location_ids: ["0G5P3VGACMMQZ"], status: "ACTIVE" } }, limit: 10 }; + const rawResponseBody = { + team_members: [ + { + id: "-3oZQKPKVk6gUXU_V5Qa", + reference_id: "12345678", + is_owner: false, + status: "ACTIVE", + given_name: "Johnny", + family_name: "Cash", + email_address: "johnny_cash@squareup.com", + phone_number: "phone_number", + created_at: "2019-07-10T17:26:48Z", + updated_at: "2020-04-28T21:49:28Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + wage_setting: { + team_member_id: "-3oZQKPKVk6gUXU_V5Qa", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { amount: BigInt(1443), currency: "USD" }, + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + { + id: "1AVJj0DjkzbmbJw5r4KK", + reference_id: "abcded", + is_owner: false, + status: "ACTIVE", + given_name: "Lombard", + family_name: "Smith", + email_address: "email_address", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:01Z", + updated_at: "2020-06-09T17:38:05Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + wage_setting: { + team_member_id: "1AVJj0DjkzbmbJw5r4KK", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2400), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 2, + created_at: "2020-03-24T18:14:01Z", + updated_at: "2020-06-09T17:38:05Z", + }, + }, + { + id: "2JCmiJol_KKFs9z2Evim", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Monica", + family_name: "Sway", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:25Z", + updated_at: "2020-03-24T01:11:25Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + wage_setting: { + team_member_id: "2JCmiJol_KKFs9z2Evim", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2400), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2020-03-24T01:09:25Z", + updated_at: "2020-03-24T01:09:25Z", + }, + }, + { + id: "4uXcJQSLtbk3F0UQHFNQ", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Elton", + family_name: "Ipsum", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:23Z", + updated_at: "2020-03-24T01:15:23Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + { + id: "5CoUpyrw1YwGWcRd-eDL", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Steven", + family_name: "Lo", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:23Z", + updated_at: "2020-03-24T01:19:23Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + { + id: "5MRPTTp8MMBLVSmzrGha", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Patrick", + family_name: "Steward", + email_address: "email_address", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:03Z", + updated_at: "2020-03-24T18:18:03Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + wage_setting: { + team_member_id: "5MRPTTp8MMBLVSmzrGha", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2020-03-24T18:14:03Z", + updated_at: "2020-03-24T18:14:03Z", + }, + }, + { + id: "7F5ZxsfRnkexhu1PTbfh", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Ivy", + family_name: "Manny", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:25Z", + updated_at: "2020-03-24T01:09:25Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + { + id: "808X9HR72yKvVaigQXf4", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "John", + family_name: "Smith", + email_address: "john_smith@example.com", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:02Z", + updated_at: "2020-03-24T18:14:02Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + { + id: "9MVDVoY4hazkWKGo_OuZ", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Robert", + family_name: "Wen", + email_address: "r_wen@example.com", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:14:00Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + }, + { + id: "9UglUjOXQ13-hMFypCft", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Ashley", + family_name: "Simpson", + email_address: "asimpson@example.com", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:18:00Z", + assigned_locations: { assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS" }, + wage_setting: { + team_member_id: "9UglUjOXQ13-hMFypCft", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:14:03Z", + }, + }, + ], + cursor: "N:9UglUjOXQ13-hMFypCft", + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/team-members/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.search({ + query: { + filter: { + location_ids: ["0G5P3VGACMMQZ"], + status: "ACTIVE", + }, + }, + limit: 10, + }); + expect(response).toEqual({ + team_members: [ + { + id: "-3oZQKPKVk6gUXU_V5Qa", + reference_id: "12345678", + is_owner: false, + status: "ACTIVE", + given_name: "Johnny", + family_name: "Cash", + email_address: "johnny_cash@squareup.com", + phone_number: "phone_number", + created_at: "2019-07-10T17:26:48Z", + updated_at: "2020-04-28T21:49:28Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + wage_setting: { + team_member_id: "-3oZQKPKVk6gUXU_V5Qa", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { + amount: BigInt("1443"), + currency: "USD", + }, + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + { + id: "1AVJj0DjkzbmbJw5r4KK", + reference_id: "abcded", + is_owner: false, + status: "ACTIVE", + given_name: "Lombard", + family_name: "Smith", + email_address: "email_address", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:01Z", + updated_at: "2020-06-09T17:38:05Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + wage_setting: { + team_member_id: "1AVJj0DjkzbmbJw5r4KK", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2400"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 2, + created_at: "2020-03-24T18:14:01Z", + updated_at: "2020-06-09T17:38:05Z", + }, + }, + { + id: "2JCmiJol_KKFs9z2Evim", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Monica", + family_name: "Sway", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:25Z", + updated_at: "2020-03-24T01:11:25Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + wage_setting: { + team_member_id: "2JCmiJol_KKFs9z2Evim", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2400"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2020-03-24T01:09:25Z", + updated_at: "2020-03-24T01:09:25Z", + }, + }, + { + id: "4uXcJQSLtbk3F0UQHFNQ", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Elton", + family_name: "Ipsum", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:23Z", + updated_at: "2020-03-24T01:15:23Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + { + id: "5CoUpyrw1YwGWcRd-eDL", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Steven", + family_name: "Lo", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:23Z", + updated_at: "2020-03-24T01:19:23Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + { + id: "5MRPTTp8MMBLVSmzrGha", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Patrick", + family_name: "Steward", + email_address: "email_address", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:03Z", + updated_at: "2020-03-24T18:18:03Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + wage_setting: { + team_member_id: "5MRPTTp8MMBLVSmzrGha", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2020-03-24T18:14:03Z", + updated_at: "2020-03-24T18:14:03Z", + }, + }, + { + id: "7F5ZxsfRnkexhu1PTbfh", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Ivy", + family_name: "Manny", + email_address: "email_address", + phone_number: "phone_number", + created_at: "2020-03-24T01:09:25Z", + updated_at: "2020-03-24T01:09:25Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + { + id: "808X9HR72yKvVaigQXf4", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "John", + family_name: "Smith", + email_address: "john_smith@example.com", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:02Z", + updated_at: "2020-03-24T18:14:02Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + { + id: "9MVDVoY4hazkWKGo_OuZ", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Robert", + family_name: "Wen", + email_address: "r_wen@example.com", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:14:00Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + { + id: "9UglUjOXQ13-hMFypCft", + reference_id: "reference_id", + is_owner: false, + status: "ACTIVE", + given_name: "Ashley", + family_name: "Simpson", + email_address: "asimpson@example.com", + phone_number: "+14155552671", + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:18:00Z", + assigned_locations: { + assignment_type: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + wage_setting: { + team_member_id: "9UglUjOXQ13-hMFypCft", + job_assignments: [ + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2020-03-24T18:14:00Z", + updated_at: "2020-03-24T18:14:03Z", + }, + }, + ], + cursor: "N:9UglUjOXQ13-hMFypCft", + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + team_member: { + id: "1yJlHapkseYnNPETIU1B", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-15T17:38:05Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { amount: BigInt(1443), currency: "USD" }, + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/team-members/team_member_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.get({ + team_member_id: "team_member_id", + }); + expect(response).toEqual({ + team_member: { + id: "1yJlHapkseYnNPETIU1B", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-15T17:38:05Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { + amount: BigInt("1443"), + currency: "USD", + }, + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + team_member: { + reference_id: "reference_id_1", + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + wage_setting: { + job_assignments: [ + { + pay_type: "SALARY", + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(1200), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + }, + }, + }; + const rawResponseBody = { + team_member: { + id: "1yJlHapkseYnNPETIU1B", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-15T17:38:05Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { amount: BigInt(1443), currency: "USD" }, + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(1200), currency: "USD" }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/team-members/team_member_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.update({ + team_member_id: "team_member_id", + body: { + team_member: { + reference_id: "reference_id_1", + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@gmail.com", + phone_number: "+14159283333", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + wage_setting: { + job_assignments: [ + { + pay_type: "SALARY", + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("1200"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + }, + }, + }, + }); + expect(response).toEqual({ + team_member: { + id: "1yJlHapkseYnNPETIU1B", + reference_id: "reference_id_1", + is_owner: false, + status: "ACTIVE", + given_name: "Joe", + family_name: "Doe", + email_address: "joe_doe@example.com", + phone_number: "+14159283333", + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-15T17:38:05Z", + assigned_locations: { + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: ["GA2Y9HSJ8KRYT", "YSGH2WBKG94QZ"], + }, + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { + amount: BigInt("1443"), + currency: "USD", + }, + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + job_id: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("1200"), + currency: "USD", + }, + job_id: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2021-06-11T22:55:45Z", + updated_at: "2021-06-11T22:55:45Z", + }, + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/teamMembers/wageSetting.test.ts b/tests/wire/teamMembers/wageSetting.test.ts new file mode 100644 index 000000000..f0a246aa8 --- /dev/null +++ b/tests/wire/teamMembers/wageSetting.test.ts @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("WageSetting", () => { + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { amount: BigInt(2164), currency: "USD" }, + annual_rate: { amount: BigInt(4500000), currency: "USD" }, + weekly_hours: 40, + }, + ], + is_overtime_exempt: false, + version: 1, + created_at: "2020-06-11T23:01:21+00:00", + updated_at: "2020-06-11T23:01:21+00:00", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/team-members/team_member_id/wage-setting") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.wageSetting.get({ + team_member_id: "team_member_id", + }); + expect(response).toEqual({ + wage_setting: { + team_member_id: "1yJlHapkseYnNPETIU1B", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { + amount: BigInt("2164"), + currency: "USD", + }, + annual_rate: { + amount: BigInt("4500000"), + currency: "USD", + }, + weekly_hours: 40, + }, + ], + is_overtime_exempt: false, + version: 1, + created_at: "2020-06-11T23:01:21+00:00", + updated_at: "2020-06-11T23:01:21+00:00", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + wage_setting: { + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + }, + ], + is_overtime_exempt: true, + }, + }; + const rawResponseBody = { + wage_setting: { + team_member_id: "-3oZQKPKVk6gUXU_V5Qa", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { amount: BigInt(1443), currency: "USD" }, + annual_rate: { amount: BigInt(3000000), currency: "USD" }, + weekly_hours: 40, + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { amount: BigInt(2000), currency: "USD" }, + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2019-07-10T17:26:48+00:00", + updated_at: "2020-06-11T23:12:04+00:00", + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/team-members/team_member_id/wage-setting") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.teamMembers.wageSetting.update({ + team_member_id: "team_member_id", + wage_setting: { + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + }, + ], + is_overtime_exempt: true, + }, + }); + expect(response).toEqual({ + wage_setting: { + team_member_id: "-3oZQKPKVk6gUXU_V5Qa", + job_assignments: [ + { + job_title: "Manager", + pay_type: "SALARY", + hourly_rate: { + amount: BigInt("1443"), + currency: "USD", + }, + annual_rate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weekly_hours: 40, + }, + { + job_title: "Cashier", + pay_type: "HOURLY", + hourly_rate: { + amount: BigInt("2000"), + currency: "USD", + }, + }, + ], + is_overtime_exempt: true, + version: 1, + created_at: "2019-07-10T17:26:48+00:00", + updated_at: "2020-06-11T23:12:04+00:00", + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/terminal.test.ts b/tests/wire/terminal.test.ts new file mode 100644 index 000000000..7b3f12ec5 --- /dev/null +++ b/tests/wire/terminal.test.ts @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Terminal", () => { + test("DismissTerminalAction", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + action: { + id: "termapia:abcdefg1234567", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:29.511Z", + app_id: "APP_ID", + location_id: "location_id", + type: "CONFIRMATION", + qr_code_options: { title: "title", body: "body", barcode_contents: "barcode_contents" }, + save_card_options: { customer_id: "customer_id", card_id: "card_id", reference_id: "reference_id" }, + signature_options: { title: "title", body: "body", signature: [{}] }, + confirmation_options: { + title: "Marketing communications", + body: "I agree to receive promotional emails about future events and activities.", + agree_button_text: "Agree", + disagree_button_text: "Decline", + decision: { has_agreed: true }, + }, + receipt_options: { payment_id: "payment_id", print_only: true, is_duplicate: true }, + data_collection_options: { title: "title", body: "body", input_type: "EMAIL" }, + select_options: { + title: "title", + body: "body", + options: [{ reference_id: "reference_id", title: "title" }], + selected_option: { reference_id: "reference_id", title: "title" }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "PT5M", + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/actions/action_id/dismiss") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.dismissTerminalAction({ + action_id: "action_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + action: { + id: "termapia:abcdefg1234567", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:29.511Z", + app_id: "APP_ID", + location_id: "location_id", + type: "CONFIRMATION", + qr_code_options: { + title: "title", + body: "body", + barcode_contents: "barcode_contents", + }, + save_card_options: { + customer_id: "customer_id", + card_id: "card_id", + reference_id: "reference_id", + }, + signature_options: { + title: "title", + body: "body", + signature: [{}], + }, + confirmation_options: { + title: "Marketing communications", + body: "I agree to receive promotional emails about future events and activities.", + agree_button_text: "Agree", + disagree_button_text: "Decline", + decision: { + has_agreed: true, + }, + }, + receipt_options: { + payment_id: "payment_id", + print_only: true, + is_duplicate: true, + }, + data_collection_options: { + title: "title", + body: "body", + input_type: "EMAIL", + }, + select_options: { + title: "title", + body: "body", + options: [ + { + reference_id: "reference_id", + title: "title", + }, + ], + selected_option: { + reference_id: "reference_id", + title: "title", + }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "PT5M", + }, + }); + }); + + test("DismissTerminalCheckout", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + checkout: { + id: "LmZEKbo3SBfqO", + amount_money: { amount: BigInt(2610), currency: "USD" }, + reference_id: "reference_id", + note: "note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + collect_signature: true, + tip_settings: { allow_tipping: true, separate_tip_screen: true, custom_tip_field: false }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["D7vLJqMkvSoAlX4yyFzUitOy4EPZY"], + created_at: "2023-11-29T14:59:50.682Z", + updated_at: "2023-11-29T15:00:18.936Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + statement_description_identifier: "statement_description_identifier", + tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/checkouts/checkout_id/dismiss") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.dismissTerminalCheckout({ + checkout_id: "checkout_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + checkout: { + id: "LmZEKbo3SBfqO", + amount_money: { + amount: BigInt("2610"), + currency: "USD", + }, + reference_id: "reference_id", + note: "note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + collect_signature: true, + tip_settings: { + allow_tipping: true, + separate_tip_screen: true, + custom_tip_field: false, + }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["D7vLJqMkvSoAlX4yyFzUitOy4EPZY"], + created_at: "2023-11-29T14:59:50.682Z", + updated_at: "2023-11-29T15:00:18.936Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + statement_description_identifier: "statement_description_identifier", + tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + }); + }); + + test("DismissTerminalRefund", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refund: { + id: "vjkNb2HD-xq5kiWWiJ7RhwrQnkxIn2N0l1nPZY", + refund_id: "refund_id", + payment_id: "xq5kiWWiJ7RhwrQnkxIn2N0l1nPZY", + order_id: "s8OMhQcpEp1b61YywlccSHWqUaQZY", + amount_money: { amount: BigInt(111), currency: "CAD" }, + reason: "Returning item", + device_id: "47776348fd8b32b9", + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + created_at: "2023-11-30T16:16:39.299Z", + updated_at: "2023-11-30T16:16:57.863Z", + app_id: "APP_ID", + location_id: "location_id", + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/refunds/terminal_refund_id/dismiss") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.dismissTerminalRefund({ + terminal_refund_id: "terminal_refund_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refund: { + id: "vjkNb2HD-xq5kiWWiJ7RhwrQnkxIn2N0l1nPZY", + refund_id: "refund_id", + payment_id: "xq5kiWWiJ7RhwrQnkxIn2N0l1nPZY", + order_id: "s8OMhQcpEp1b61YywlccSHWqUaQZY", + amount_money: { + amount: BigInt("111"), + currency: "CAD", + }, + reason: "Returning item", + device_id: "47776348fd8b32b9", + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + created_at: "2023-11-30T16:16:39.299Z", + updated_at: "2023-11-30T16:16:57.863Z", + app_id: "APP_ID", + location_id: "location_id", + }, + }); + }); +}); diff --git a/tests/wire/terminal/actions.test.ts b/tests/wire/terminal/actions.test.ts new file mode 100644 index 000000000..6e426a287 --- /dev/null +++ b/tests/wire/terminal/actions.test.ts @@ -0,0 +1,675 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Actions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + action: { + device_id: "{{DEVICE_ID}}", + deadline_duration: "PT5M", + type: "SAVE_CARD", + save_card_options: { customer_id: "{{CUSTOMER_ID}}", reference_id: "user-id-1" }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + action: { + id: "termapia:jveJIAkkAjILHkdCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "PENDING", + cancel_reason: "BUYER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:07.476Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { title: "title", body: "body", barcode_contents: "barcode_contents" }, + save_card_options: { customer_id: "CUSTOMER_ID", card_id: "card_id", reference_id: "user-id-1" }, + signature_options: { title: "title", body: "body", signature: [{}] }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + disagree_button_text: "disagree_button_text", + }, + receipt_options: { payment_id: "payment_id", print_only: true, is_duplicate: true }, + data_collection_options: { title: "title", body: "body", input_type: "EMAIL" }, + select_options: { + title: "title", + body: "body", + options: [{ reference_id: "reference_id", title: "title" }], + selected_option: { reference_id: "reference_id", title: "title" }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/actions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.actions.create({ + idempotency_key: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + action: { + device_id: "{{DEVICE_ID}}", + deadline_duration: "PT5M", + type: "SAVE_CARD", + save_card_options: { + customer_id: "{{CUSTOMER_ID}}", + reference_id: "user-id-1", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + action: { + id: "termapia:jveJIAkkAjILHkdCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "PENDING", + cancel_reason: "BUYER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:07.476Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { + title: "title", + body: "body", + barcode_contents: "barcode_contents", + }, + save_card_options: { + customer_id: "CUSTOMER_ID", + card_id: "card_id", + reference_id: "user-id-1", + }, + signature_options: { + title: "title", + body: "body", + signature: [{}], + }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + disagree_button_text: "disagree_button_text", + }, + receipt_options: { + payment_id: "payment_id", + print_only: true, + is_duplicate: true, + }, + data_collection_options: { + title: "title", + body: "body", + input_type: "EMAIL", + }, + select_options: { + title: "title", + body: "body", + options: [ + { + reference_id: "reference_id", + title: "title", + }, + ], + selected_option: { + reference_id: "reference_id", + title: "title", + }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + query: { filter: { created_at: { start_at: "2022-04-01T00:00:00.000Z" } }, sort: { sort_order: "DESC" } }, + limit: 2, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + action: [ + { + id: "termapia:oBGWlAats8xWCiCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + created_at: "2022-04-08T15:14:04.895Z", + updated_at: "2022-04-08T15:14:05.446Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { title: "title", body: "body", barcode_contents: "barcode_contents" }, + save_card_options: { customer_id: "CUSTOMER_ID", reference_id: "user-id-1" }, + signature_options: { title: "title", body: "body" }, + confirmation_options: { title: "title", body: "body", agree_button_text: "agree_button_text" }, + receipt_options: { payment_id: "payment_id" }, + data_collection_options: { title: "title", body: "body", input_type: "EMAIL" }, + select_options: { + title: "title", + body: "body", + options: [{ reference_id: "reference_id", title: "title" }], + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + { + id: "termapia:K2NY2YSSml3lTiCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2022-04-08T15:14:01.210Z", + updated_at: "2022-04-08T15:14:09.861Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { title: "title", body: "body", barcode_contents: "barcode_contents" }, + save_card_options: { + customer_id: "CUSTOMER_ID", + card_id: "ccof:CARD_ID", + reference_id: "user-id-1", + }, + signature_options: { title: "title", body: "body" }, + confirmation_options: { title: "title", body: "body", agree_button_text: "agree_button_text" }, + receipt_options: { payment_id: "payment_id" }, + data_collection_options: { title: "title", body: "body", input_type: "EMAIL" }, + select_options: { + title: "title", + body: "body", + options: [{ reference_id: "reference_id", title: "title" }], + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + ], + cursor: "CURSOR", + }; + server + .mockEndpoint() + .post("/v2/terminals/actions/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.actions.search({ + query: { + filter: { + created_at: { + start_at: "2022-04-01T00:00:00.000Z", + }, + }, + sort: { + sort_order: "DESC", + }, + }, + limit: 2, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + action: [ + { + id: "termapia:oBGWlAats8xWCiCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + created_at: "2022-04-08T15:14:04.895Z", + updated_at: "2022-04-08T15:14:05.446Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { + title: "title", + body: "body", + barcode_contents: "barcode_contents", + }, + save_card_options: { + customer_id: "CUSTOMER_ID", + reference_id: "user-id-1", + }, + signature_options: { + title: "title", + body: "body", + }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + }, + receipt_options: { + payment_id: "payment_id", + }, + data_collection_options: { + title: "title", + body: "body", + input_type: "EMAIL", + }, + select_options: { + title: "title", + body: "body", + options: [ + { + reference_id: "reference_id", + title: "title", + }, + ], + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + { + id: "termapia:K2NY2YSSml3lTiCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2022-04-08T15:14:01.210Z", + updated_at: "2022-04-08T15:14:09.861Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { + title: "title", + body: "body", + barcode_contents: "barcode_contents", + }, + save_card_options: { + customer_id: "CUSTOMER_ID", + card_id: "ccof:CARD_ID", + reference_id: "user-id-1", + }, + signature_options: { + title: "title", + body: "body", + }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + }, + receipt_options: { + payment_id: "payment_id", + }, + data_collection_options: { + title: "title", + body: "body", + input_type: "EMAIL", + }, + select_options: { + title: "title", + body: "body", + options: [ + { + reference_id: "reference_id", + title: "title", + }, + ], + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + ], + cursor: "CURSOR", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + action: { + id: "termapia:jveJIAkkAjILHkdCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:08.301Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { title: "title", body: "body", barcode_contents: "barcode_contents" }, + save_card_options: { customer_id: "CUSTOMER_ID", card_id: "card_id", reference_id: "user-id-1" }, + signature_options: { title: "title", body: "body", signature: [{}] }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + disagree_button_text: "disagree_button_text", + }, + receipt_options: { payment_id: "payment_id", print_only: true, is_duplicate: true }, + data_collection_options: { title: "title", body: "body", input_type: "EMAIL" }, + select_options: { + title: "title", + body: "body", + options: [{ reference_id: "reference_id", title: "title" }], + selected_option: { reference_id: "reference_id", title: "title" }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + }; + server + .mockEndpoint() + .get("/v2/terminals/actions/action_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.actions.get({ + action_id: "action_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + action: { + id: "termapia:jveJIAkkAjILHkdCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:08.301Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { + title: "title", + body: "body", + barcode_contents: "barcode_contents", + }, + save_card_options: { + customer_id: "CUSTOMER_ID", + card_id: "card_id", + reference_id: "user-id-1", + }, + signature_options: { + title: "title", + body: "body", + signature: [{}], + }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + disagree_button_text: "disagree_button_text", + }, + receipt_options: { + payment_id: "payment_id", + print_only: true, + is_duplicate: true, + }, + data_collection_options: { + title: "title", + body: "body", + input_type: "EMAIL", + }, + select_options: { + title: "title", + body: "body", + options: [ + { + reference_id: "reference_id", + title: "title", + }, + ], + selected_option: { + reference_id: "reference_id", + title: "title", + }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + action: { + id: "termapia:jveJIAkkAjILHkdCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "CANCELED", + cancel_reason: "SELLER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:29.511Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { title: "title", body: "body", barcode_contents: "barcode_contents" }, + save_card_options: { customer_id: "CUSTOMER_ID", card_id: "card_id", reference_id: "user-id-1" }, + signature_options: { title: "title", body: "body", signature: [{}] }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + disagree_button_text: "disagree_button_text", + }, + receipt_options: { payment_id: "payment_id", print_only: true, is_duplicate: true }, + data_collection_options: { title: "title", body: "body", input_type: "EMAIL" }, + select_options: { + title: "title", + body: "body", + options: [{ reference_id: "reference_id", title: "title" }], + selected_option: { reference_id: "reference_id", title: "title" }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/actions/action_id/cancel") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.actions.cancel({ + action_id: "action_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + action: { + id: "termapia:jveJIAkkAjILHkdCE", + device_id: "DEVICE_ID", + deadline_duration: "PT5M", + status: "CANCELED", + cancel_reason: "SELLER_CANCELED", + created_at: "2021-07-28T23:22:07.476Z", + updated_at: "2021-07-28T23:22:29.511Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + type: "SAVE_CARD", + qr_code_options: { + title: "title", + body: "body", + barcode_contents: "barcode_contents", + }, + save_card_options: { + customer_id: "CUSTOMER_ID", + card_id: "card_id", + reference_id: "user-id-1", + }, + signature_options: { + title: "title", + body: "body", + signature: [{}], + }, + confirmation_options: { + title: "title", + body: "body", + agree_button_text: "agree_button_text", + disagree_button_text: "disagree_button_text", + }, + receipt_options: { + payment_id: "payment_id", + print_only: true, + is_duplicate: true, + }, + data_collection_options: { + title: "title", + body: "body", + input_type: "EMAIL", + }, + select_options: { + title: "title", + body: "body", + options: [ + { + reference_id: "reference_id", + title: "title", + }, + ], + selected_option: { + reference_id: "reference_id", + title: "title", + }, + }, + device_metadata: { + battery_percentage: "battery_percentage", + charging_state: "charging_state", + location_id: "location_id", + merchant_id: "merchant_id", + network_connection_type: "network_connection_type", + payment_region: "payment_region", + serial_number: "serial_number", + os_version: "os_version", + app_version: "app_version", + wifi_network_name: "wifi_network_name", + wifi_network_strength: "wifi_network_strength", + ip_address: "ip_address", + }, + await_next_action: true, + await_next_action_duration: "await_next_action_duration", + }, + }); + }); +}); diff --git a/tests/wire/terminal/checkouts.test.ts b/tests/wire/terminal/checkouts.test.ts new file mode 100644 index 000000000..69bf1c37e --- /dev/null +++ b/tests/wire/terminal/checkouts.test.ts @@ -0,0 +1,503 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Checkouts", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "28a0c3bc-7839-11ea-bc55-0242ac130003", + checkout: { + amount_money: { amount: BigInt(2610), currency: "USD" }, + reference_id: "id11572", + note: "A brief note", + device_options: { device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003" }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + checkout: { + id: "08YceKh7B3ZqO", + amount_money: { amount: BigInt(2610), currency: "USD" }, + reference_id: "id11572", + note: "A brief note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + collect_signature: true, + tip_settings: { allow_tipping: false }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "PENDING", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["payment_ids"], + created_at: "2020-04-06T16:39:32.545Z", + updated_at: "2020-04-06T16:39:32.545Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + statement_description_identifier: "statement_description_identifier", + tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/checkouts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.checkouts.create({ + idempotency_key: "28a0c3bc-7839-11ea-bc55-0242ac130003", + checkout: { + amount_money: { + amount: BigInt("2610"), + currency: "USD", + }, + reference_id: "id11572", + note: "A brief note", + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + checkout: { + id: "08YceKh7B3ZqO", + amount_money: { + amount: BigInt("2610"), + currency: "USD", + }, + reference_id: "id11572", + note: "A brief note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + collect_signature: true, + tip_settings: { + allow_tipping: false, + }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "PENDING", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["payment_ids"], + created_at: "2020-04-06T16:39:32.545Z", + updated_at: "2020-04-06T16:39:32.545Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + statement_description_identifier: "statement_description_identifier", + tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { query: { filter: { status: "COMPLETED" } }, limit: 2 }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + checkouts: [ + { + id: "tsQPvzwBpMqqO", + amount_money: { amount: BigInt(2610), currency: "USD" }, + reference_id: "id14467", + note: "A brief note", + order_id: "order_id", + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + tip_settings: { allow_tipping: false }, + }, + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["rXnhZzywrEk4vR6pw76fPZfgvaB"], + created_at: "2020-03-31T18:13:15.921Z", + updated_at: "2020-03-31T18:13:52.725Z", + app_id: "APP_ID", + location_id: "location_id", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + statement_description_identifier: "statement_description_identifier", + }, + { + id: "XlOPTgcEhrbqO", + amount_money: { amount: BigInt(2610), currency: "USD" }, + reference_id: "id41623", + note: "A brief note", + order_id: "order_id", + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: true, + tip_settings: { allow_tipping: false }, + }, + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["VYBF861PaoKPP7Pih0TlbZiNvaB"], + created_at: "2020-03-31T18:08:31.882Z", + updated_at: "2020-03-31T18:08:41.635Z", + app_id: "APP_ID", + location_id: "location_id", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + statement_description_identifier: "statement_description_identifier", + }, + ], + cursor: "RiTJqBoTuXlbLmmrPvEkX9iG7XnQ4W4RjGnH", + }; + server + .mockEndpoint() + .post("/v2/terminals/checkouts/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.checkouts.search({ + query: { + filter: { + status: "COMPLETED", + }, + }, + limit: 2, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + checkouts: [ + { + id: "tsQPvzwBpMqqO", + amount_money: { + amount: BigInt("2610"), + currency: "USD", + }, + reference_id: "id14467", + note: "A brief note", + order_id: "order_id", + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + tip_settings: { + allow_tipping: false, + }, + }, + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["rXnhZzywrEk4vR6pw76fPZfgvaB"], + created_at: "2020-03-31T18:13:15.921Z", + updated_at: "2020-03-31T18:13:52.725Z", + app_id: "APP_ID", + location_id: "location_id", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + statement_description_identifier: "statement_description_identifier", + }, + { + id: "XlOPTgcEhrbqO", + amount_money: { + amount: BigInt("2610"), + currency: "USD", + }, + reference_id: "id41623", + note: "A brief note", + order_id: "order_id", + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: true, + tip_settings: { + allow_tipping: false, + }, + }, + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["VYBF861PaoKPP7Pih0TlbZiNvaB"], + created_at: "2020-03-31T18:08:31.882Z", + updated_at: "2020-03-31T18:08:41.635Z", + app_id: "APP_ID", + location_id: "location_id", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + statement_description_identifier: "statement_description_identifier", + }, + ], + cursor: "RiTJqBoTuXlbLmmrPvEkX9iG7XnQ4W4RjGnH", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + checkout: { + id: "08YceKh7B3ZqO", + amount_money: { amount: BigInt(2610), currency: "USD" }, + reference_id: "id11572", + note: "A brief note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + collect_signature: true, + tip_settings: { allow_tipping: false }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["payment_ids"], + created_at: "2020-04-06T16:39:32.545Z", + updated_at: "2020-04-06T16:39:323.001Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + statement_description_identifier: "statement_description_identifier", + tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + }; + server + .mockEndpoint() + .get("/v2/terminals/checkouts/checkout_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.checkouts.get({ + checkout_id: "checkout_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + checkout: { + id: "08YceKh7B3ZqO", + amount_money: { + amount: BigInt("2610"), + currency: "USD", + }, + reference_id: "id11572", + note: "A brief note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: false, + collect_signature: true, + tip_settings: { + allow_tipping: false, + }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "IN_PROGRESS", + cancel_reason: "BUYER_CANCELED", + payment_ids: ["payment_ids"], + created_at: "2020-04-06T16:39:32.545Z", + updated_at: "2020-04-06T16:39:323.001Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + statement_description_identifier: "statement_description_identifier", + tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + checkout: { + id: "S1yDlPQx7slqO", + amount_money: { amount: BigInt(123), currency: "USD" }, + reference_id: "id36815", + note: "note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: true, + collect_signature: true, + tip_settings: { allow_tipping: true }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "CANCELED", + cancel_reason: "SELLER_CANCELED", + payment_ids: ["payment_ids"], + created_at: "2020-03-16T15:31:19.934Z", + updated_at: "2020-03-16T15:31:45.787Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + statement_description_identifier: "statement_description_identifier", + tip_money: { amount: BigInt(1000000), currency: "UNKNOWN_CURRENCY" }, + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/checkouts/checkout_id/cancel") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.checkouts.cancel({ + checkout_id: "checkout_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + checkout: { + id: "S1yDlPQx7slqO", + amount_money: { + amount: BigInt("123"), + currency: "USD", + }, + reference_id: "id36815", + note: "note", + order_id: "order_id", + payment_options: { + autocomplete: true, + delay_duration: "delay_duration", + accept_partial_authorization: true, + delay_action: "CANCEL", + }, + device_options: { + device_id: "dbb5d83a-7838-11ea-bc55-0242ac130003", + skip_receipt_screen: true, + collect_signature: true, + tip_settings: { + allow_tipping: true, + }, + show_itemized_cart: true, + }, + deadline_duration: "PT5M", + status: "CANCELED", + cancel_reason: "SELLER_CANCELED", + payment_ids: ["payment_ids"], + created_at: "2020-03-16T15:31:19.934Z", + updated_at: "2020-03-16T15:31:45.787Z", + app_id: "APP_ID", + location_id: "LOCATION_ID", + payment_type: "CARD_PRESENT", + team_member_id: "team_member_id", + customer_id: "customer_id", + app_fee_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + statement_description_identifier: "statement_description_identifier", + tip_money: { + amount: BigInt("1000000"), + currency: "UNKNOWN_CURRENCY", + }, + }, + }); + }); +}); diff --git a/tests/wire/terminal/refunds.test.ts b/tests/wire/terminal/refunds.test.ts new file mode 100644 index 000000000..0e54830e9 --- /dev/null +++ b/tests/wire/terminal/refunds.test.ts @@ -0,0 +1,298 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Refunds", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "402a640b-b26f-401f-b406-46f839590c04", + refund: { + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + amount_money: { amount: BigInt(111), currency: "CAD" }, + reason: "Returning items", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refund: { + id: "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "refund_id", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { amount: BigInt(111), currency: "CAD" }, + reason: "Returning items", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + deadline_duration: "PT5M", + status: "PENDING", + cancel_reason: "BUYER_CANCELED", + created_at: "2020-09-29T15:21:46.771Z", + updated_at: "2020-09-29T15:21:46.771Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/refunds") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.refunds.create({ + idempotency_key: "402a640b-b26f-401f-b406-46f839590c04", + refund: { + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + amount_money: { + amount: BigInt("111"), + currency: "CAD", + }, + reason: "Returning items", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refund: { + id: "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "refund_id", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { + amount: BigInt("111"), + currency: "CAD", + }, + reason: "Returning items", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + deadline_duration: "PT5M", + status: "PENDING", + cancel_reason: "BUYER_CANCELED", + created_at: "2020-09-29T15:21:46.771Z", + updated_at: "2020-09-29T15:21:46.771Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { query: { filter: { status: "COMPLETED" } }, limit: 1 }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refunds: [ + { + id: "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { amount: BigInt(111), currency: "CAD" }, + reason: "Returning item", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2020-09-29T15:21:46.771Z", + updated_at: "2020-09-29T15:21:48.675Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/terminals/refunds/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.refunds.search({ + query: { + filter: { + status: "COMPLETED", + }, + }, + limit: 1, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refunds: [ + { + id: "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { + amount: BigInt("111"), + currency: "CAD", + }, + reason: "Returning item", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2020-09-29T15:21:46.771Z", + updated_at: "2020-09-29T15:21:48.675Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + ], + cursor: "cursor", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refund: { + id: "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { amount: BigInt(111), currency: "CAD" }, + reason: "Returning item", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2020-09-29T15:21:46.771Z", + updated_at: "2020-09-29T15:21:48.675Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + }; + server + .mockEndpoint() + .get("/v2/terminals/refunds/terminal_refund_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.refunds.get({ + terminal_refund_id: "terminal_refund_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refund: { + id: "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { + amount: BigInt("111"), + currency: "CAD", + }, + reason: "Returning item", + device_id: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + deadline_duration: "PT5M", + status: "COMPLETED", + cancel_reason: "BUYER_CANCELED", + created_at: "2020-09-29T15:21:46.771Z", + updated_at: "2020-09-29T15:21:48.675Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + }); + }); + + test("cancel", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + refund: { + id: "g6ycb6HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "refund_id", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { amount: BigInt(100), currency: "CAD" }, + reason: "reason", + device_id: "42690809-faa2-4701-a24b-19d3d34c9aaa", + deadline_duration: "PT5M", + status: "CANCELED", + cancel_reason: "SELLER_CANCELED", + created_at: "2020-10-21T22:47:23.241Z", + updated_at: "2020-10-21T22:47:30.096Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + }; + server + .mockEndpoint() + .post("/v2/terminals/refunds/terminal_refund_id/cancel") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.terminal.refunds.cancel({ + terminal_refund_id: "terminal_refund_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + refund: { + id: "g6ycb6HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", + refund_id: "refund_id", + payment_id: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + order_id: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", + amount_money: { + amount: BigInt("100"), + currency: "CAD", + }, + reason: "reason", + device_id: "42690809-faa2-4701-a24b-19d3d34c9aaa", + deadline_duration: "PT5M", + status: "CANCELED", + cancel_reason: "SELLER_CANCELED", + created_at: "2020-10-21T22:47:23.241Z", + updated_at: "2020-10-21T22:47:30.096Z", + app_id: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", + location_id: "76C9W6K8CNNQ5", + }, + }); + }); +}); diff --git a/tests/wire/v1Transactions.test.ts b/tests/wire/v1Transactions.test.ts new file mode 100644 index 000000000..55944c6e5 --- /dev/null +++ b/tests/wire/v1Transactions.test.ts @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("V1Transactions", () => { + test("V1ListOrders", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = [ + { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + id: "id", + buyer_email: "buyer_email", + recipient_name: "recipient_name", + recipient_phone_number: "recipient_phone_number", + state: "PENDING", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + subtotal_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_shipping_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_tax_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_price_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_discount_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + created_at: "created_at", + updated_at: "updated_at", + expires_at: "expires_at", + payment_id: "payment_id", + buyer_note: "buyer_note", + completed_note: "completed_note", + refunded_note: "refunded_note", + canceled_note: "canceled_note", + tender: { + id: "id", + type: "CREDIT_CARD", + name: "name", + employee_id: "employee_id", + receipt_url: "receipt_url", + card_brand: "OTHER_BRAND", + pan_suffix: "pan_suffix", + entry_method: "MANUAL", + payment_note: "payment_note", + tendered_at: "tendered_at", + settled_at: "settled_at", + is_exchange: true, + }, + order_history: [{}], + promo_code: "promo_code", + btc_receive_address: "btc_receive_address", + btc_price_satoshi: 1.1, + }, + ]; + server + .mockEndpoint() + .get("/v1/location_id/orders") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.v1Transactions.v1ListOrders({ + location_id: "location_id", + }); + expect(response).toEqual([ + { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + id: "id", + buyer_email: "buyer_email", + recipient_name: "recipient_name", + recipient_phone_number: "recipient_phone_number", + state: "PENDING", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + subtotal_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_shipping_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_tax_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_price_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_discount_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + created_at: "created_at", + updated_at: "updated_at", + expires_at: "expires_at", + payment_id: "payment_id", + buyer_note: "buyer_note", + completed_note: "completed_note", + refunded_note: "refunded_note", + canceled_note: "canceled_note", + tender: { + id: "id", + type: "CREDIT_CARD", + name: "name", + employee_id: "employee_id", + receipt_url: "receipt_url", + card_brand: "OTHER_BRAND", + pan_suffix: "pan_suffix", + entry_method: "MANUAL", + payment_note: "payment_note", + tendered_at: "tendered_at", + settled_at: "settled_at", + is_exchange: true, + }, + order_history: [{}], + promo_code: "promo_code", + btc_receive_address: "btc_receive_address", + btc_price_satoshi: 1.1, + }, + ]); + }); + + test("V1RetrieveOrder", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + id: "id", + buyer_email: "buyer_email", + recipient_name: "recipient_name", + recipient_phone_number: "recipient_phone_number", + state: "PENDING", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + subtotal_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_shipping_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_tax_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_price_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_discount_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + created_at: "created_at", + updated_at: "updated_at", + expires_at: "expires_at", + payment_id: "payment_id", + buyer_note: "buyer_note", + completed_note: "completed_note", + refunded_note: "refunded_note", + canceled_note: "canceled_note", + tender: { + id: "id", + type: "CREDIT_CARD", + name: "name", + employee_id: "employee_id", + receipt_url: "receipt_url", + card_brand: "OTHER_BRAND", + pan_suffix: "pan_suffix", + entry_method: "MANUAL", + payment_note: "payment_note", + total_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + tendered_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + tendered_at: "tendered_at", + settled_at: "settled_at", + change_back_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + refunded_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + is_exchange: true, + }, + order_history: [{ action: "ORDER_PLACED", created_at: "created_at" }], + promo_code: "promo_code", + btc_receive_address: "btc_receive_address", + btc_price_satoshi: 1.1, + }; + server + .mockEndpoint() + .get("/v1/location_id/orders/order_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.v1Transactions.v1RetrieveOrder({ + location_id: "location_id", + order_id: "order_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + id: "id", + buyer_email: "buyer_email", + recipient_name: "recipient_name", + recipient_phone_number: "recipient_phone_number", + state: "PENDING", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + subtotal_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_shipping_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_tax_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_price_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_discount_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + created_at: "created_at", + updated_at: "updated_at", + expires_at: "expires_at", + payment_id: "payment_id", + buyer_note: "buyer_note", + completed_note: "completed_note", + refunded_note: "refunded_note", + canceled_note: "canceled_note", + tender: { + id: "id", + type: "CREDIT_CARD", + name: "name", + employee_id: "employee_id", + receipt_url: "receipt_url", + card_brand: "OTHER_BRAND", + pan_suffix: "pan_suffix", + entry_method: "MANUAL", + payment_note: "payment_note", + total_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + tendered_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + tendered_at: "tendered_at", + settled_at: "settled_at", + change_back_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + refunded_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + is_exchange: true, + }, + order_history: [ + { + action: "ORDER_PLACED", + created_at: "created_at", + }, + ], + promo_code: "promo_code", + btc_receive_address: "btc_receive_address", + btc_price_satoshi: 1.1, + }); + }); + + test("V1UpdateOrder", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { action: "COMPLETE" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + id: "id", + buyer_email: "buyer_email", + recipient_name: "recipient_name", + recipient_phone_number: "recipient_phone_number", + state: "PENDING", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + subtotal_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_shipping_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_tax_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_price_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + total_discount_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + created_at: "created_at", + updated_at: "updated_at", + expires_at: "expires_at", + payment_id: "payment_id", + buyer_note: "buyer_note", + completed_note: "completed_note", + refunded_note: "refunded_note", + canceled_note: "canceled_note", + tender: { + id: "id", + type: "CREDIT_CARD", + name: "name", + employee_id: "employee_id", + receipt_url: "receipt_url", + card_brand: "OTHER_BRAND", + pan_suffix: "pan_suffix", + entry_method: "MANUAL", + payment_note: "payment_note", + total_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + tendered_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + tendered_at: "tendered_at", + settled_at: "settled_at", + change_back_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + refunded_money: { amount: 1, currency_code: "UNKNOWN_CURRENCY" }, + is_exchange: true, + }, + order_history: [{ action: "ORDER_PLACED", created_at: "created_at" }], + promo_code: "promo_code", + btc_receive_address: "btc_receive_address", + btc_price_satoshi: 1.1, + }; + server + .mockEndpoint() + .put("/v1/location_id/orders/order_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.v1Transactions.v1UpdateOrder({ + location_id: "location_id", + order_id: "order_id", + action: "COMPLETE", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + id: "id", + buyer_email: "buyer_email", + recipient_name: "recipient_name", + recipient_phone_number: "recipient_phone_number", + state: "PENDING", + shipping_address: { + address_line_1: "address_line_1", + address_line_2: "address_line_2", + address_line_3: "address_line_3", + locality: "locality", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "administrative_district_level_1", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "postal_code", + country: "ZZ", + first_name: "first_name", + last_name: "last_name", + }, + subtotal_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_shipping_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_tax_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_price_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + total_discount_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + created_at: "created_at", + updated_at: "updated_at", + expires_at: "expires_at", + payment_id: "payment_id", + buyer_note: "buyer_note", + completed_note: "completed_note", + refunded_note: "refunded_note", + canceled_note: "canceled_note", + tender: { + id: "id", + type: "CREDIT_CARD", + name: "name", + employee_id: "employee_id", + receipt_url: "receipt_url", + card_brand: "OTHER_BRAND", + pan_suffix: "pan_suffix", + entry_method: "MANUAL", + payment_note: "payment_note", + total_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + tendered_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + tendered_at: "tendered_at", + settled_at: "settled_at", + change_back_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + refunded_money: { + amount: 1, + currency_code: "UNKNOWN_CURRENCY", + }, + is_exchange: true, + }, + order_history: [ + { + action: "ORDER_PLACED", + created_at: "created_at", + }, + ], + promo_code: "promo_code", + btc_receive_address: "btc_receive_address", + btc_price_satoshi: 1.1, + }); + }); +}); diff --git a/tests/wire/vendors.test.ts b/tests/wire/vendors.test.ts new file mode 100644 index 000000000..4db5cceb0 --- /dev/null +++ b/tests/wire/vendors.test.ts @@ -0,0 +1,874 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Vendors", () => { + test("batchCreate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + vendors: { + "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + }, + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + responses: { + "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 0, + status: "ACTIVE", + }, + }, + }, + }; + server + .mockEndpoint() + .post("/v2/vendors/bulk-create") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.vendors.batchCreate({ + vendors: { + "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + responses: { + "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 0, + status: "ACTIVE", + }, + }, + }, + }); + }); + + test("batchGet", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { vendor_ids: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"] }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + responses: { + INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4: { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + }, + }, + }; + server + .mockEndpoint() + .post("/v2/vendors/bulk-retrieve") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.vendors.batchGet({ + vendor_ids: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + responses: { + INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + }, + }, + }); + }); + + test("batchUpdate", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + vendors: { FMCYHBWT1TPL8MFH52PBMEN92A: { vendor: {} }, INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4: { vendor: {} } }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + responses: { + INV_V_FMCYHBWT1TPL8MFH52PBMEN92A: { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + vendor: { + id: "INV_V_FMCYHBWT1TPL8MFH52PBMEN92A", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T20:21:54.859Z", + name: "Annie’s Hot Sauce", + address: { + address_line_1: "202 Mill St", + locality: "Moorestown", + administrative_district_level_1: "NJ", + postal_code: "08057", + country: "US", + }, + contacts: [ + { + id: "INV_VC_ABYYHBWT1TPL8MFH52PBMENPJ4", + name: "Annie Thomas", + email_address: "annie@annieshotsauce.com", + phone_number: "1-212-555-4250", + ordinal: 0, + }, + ], + version: 11, + status: "ACTIVE", + }, + }, + INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4: { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:10:54.859Z", + updated_at: "2022-03-16T20:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 0, + }, + ], + account_number: "4025391", + note: "favorite vendor", + version: 31, + status: "ACTIVE", + }, + }, + }, + }; + server + .mockEndpoint() + .put("/v2/vendors/bulk-update") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.vendors.batchUpdate({ + vendors: { + FMCYHBWT1TPL8MFH52PBMEN92A: { + vendor: {}, + }, + INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4: { + vendor: {}, + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + responses: { + INV_V_FMCYHBWT1TPL8MFH52PBMEN92A: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + vendor: { + id: "INV_V_FMCYHBWT1TPL8MFH52PBMEN92A", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T20:21:54.859Z", + name: "Annie\u2019s Hot Sauce", + address: { + address_line_1: "202 Mill St", + locality: "Moorestown", + administrative_district_level_1: "NJ", + postal_code: "08057", + country: "US", + }, + contacts: [ + { + id: "INV_VC_ABYYHBWT1TPL8MFH52PBMENPJ4", + name: "Annie Thomas", + email_address: "annie@annieshotsauce.com", + phone_number: "1-212-555-4250", + ordinal: 0, + }, + ], + version: 11, + status: "ACTIVE", + }, + }, + INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:10:54.859Z", + updated_at: "2022-03-16T20:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 0, + }, + ], + account_number: "4025391", + note: "favorite vendor", + version: 31, + status: "ACTIVE", + }, + }, + }, + }); + }); + + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + vendor: { + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + }; + server + .mockEndpoint() + .post("/v2/vendors/create") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.vendors.create({ + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + vendor: { + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + }); + }); + + test("search", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + vendors: [ + { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + ], + cursor: "cursor", + }; + server + .mockEndpoint() + .post("/v2/vendors/search") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.vendors.search(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + vendors: [ + { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + locality: "New York", + administrative_district_level_1: "NY", + postal_code: "10003", + country: "US", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + ], + cursor: "cursor", + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + }; + server + .mockEndpoint() + .get("/v2/vendors/vendor_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.vendors.get({ + vendor_id: "vendor_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T10:21:54.859Z", + name: "Joe's Fresh Seafood", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 1, + }, + ], + account_number: "4025391", + note: "a vendor", + version: 1, + status: "ACTIVE", + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + name: "Jack's Chicken Shack", + version: 1, + status: "ACTIVE", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T20:21:54.859Z", + name: "Jack's Chicken Shack", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 0, + }, + ], + account_number: "4025391", + note: "note", + version: 2, + status: "ACTIVE", + }, + }; + server + .mockEndpoint() + .put("/v2/vendors/vendor_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.vendors.update({ + vendor_id: "vendor_id", + body: { + idempotency_key: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + name: "Jack's Chicken Shack", + version: 1, + status: "ACTIVE", + }, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + created_at: "2022-03-16T10:21:54.859Z", + updated_at: "2022-03-16T20:21:54.859Z", + name: "Jack's Chicken Shack", + address: { + address_line_1: "505 Electric Ave", + address_line_2: "Suite 600", + address_line_3: "address_line_3", + locality: "New York", + sublocality: "sublocality", + sublocality_2: "sublocality_2", + sublocality_3: "sublocality_3", + administrative_district_level_1: "NY", + administrative_district_level_2: "administrative_district_level_2", + administrative_district_level_3: "administrative_district_level_3", + postal_code: "10003", + country: "US", + first_name: "first_name", + last_name: "last_name", + }, + contacts: [ + { + id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", + name: "Joe Burrow", + email_address: "joe@joesfreshseafood.com", + phone_number: "1-212-555-4250", + ordinal: 0, + }, + ], + account_number: "4025391", + note: "note", + version: 2, + status: "ACTIVE", + }, + }); + }); +}); diff --git a/tests/wire/webhooks/eventTypes.test.ts b/tests/wire/webhooks/eventTypes.test.ts new file mode 100644 index 000000000..91d8b5515 --- /dev/null +++ b/tests/wire/webhooks/eventTypes.test.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("EventTypes", () => { + test("list", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + event_types: ["inventory.count.updated"], + metadata: [ + { + event_type: "inventory.count.updated", + api_version_introduced: "2018-07-12", + release_status: "PUBLIC", + }, + ], + }; + server + .mockEndpoint() + .get("/v2/webhooks/event-types") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.webhooks.eventTypes.list(); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + event_types: ["inventory.count.updated"], + metadata: [ + { + event_type: "inventory.count.updated", + api_version_introduced: "2018-07-12", + release_status: "PUBLIC", + }, + ], + }); + }); +}); diff --git a/tests/wire/webhooks/subscriptions.test.ts b/tests/wire/webhooks/subscriptions.test.ts new file mode 100644 index 000000000..cea9b8645 --- /dev/null +++ b/tests/wire/webhooks/subscriptions.test.ts @@ -0,0 +1,296 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { SquareClient } from "../../../src/Client"; + +describe("Subscriptions", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "63f84c6c-2200-4c99-846c-2670a1311fbf", + subscription: { + name: "Example Webhook Subscription", + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + }, + }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "wbhk_b35f6b3145074cf9ad513610786c19d5", + name: "Example Webhook Subscription", + enabled: true, + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + signature_key: "1k9bIJKCeTmSQwyagtNRLg", + created_at: "2022-01-10 23:29:48 +0000 UTC", + updated_at: "2022-01-10 23:29:48 +0000 UTC", + }, + }; + server + .mockEndpoint() + .post("/v2/webhooks/subscriptions") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.webhooks.subscriptions.create({ + idempotency_key: "63f84c6c-2200-4c99-846c-2670a1311fbf", + subscription: { + name: "Example Webhook Subscription", + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "wbhk_b35f6b3145074cf9ad513610786c19d5", + name: "Example Webhook Subscription", + enabled: true, + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + signature_key: "1k9bIJKCeTmSQwyagtNRLg", + created_at: "2022-01-10 23:29:48 +0000 UTC", + updated_at: "2022-01-10 23:29:48 +0000 UTC", + }, + }); + }); + + test("get", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "wbhk_b35f6b3145074cf9ad513610786c19d5", + name: "Example Webhook Subscription", + enabled: true, + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + signature_key: "1k9bIJKCeTmSQwyagtNRLg", + created_at: "2022-01-10 23:29:48 +0000 UTC", + updated_at: "2022-01-10 23:29:48 +0000 UTC", + }, + }; + server + .mockEndpoint() + .get("/v2/webhooks/subscriptions/subscription_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.webhooks.subscriptions.get({ + subscription_id: "subscription_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "wbhk_b35f6b3145074cf9ad513610786c19d5", + name: "Example Webhook Subscription", + enabled: true, + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + signature_key: "1k9bIJKCeTmSQwyagtNRLg", + created_at: "2022-01-10 23:29:48 +0000 UTC", + updated_at: "2022-01-10 23:29:48 +0000 UTC", + }, + }); + }); + + test("update", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { subscription: { name: "Updated Example Webhook Subscription", enabled: false } }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription: { + id: "wbhk_b35f6b3145074cf9ad513610786c19d5", + name: "Updated Example Webhook Subscription", + enabled: false, + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + signature_key: "signature_key", + created_at: "2022-01-10 23:29:48 +0000 UTC", + updated_at: "2022-01-10 23:45:51 +0000 UTC", + }, + }; + server + .mockEndpoint() + .put("/v2/webhooks/subscriptions/subscription_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.webhooks.subscriptions.update({ + subscription_id: "subscription_id", + subscription: { + name: "Updated Example Webhook Subscription", + enabled: false, + }, + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription: { + id: "wbhk_b35f6b3145074cf9ad513610786c19d5", + name: "Updated Example Webhook Subscription", + enabled: false, + event_types: ["payment.created", "payment.updated"], + notification_url: "https://example-webhook-url.com", + api_version: "2021-12-15", + signature_key: "signature_key", + created_at: "2022-01-10 23:29:48 +0000 UTC", + updated_at: "2022-01-10 23:45:51 +0000 UTC", + }, + }); + }); + + test("delete", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .delete("/v2/webhooks/subscriptions/subscription_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.webhooks.subscriptions.delete({ + subscription_id: "subscription_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("updateSignatureKey", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { idempotency_key: "ed80ae6b-0654-473b-bbab-a39aee89a60d" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + signature_key: "1k9bIJKCeTmSQwyagtNRLg", + }; + server + .mockEndpoint() + .post("/v2/webhooks/subscriptions/subscription_id/signature-key") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.webhooks.subscriptions.updateSignatureKey({ + subscription_id: "subscription_id", + idempotency_key: "ed80ae6b-0654-473b-bbab-a39aee89a60d", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + signature_key: "1k9bIJKCeTmSQwyagtNRLg", + }); + }); + + test("test", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { event_type: "payment.created" }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + subscription_test_result: { + id: "23eed5a9-2b12-403e-b212-7e2889aea0f6", + status_code: 404, + 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"}}}}', + created_at: "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746", + updated_at: "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746", + }, + }; + server + .mockEndpoint() + .post("/v2/webhooks/subscriptions/subscription_id/test") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.webhooks.subscriptions.test({ + subscription_id: "subscription_id", + event_type: "payment.created", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + subscription_test_result: { + id: "23eed5a9-2b12-403e-b212-7e2889aea0f6", + status_code: 404, + 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"}}}}', + created_at: "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746", + updated_at: "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746", + }, + }); + }); +}); diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 000000000..c75083dc4 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "extendedDiagnostics": true, + "strict": true, + "target": "ES6", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "baseUrl": "src" + }, + "include": ["src"], + "exclude": [] +} diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 000000000..5c11446f5 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "dist/cjs" + }, + "include": ["src"], + "exclude": [] +} diff --git a/tsconfig.esm.json b/tsconfig.esm.json new file mode 100644 index 000000000..95a5eb739 --- /dev/null +++ b/tsconfig.esm.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + }, + "include": ["src"], + "exclude": [] +} diff --git a/tsconfig.json b/tsconfig.json index 1ec87dd77..d77fdf00d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,3 @@ { - "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": [] + "extends": "./tsconfig.cjs.json" } diff --git a/yarn.lock b/yarn.lock index 889b02fdc..ed3f9af86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -377,6 +377,60 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@bundled-es-modules/cookie@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@bundled-es-modules/cookie/-/cookie-2.0.1.tgz#b41376af6a06b3e32a15241d927b840a9b4de507" + integrity sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw== + dependencies: + cookie "^0.7.2" + +"@bundled-es-modules/statuses@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@bundled-es-modules/statuses/-/statuses-1.0.1.tgz#761d10f44e51a94902c4da48675b71a76cc98872" + integrity sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg== + dependencies: + statuses "^2.0.1" + +"@bundled-es-modules/tough-cookie@^0.1.6": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@bundled-es-modules/tough-cookie/-/tough-cookie-0.1.6.tgz#fa9cd3cedfeecd6783e8b0d378b4a99e52bde5d3" + integrity sha512-dvMHbL464C0zI+Yqxbz6kZ5TOEp7GLW+pry/RWndAR8MJQAXZ2rPmIs8tziTZjeIyhSNZgZbCePtfSbdWqStJw== + dependencies: + "@types/tough-cookie" "^4.0.5" + tough-cookie "^4.1.4" + +"@inquirer/confirm@^5.0.0": + version "5.1.13" + resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-5.1.13.tgz#4931515edc63e25d833c9a40ccf1855e8e822dbc" + integrity sha512-EkCtvp67ICIVVzjsquUiVSd+V5HRGOGQfsqA4E4vMWhYnB7InUL0pa0TIWt1i+OfP16Gkds8CdIu6yGZwOM1Yw== + dependencies: + "@inquirer/core" "^10.1.14" + "@inquirer/type" "^3.0.7" + +"@inquirer/core@^10.1.14": + version "10.1.14" + resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-10.1.14.tgz#7678b2daaecf32fa2f6e02a03dc235f9620e197f" + integrity sha512-Ma+ZpOJPewtIYl6HZHZckeX1STvDnHTCB2GVINNUlSEn2Am6LddWwfPkIGY0IUFVjUUrr/93XlBwTK6mfLjf0A== + dependencies: + "@inquirer/figures" "^1.0.12" + "@inquirer/type" "^3.0.7" + ansi-escapes "^4.3.2" + cli-width "^4.1.0" + mute-stream "^2.0.0" + signal-exit "^4.1.0" + wrap-ansi "^6.2.0" + yoctocolors-cjs "^2.1.2" + +"@inquirer/figures@^1.0.12": + version "1.0.12" + resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.12.tgz#667d6254cc7ba3b0c010a323d78024a1d30c6053" + integrity sha512-MJttijd8rMFcKJC8NYmprWr6hD3r9Gd9qUC0XwPNwoEPWSMVJwA2MlXxF+nhZZNMY+HXsWa+o7KY2emWYIn0jQ== + +"@inquirer/type@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-3.0.7.tgz#b46bcf377b3172dbc768fdbd053e6492ad801a09" + integrity sha512-PfunHQcjwnju84L+ycmcMKB/pTPIngjUJvfnRhKY6FKPuYXlM4aQCb/nIdTFR6BEhMjFvngzvng/vBAJMZpLSA== + "@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" @@ -619,6 +673,36 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@mswjs/interceptors@^0.39.1": + version "0.39.2" + resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.39.2.tgz#de9de0ab23f99d387c7904df7219a92157d1d666" + integrity sha512-RuzCup9Ct91Y7V79xwCb146RaBRHZ7NBbrIUySumd1rpKqHL5OonaqrGIbug5hNwP/fRyxFMA6ISgw4FTtYFYg== + dependencies: + "@open-draft/deferred-promise" "^2.2.0" + "@open-draft/logger" "^0.3.0" + "@open-draft/until" "^2.0.0" + is-node-process "^1.2.0" + outvariant "^1.4.3" + strict-event-emitter "^0.5.1" + +"@open-draft/deferred-promise@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz#4a822d10f6f0e316be4d67b4d4f8c9a124b073bd" + integrity sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA== + +"@open-draft/logger@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@open-draft/logger/-/logger-0.3.0.tgz#2b3ab1242b360aa0adb28b85f5d7da1c133a0954" + integrity sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ== + dependencies: + is-node-process "^1.2.0" + outvariant "^1.4.0" + +"@open-draft/until@^2.0.0", "@open-draft/until@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-2.1.0.tgz#0acf32f470af2ceaf47f095cdecd40d68666efda" + integrity sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -676,6 +760,11 @@ dependencies: "@babel/types" "^7.20.7" +"@types/cookie@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.6.0.tgz#eac397f28bf1d6ae0ae081363eca2f425bedf0d5" + integrity sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA== + "@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" @@ -745,14 +834,6 @@ 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 "24.0.14" resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.14.tgz#6e3d4fb6d858c48c69707394e1a0e08ce1ecc1bc" @@ -772,33 +853,21 @@ dependencies: undici-types "~5.26.4" -"@types/qs@^6.9.17": - version "6.14.0" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" - integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== - -"@types/readable-stream@^4.0.18": - version "4.0.21" - resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.21.tgz#716558454a5e0c3c0651520f8154efc3288f59cb" - integrity sha512-19eKVv9tugr03IgfXlA9UVUVRbW6IuqRO5B92Dl4a6pT7K8uaGrNS0GkxiZD0BOk6PLuXl5FhWl//eX/pzYdTQ== - dependencies: - "@types/node" "*" - "@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@*": +"@types/statuses@^2.0.4": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/statuses/-/statuses-2.0.6.tgz#66748315cc9a96d63403baa8671b2c124f8633aa" + integrity sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA== + +"@types/tough-cookie@*", "@types/tough-cookie@^4.0.5": 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" @@ -947,13 +1016,6 @@ abab@^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" @@ -1010,7 +1072,7 @@ ajv@^8.0.0, ajv@^8.9.0: json-schema-traverse "^1.0.0" require-from-string "^2.0.2" -ansi-escapes@^4.2.1: +ansi-escapes@^4.2.1, ansi-escapes@^4.3.2: 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== @@ -1136,11 +1198,6 @@ balanced-match@^1.0.0: 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.12" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" @@ -1192,14 +1249,6 @@ buffer-from@^1.0.0: 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, call-bind-apply-helpers@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" @@ -1208,14 +1257,6 @@ call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: es-errors "^1.3.0" function-bind "^1.1.2" -call-bound@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a" - integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== - dependencies: - call-bind-apply-helpers "^1.0.2" - get-intrinsic "^1.3.0" - callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -1264,6 +1305,11 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz#0f79731eb8cfe1ec72acd4066efac9d61991b00d" integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== +cli-width@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5" + integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ== + cliui@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" @@ -1317,6 +1363,11 @@ convert-source-map@^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== +cookie@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" + integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== + create-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" @@ -1436,9 +1487,9 @@ ejs@^3.1.10: jake "^10.8.5" electron-to-chromium@^1.5.173: - version "1.5.184" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.184.tgz#3ef8b7e1be5482d9b04ab0e467d62379d029c4b3" - integrity sha512-zlaUk/wwnR/27FHNarzOtMgfxD1Q0/2Aby7PnURumQTal7yauqQ3c2HHcG/pjLFTvF3AWv44kMWyArVlfHeDlw== + version "1.5.186" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.186.tgz#b25af3a986f7a32f74ba2813461dcd3d9dc226bb" + integrity sha512-lur7L4BFklgepaJxj4DqPk7vKbTEl0pajNlg2QjE5shefmlmBLm2HvQ7PMf1R/GvlevT/581cop33/quQcfX3A== emittery@^0.13.1: version "0.13.1" @@ -1558,12 +1609,7 @@ esutils@^2.0.2: 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: +events@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== @@ -1648,15 +1694,10 @@ follow-redirects@^1.15.6: 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.1.0" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-4.1.0.tgz#497cedc94810bd5d53b99b5d4f6c152d5cbc9db2" - integrity sha512-G6NsmEW15s0Uw9XnCg+33H3ViYRyiM0hMrMhhqQOR8NFc5GhYrI+6I3u7OTw7b91J2g8rtvMBZJDbcGb2YUniw== - form-data@^4.0.0, form-data@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.3.tgz#608b1b3f3e28be0fccf5901fc85fb3641e5cf0ae" - integrity sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA== + version "4.0.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.4.tgz#784cdcce0669a9d68e94d11ac4eea98088edd2c4" + integrity sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" @@ -1664,11 +1705,6 @@ form-data@^4.0.0, form-data@^4.0.1: hasown "^2.0.2" 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" @@ -1694,7 +1730,7 @@ get-caller-file@^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, get-intrinsic@^1.3.0: +get-intrinsic@^1.2.6: version "1.3.0" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== @@ -1755,6 +1791,11 @@ graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9: 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== +graphql@^16.8.1: + version "16.11.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.11.0.tgz#96d17f66370678027fdf59b2d4c20b4efaa8a633" + integrity sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw== + has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -1779,6 +1820,11 @@ hasown@^2.0.2: dependencies: function-bind "^1.1.2" +headers-polyfill@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07" + integrity sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ== + 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" @@ -1820,11 +1866,6 @@ iconv-lite@0.6.3: 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" @@ -1873,6 +1914,11 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== +is-node-process@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-node-process/-/is-node-process-1.2.0.tgz#ea02a1b90ddb3934a19aea414e88edef7e11d134" + integrity sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw== + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" @@ -2337,11 +2383,6 @@ jest@^29.7.0: 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" @@ -2529,6 +2570,35 @@ ms@^2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +msw@^2.8.4: + version "2.10.4" + resolved "https://registry.yarnpkg.com/msw/-/msw-2.10.4.tgz#a39dad96468aecfd752e5b7df4bbc86f1d73dec4" + integrity sha512-6R1or/qyele7q3RyPwNuvc0IxO8L8/Aim6Sz5ncXEgcWUNxSKE+udriTOWHtpMwmfkLYlacA2y7TIx4cL5lgHA== + dependencies: + "@bundled-es-modules/cookie" "^2.0.1" + "@bundled-es-modules/statuses" "^1.0.1" + "@bundled-es-modules/tough-cookie" "^0.1.6" + "@inquirer/confirm" "^5.0.0" + "@mswjs/interceptors" "^0.39.1" + "@open-draft/deferred-promise" "^2.2.0" + "@open-draft/until" "^2.1.0" + "@types/cookie" "^0.6.0" + "@types/statuses" "^2.0.4" + graphql "^16.8.1" + headers-polyfill "^4.0.2" + is-node-process "^1.2.0" + outvariant "^1.4.3" + path-to-regexp "^6.3.0" + picocolors "^1.1.1" + strict-event-emitter "^0.5.1" + type-fest "^4.26.1" + yargs "^17.7.2" + +mute-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-2.0.0.tgz#a5446fc0c512b71c83c44d908d5c7b7b4c493b2b" + integrity sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -2539,13 +2609,6 @@ neo-async@^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" @@ -2573,11 +2636,6 @@ nwsapi@^2.2.2: resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.20.tgz#22e53253c61e7b0e7e93cef42c891154bcca11ef" integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA== -object-inspect@^1.13.3: - version "1.13.4" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" - integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== - once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -2592,6 +2650,11 @@ onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" +outvariant@^1.4.0, outvariant@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.3.tgz#221c1bfc093e8fec7075497e7799fdbf43d14873" + integrity sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA== + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -2655,6 +2718,11 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-to-regexp@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.3.0.tgz#2b6a26a337737a8e1416f9272ed0766b1c0389f4" + integrity sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ== + picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" @@ -2691,11 +2759,6 @@ pretty-format@^29.0.0, pretty-format@^29.7.0: 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" @@ -2726,13 +2789,6 @@ pure-rand@^6.0.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" @@ -2750,17 +2806,6 @@ react-is@^18.0.0: 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" @@ -2802,7 +2847,7 @@ resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -safe-buffer@^5.1.0, safe-buffer@~5.2.0: +safe-buffer@^5.1.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== @@ -2858,51 +2903,16 @@ shebang-regex@^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== +signal-exit@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" @@ -2963,6 +2973,16 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" +statuses@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" + integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== + +strict-event-emitter@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz#1602ece81c51574ca39c6815e09f1a3e8550bd93" + integrity sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -2980,13 +3000,6 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: 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" @@ -3085,7 +3098,7 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tough-cookie@^4.1.2: +tough-cookie@^4.1.2, tough-cookie@^4.1.4: version "4.1.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== @@ -3102,12 +3115,7 @@ tr46@^3.0.0: 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: +ts-jest@^29.3.4: version "29.4.0" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.0.tgz#bef0ee98d94c83670af7462a1617bf2367a83740" integrity sha512-d423TJMnJGu80/eSgfQ5w/R+0zFJvdtTxwtF9KzFFunOpSeD+79lHJQIiAhluJoyGRbvj9NZJsl9WjCUo0ND7Q== @@ -3148,7 +3156,7 @@ type-fest@^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== -type-fest@^4.41.0: +type-fest@^4.26.1, type-fest@^4.41.0: version "4.41.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.41.0.tgz#6ae1c8e5731273c2bf1f58ad39cbae2c91a46c58" integrity sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA== @@ -3181,11 +3189,6 @@ update-browserslist-db@^1.1.3: escalade "^3.2.0" picocolors "^1.1.1" -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" @@ -3225,11 +3228,6 @@ watchpack@^2.4.1: 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" @@ -3291,14 +3289,6 @@ whatwg-url@^11.0.0: 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" @@ -3306,6 +3296,15 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.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" @@ -3358,7 +3357,7 @@ yargs-parser@^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: +yargs@^17.3.1, yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== @@ -3375,3 +3374,8 @@ 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== + +yoctocolors-cjs@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz#f4b905a840a37506813a7acaa28febe97767a242" + integrity sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==