diff --git a/package.json b/package.json index 6acef5d92..1fb834b6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "square", - "version": "43.1.1", + "version": "43.1.0", "private": false, "repository": "github:square/square-nodejs-sdk", "license": "MIT", diff --git a/reference.md b/reference.md index 42f62d172..cfebf6dc5 100644 --- a/reference.md +++ b/reference.md @@ -392,6 +392,9 @@ Provides summary information for a merchant's online store orders. ```typescript await client.v1Transactions.v1ListOrders({ locationId: "location_id", + order: "DESC", + limit: 1, + batchToken: "batch_token", }); ``` @@ -670,13 +673,21 @@ Returns a list of [BankAccount](entity:BankAccount) objects linked to a Square a
```typescript -const response = await client.bankAccounts.list(); +const response = await client.bankAccounts.list({ + cursor: "cursor", + limit: 1, + locationId: "location_id", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.bankAccounts.list(); +let page = await client.bankAccounts.list({ + cursor: "cursor", + limit: 1, + locationId: "location_id", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -878,13 +889,29 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ`
```typescript -const response = await client.bookings.list(); +const response = await client.bookings.list({ + limit: 1, + cursor: "cursor", + customerId: "customer_id", + teamMemberId: "team_member_id", + locationId: "location_id", + startAtMin: "start_at_min", + startAtMax: "start_at_max", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.bookings.list(); +let page = await client.bookings.list({ + limit: 1, + cursor: "cursor", + customerId: "customer_id", + teamMemberId: "team_member_id", + locationId: "location_id", + startAtMin: "start_at_min", + startAtMax: "start_at_max", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -1568,13 +1595,25 @@ A max of 25 cards will be returned.
```typescript -const response = await client.cards.list(); +const response = await client.cards.list({ + cursor: "cursor", + customerId: "customer_id", + includeDisabled: true, + referenceId: "reference_id", + sortOrder: "DESC", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.cards.list(); +let page = await client.cards.list({ + cursor: "cursor", + customerId: "customer_id", + includeDisabled: true, + referenceId: "reference_id", + sortOrder: "DESC", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -2163,13 +2202,21 @@ and set the `include_deleted_objects` attribute value to `true`.
```typescript -const response = await client.catalog.list(); +const response = await client.catalog.list({ + cursor: "cursor", + types: "types", + catalogVersion: BigInt("1000000"), +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.catalog.list(); +let page = await client.catalog.list({ + cursor: "cursor", + types: "types", + catalogVersion: BigInt("1000000"), +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -2207,7 +2254,7 @@ while (page.hasNextPage()) { -
client.catalog.search({ ...params }) -> Square.SearchCatalogObjectsResponse +
client.catalog.search({ ...params }) -> core.Page
@@ -2243,7 +2290,22 @@ endpoint in the following aspects:
```typescript -await client.catalog.search({ +const response = await client.catalog.search({ + objectTypes: ["ITEM"], + query: { + prefixQuery: { + attributeName: "name", + attributePrefix: "tea", + }, + }, + limit: 100, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.catalog.search({ objectTypes: ["ITEM"], query: { prefixQuery: { @@ -2253,6 +2315,9 @@ await client.catalog.search({ }, limit: 100, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -2287,7 +2352,7 @@ await client.catalog.search({
-
client.catalog.searchItems({ ...params }) -> Square.SearchCatalogItemsResponse +
client.catalog.searchItems({ ...params }) -> core.Page
@@ -2323,7 +2388,41 @@ endpoint in the following aspects:
```typescript -await client.catalog.searchItems({ +const response = await client.catalog.searchItems({ + textFilter: "red", + categoryIds: ["WINE_CATEGORY_ID"], + stockLevels: ["OUT", "LOW"], + enabledLocationIds: ["ATL_LOCATION_ID"], + limit: 100, + sortOrder: "ASC", + productTypes: ["REGULAR"], + customAttributeFilters: [ + { + customAttributeDefinitionId: "VEGAN_DEFINITION_ID", + boolFilter: true, + }, + { + customAttributeDefinitionId: "BRAND_DEFINITION_ID", + stringFilter: "Dark Horse", + }, + { + key: "VINTAGE", + numberFilter: { + min: "min", + max: "max", + }, + }, + { + customAttributeDefinitionId: "VARIETAL_DEFINITION_ID", + }, + ], +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.catalog.searchItems({ textFilter: "red", categoryIds: ["WINE_CATEGORY_ID"], stockLevels: ["OUT", "LOW"], @@ -2352,6 +2451,9 @@ await client.catalog.searchItems({ }, ], }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -2524,9 +2626,9 @@ await client.catalog.updateItemTaxes({
-## Customers +## Channels -
client.customers.list({ ...params }) -> core.Page +
client.channels.list({ ...params }) -> core.Page
@@ -2538,12 +2640,6 @@ await client.catalog.updateItemTaxes({
-Lists customer profiles associated with a Square account. - -Under normal operating conditions, newly created or updated customer profiles become available -for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated -profiles can take closer to one minute or longer, especially during network incidents and outages. -
@@ -2558,13 +2654,25 @@ profiles can take closer to one minute or longer, especially during network inci
```typescript -const response = await client.customers.list(); +const response = await client.channels.list({ + referenceType: "UNKNOWN_TYPE", + referenceId: "reference_id", + status: "ACTIVE", + cursor: "cursor", + limit: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.customers.list(); +let page = await client.channels.list({ + referenceType: "UNKNOWN_TYPE", + referenceId: "reference_id", + status: "ACTIVE", + cursor: "cursor", + limit: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -2583,7 +2691,7 @@ while (page.hasNextPage()) {
-**request:** `Square.ListCustomersRequest` +**request:** `Square.ListChannelsRequest`
@@ -2591,7 +2699,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Customers.RequestOptions` +**requestOptions:** `Channels.RequestOptions`
@@ -2602,7 +2710,7 @@ while (page.hasNextPage()) {
-
client.customers.create({ ...params }) -> Square.CreateCustomerResponse +
client.channels.bulkRetrieve({ ...params }) -> Square.BulkRetrieveChannelsResponse
@@ -2614,20 +2722,10 @@ while (page.hasNextPage()) {
-Creates a new customer for a business. - -You must provide at least one of the following values in your request to this -endpoint: - -- `given_name` -- `family_name` -- `company_name` -- `email_address` -- `phone_number` -
-
-
-
+
+ + + #### 🔌 Usage @@ -2638,21 +2736,8 @@ endpoint:
```typescript -await client.customers.create({ - givenName: "Amelia", - familyName: "Earhart", - emailAddress: "Amelia.Earhart@example.com", - address: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 600", - locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", - country: "US", - }, - phoneNumber: "+1-212-555-4240", - referenceId: "YOUR_REFERENCE_ID", - note: "a customer", +await client.channels.bulkRetrieve({ + channelIds: ["CH_9C03D0B59", "CH_6X139B5MN", "NOT_EXISTING"], }); ``` @@ -2669,7 +2754,7 @@ await client.customers.create({
-**request:** `Square.CreateCustomerRequest` +**request:** `Square.BulkRetrieveChannelsRequest`
@@ -2677,7 +2762,7 @@ await client.customers.create({
-**requestOptions:** `Customers.RequestOptions` +**requestOptions:** `Channels.RequestOptions`
@@ -2688,7 +2773,7 @@ await client.customers.create({ -
client.customers.batchCreate({ ...params }) -> Square.BulkCreateCustomersResponse +
client.channels.get({ ...params }) -> Square.RetrieveChannelResponse
@@ -2700,21 +2785,10 @@ await client.customers.create({
-Creates multiple [customer profiles](entity:Customer) for a business. - -This endpoint takes a map of individual create requests and returns a map of responses. - -You must provide at least one of the following values in each create request: - -- `given_name` -- `family_name` -- `company_name` -- `email_address` -- `phone_number` -
-
-
-
+
+ + + #### 🔌 Usage @@ -2725,41 +2799,8 @@ You must provide at least one of the following values in each create request:
```typescript -await client.customers.batchCreate({ - customers: { - "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { - givenName: "Amelia", - familyName: "Earhart", - emailAddress: "Amelia.Earhart@example.com", - address: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 600", - locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", - country: "US", - }, - phoneNumber: "+1-212-555-4240", - referenceId: "YOUR_REFERENCE_ID", - note: "a customer", - }, - "d1689f23-b25d-4932-b2f0-aed00f5e2029": { - givenName: "Marie", - familyName: "Curie", - emailAddress: "Marie.Curie@example.com", - address: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 601", - locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", - country: "US", - }, - phoneNumber: "+1-212-444-4240", - referenceId: "YOUR_REFERENCE_ID", - note: "another customer", - }, - }, +await client.channels.get({ + channelId: "channel_id", }); ``` @@ -2776,7 +2817,7 @@ await client.customers.batchCreate({
-**request:** `Square.BulkCreateCustomersRequest` +**request:** `Square.GetChannelsRequest`
@@ -2784,7 +2825,7 @@ await client.customers.batchCreate({
-**requestOptions:** `Customers.RequestOptions` +**requestOptions:** `Channels.RequestOptions`
@@ -2795,7 +2836,9 @@ await client.customers.batchCreate({ -
client.customers.bulkDeleteCustomers({ ...params }) -> Square.BulkDeleteCustomersResponse +## Customers + +
client.customers.list({ ...params }) -> core.Page
@@ -2807,9 +2850,11 @@ await client.customers.batchCreate({
-Deletes multiple customer profiles. +Lists customer profiles associated with a Square account. -The endpoint takes a list of customer IDs and returns a map of responses. +Under normal operating conditions, newly created or updated customer profiles become available +for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated +profiles can take closer to one minute or longer, especially during network incidents and outages.
@@ -2825,9 +2870,28 @@ The endpoint takes a list of customer IDs and returns a map of responses.
```typescript -await client.customers.bulkDeleteCustomers({ - customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], +const response = await client.customers.list({ + cursor: "cursor", + limit: 1, + sortField: "DEFAULT", + sortOrder: "DESC", + count: true, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.customers.list({ + cursor: "cursor", + limit: 1, + sortField: "DEFAULT", + sortOrder: "DESC", + count: true, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -2843,7 +2907,7 @@ await client.customers.bulkDeleteCustomers({
-**request:** `Square.BulkDeleteCustomersRequest` +**request:** `Square.ListCustomersRequest`
@@ -2862,7 +2926,7 @@ await client.customers.bulkDeleteCustomers({
-
client.customers.bulkRetrieveCustomers({ ...params }) -> Square.BulkRetrieveCustomersResponse +
client.customers.create({ ...params }) -> Square.CreateCustomerResponse
@@ -2874,14 +2938,20 @@ await client.customers.bulkDeleteCustomers({
-Retrieves multiple customer profiles. +Creates a new customer for a business. -This endpoint takes a list of customer IDs and returns a map of responses. +You must provide at least one of the following values in your request to this +endpoint: -
-
-
-
+- `given_name` +- `family_name` +- `company_name` +- `email_address` +- `phone_number` +
+ + + #### 🔌 Usage @@ -2892,8 +2962,21 @@ This endpoint takes a list of customer IDs and returns a map of responses.
```typescript -await client.customers.bulkRetrieveCustomers({ - customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], +await client.customers.create({ + givenName: "Amelia", + familyName: "Earhart", + emailAddress: "Amelia.Earhart@example.com", + address: { + addressLine1: "500 Electric Ave", + addressLine2: "Suite 600", + locality: "New York", + administrativeDistrictLevel1: "NY", + postalCode: "10003", + country: "US", + }, + phoneNumber: "+1-212-555-4240", + referenceId: "YOUR_REFERENCE_ID", + note: "a customer", }); ``` @@ -2910,7 +2993,7 @@ await client.customers.bulkRetrieveCustomers({
-**request:** `Square.BulkRetrieveCustomersRequest` +**request:** `Square.CreateCustomerRequest`
@@ -2929,7 +3012,7 @@ await client.customers.bulkRetrieveCustomers({ -
client.customers.bulkUpdateCustomers({ ...params }) -> Square.BulkUpdateCustomersResponse +
client.customers.batchCreate({ ...params }) -> Square.BulkCreateCustomersResponse
@@ -2941,14 +3024,21 @@ await client.customers.bulkRetrieveCustomers({
-Updates multiple customer profiles. +Creates multiple [customer profiles](entity:Customer) for a business. -This endpoint takes a map of individual update requests and returns a map of responses. +This endpoint takes a map of individual create requests and returns a map of responses. -
-
-
-
+You must provide at least one of the following values in each create request: + +- `given_name` +- `family_name` +- `company_name` +- `email_address` +- `phone_number` +
+ + + #### 🔌 Usage @@ -2959,17 +3049,39 @@ This endpoint takes a map of individual update requests and returns a map of res
```typescript -await client.customers.bulkUpdateCustomers({ +await client.customers.batchCreate({ customers: { - "8DDA5NZVBZFGAX0V3HPF81HHE0": { - emailAddress: "New.Amelia.Earhart@example.com", - note: "updated customer note", - version: BigInt("2"), + "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { + givenName: "Amelia", + familyName: "Earhart", + emailAddress: "Amelia.Earhart@example.com", + address: { + addressLine1: "500 Electric Ave", + addressLine2: "Suite 600", + locality: "New York", + administrativeDistrictLevel1: "NY", + postalCode: "10003", + country: "US", + }, + phoneNumber: "+1-212-555-4240", + referenceId: "YOUR_REFERENCE_ID", + note: "a customer", }, - N18CPRVXR5214XPBBA6BZQWF3C: { + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { givenName: "Marie", familyName: "Curie", - version: BigInt("0"), + emailAddress: "Marie.Curie@example.com", + address: { + addressLine1: "500 Electric Ave", + addressLine2: "Suite 601", + locality: "New York", + administrativeDistrictLevel1: "NY", + postalCode: "10003", + country: "US", + }, + phoneNumber: "+1-212-444-4240", + referenceId: "YOUR_REFERENCE_ID", + note: "another customer", }, }, }); @@ -2988,7 +3100,7 @@ await client.customers.bulkUpdateCustomers({
-**request:** `Square.BulkUpdateCustomersRequest` +**request:** `Square.BulkCreateCustomersRequest`
@@ -3007,7 +3119,7 @@ await client.customers.bulkUpdateCustomers({ -
client.customers.search({ ...params }) -> Square.SearchCustomersResponse +
client.customers.bulkDeleteCustomers({ ...params }) -> Square.BulkDeleteCustomersResponse
@@ -3019,15 +3131,9 @@ await client.customers.bulkUpdateCustomers({
-Searches the customer profiles associated with a Square account using one or more supported query filters. - -Calling `SearchCustomers` without any explicit query filter returns all -customer profiles ordered alphabetically based on `given_name` and -`family_name`. +Deletes multiple customer profiles. -Under normal operating conditions, newly created or updated customer profiles become available -for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated -profiles can take closer to one minute or longer, especially during network incidents and outages. +The endpoint takes a list of customer IDs and returns a map of responses.
@@ -3043,30 +3149,8 @@ profiles can take closer to one minute or longer, especially during network inci
```typescript -await client.customers.search({ - limit: BigInt("2"), - query: { - filter: { - creationSource: { - values: ["THIRD_PARTY"], - rule: "INCLUDE", - }, - createdAt: { - startAt: "2018-01-01T00:00:00-00:00", - endAt: "2018-02-01T00:00:00-00:00", - }, - emailAddress: { - fuzzy: "example.com", - }, - groupIds: { - all: ["545AXB44B4XXWMVQ4W8SBT3HHF"], - }, - }, - sort: { - field: "CREATED_AT", - order: "ASC", - }, - }, +await client.customers.bulkDeleteCustomers({ + customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], }); ``` @@ -3083,7 +3167,7 @@ await client.customers.search({
-**request:** `Square.SearchCustomersRequest` +**request:** `Square.BulkDeleteCustomersRequest`
@@ -3102,7 +3186,7 @@ await client.customers.search({
-
client.customers.get({ ...params }) -> Square.GetCustomerResponse +
client.customers.bulkRetrieveCustomers({ ...params }) -> Square.BulkRetrieveCustomersResponse
@@ -3114,7 +3198,9 @@ await client.customers.search({
-Returns details for a single customer. +Retrieves multiple customer profiles. + +This endpoint takes a list of customer IDs and returns a map of responses.
@@ -3130,8 +3216,8 @@ Returns details for a single customer.
```typescript -await client.customers.get({ - customerId: "customer_id", +await client.customers.bulkRetrieveCustomers({ + customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], }); ``` @@ -3148,7 +3234,7 @@ await client.customers.get({
-**request:** `Square.GetCustomersRequest` +**request:** `Square.BulkRetrieveCustomersRequest`
@@ -3167,7 +3253,7 @@ await client.customers.get({
-
client.customers.update({ ...params }) -> Square.UpdateCustomerResponse +
client.customers.bulkUpdateCustomers({ ...params }) -> Square.BulkUpdateCustomersResponse
@@ -3179,10 +3265,9 @@ await client.customers.get({
-Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. -To add or update a field, specify the new value. To remove a field, specify `null`. +Updates multiple customer profiles. -To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. +This endpoint takes a map of individual update requests and returns a map of responses.
@@ -3198,11 +3283,19 @@ 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", - note: "updated customer note", - version: BigInt("2"), +await client.customers.bulkUpdateCustomers({ + customers: { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + emailAddress: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: BigInt("2"), + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + givenName: "Marie", + familyName: "Curie", + version: BigInt("0"), + }, + }, }); ``` @@ -3219,7 +3312,7 @@ await client.customers.update({
-**request:** `Square.UpdateCustomerRequest` +**request:** `Square.BulkUpdateCustomersRequest`
@@ -3238,7 +3331,7 @@ await client.customers.update({
-
client.customers.delete({ ...params }) -> Square.DeleteCustomerResponse +
client.customers.search({ ...params }) -> core.Page
@@ -3250,9 +3343,15 @@ await client.customers.update({
-Deletes a customer profile from a business. +Searches the customer profiles associated with a Square account using one or more supported query filters. -To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. +Calling `SearchCustomers` without any explicit query filter returns all +customer profiles ordered alphabetically based on `given_name` and +`family_name`. + +Under normal operating conditions, newly created or updated customer profiles become available +for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated +profiles can take closer to one minute or longer, especially during network incidents and outages.
@@ -3268,9 +3367,64 @@ To delete a customer profile that was created by merging existing profiles, you
```typescript -await client.customers.delete({ - customerId: "customer_id", +const response = await client.customers.search({ + limit: BigInt("2"), + query: { + filter: { + creationSource: { + values: ["THIRD_PARTY"], + rule: "INCLUDE", + }, + createdAt: { + startAt: "2018-01-01T00:00:00-00:00", + endAt: "2018-02-01T00:00:00-00:00", + }, + emailAddress: { + fuzzy: "example.com", + }, + groupIds: { + all: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + }, + }, + sort: { + field: "CREATED_AT", + order: "ASC", + }, + }, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.customers.search({ + limit: BigInt("2"), + query: { + filter: { + creationSource: { + values: ["THIRD_PARTY"], + rule: "INCLUDE", + }, + createdAt: { + startAt: "2018-01-01T00:00:00-00:00", + endAt: "2018-02-01T00:00:00-00:00", + }, + emailAddress: { + fuzzy: "example.com", + }, + groupIds: { + all: ["545AXB44B4XXWMVQ4W8SBT3HHF"], + }, + }, + sort: { + field: "CREATED_AT", + order: "ASC", + }, + }, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -3286,7 +3440,7 @@ await client.customers.delete({
-**request:** `Square.DeleteCustomersRequest` +**request:** `Square.SearchCustomersRequest`
@@ -3305,9 +3459,7 @@ await client.customers.delete({
-## Devices - -
client.devices.list({ ...params }) -> core.Page +
client.customers.get({ ...params }) -> Square.GetCustomerResponse
@@ -3319,8 +3471,7 @@ await client.customers.delete({
-List devices associated with the merchant. Currently, only Terminal API -devices are supported. +Returns details for a single customer.
@@ -3336,16 +3487,9 @@ devices are supported.
```typescript -const response = await client.devices.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -let page = await client.devices.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.customers.get({ + customerId: "customer_id", +}); ```
@@ -3361,7 +3505,7 @@ while (page.hasNextPage()) {
-**request:** `Square.ListDevicesRequest` +**request:** `Square.GetCustomersRequest`
@@ -3369,7 +3513,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Devices.RequestOptions` +**requestOptions:** `Customers.RequestOptions`
@@ -3380,7 +3524,7 @@ while (page.hasNextPage()) {
-
client.devices.get({ ...params }) -> Square.GetDeviceResponse +
client.customers.update({ ...params }) -> Square.UpdateCustomerResponse
@@ -3392,7 +3536,10 @@ while (page.hasNextPage()) {
-Retrieves Device with the associated `device_id`. +Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. +To add or update a field, specify the new value. To remove a field, specify `null`. + +To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
@@ -3408,8 +3555,11 @@ Retrieves Device with the associated `device_id`.
```typescript -await client.devices.get({ - deviceId: "device_id", +await client.customers.update({ + customerId: "customer_id", + emailAddress: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: BigInt("2"), }); ``` @@ -3426,7 +3576,7 @@ await client.devices.get({
-**request:** `Square.GetDevicesRequest` +**request:** `Square.UpdateCustomerRequest`
@@ -3434,7 +3584,7 @@ await client.devices.get({
-**requestOptions:** `Devices.RequestOptions` +**requestOptions:** `Customers.RequestOptions`
@@ -3445,9 +3595,7 @@ await client.devices.get({
-## Disputes - -
client.disputes.list({ ...params }) -> core.Page +
client.customers.delete({ ...params }) -> Square.DeleteCustomerResponse
@@ -3459,7 +3607,9 @@ await client.devices.get({
-Returns a list of disputes associated with a particular account. +Deletes a customer profile from a business. + +To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
@@ -3475,16 +3625,242 @@ Returns a list of disputes associated with a particular account.
```typescript -const response = await client.disputes.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -let page = await client.disputes.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.customers.delete({ + customerId: "customer_id", + version: BigInt("1000000"), +}); +``` + +
+
+
+ + +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DeleteCustomersRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ + + + + +## Devices + +
client.devices.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List devices associated with the merchant. Currently, only Terminal API +devices are supported. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.devices.list({ + cursor: "cursor", + sortOrder: "DESC", + limit: 1, + locationId: "location_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.devices.list({ + cursor: "cursor", + sortOrder: "DESC", + limit: 1, + locationId: "location_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.ListDevicesRequest` + +
+
+ +
+
+ +**requestOptions:** `Devices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.devices.get({ ...params }) -> Square.GetDeviceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves Device with the associated `device_id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.devices.get({ + deviceId: "device_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.GetDevicesRequest` + +
+
+ +
+
+ +**requestOptions:** `Devices.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Disputes + +
client.disputes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of disputes associated with a particular account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.disputes.list({ + cursor: "cursor", + states: "INQUIRY_EVIDENCE_REQUIRED", + locationId: "location_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.disputes.list({ + cursor: "cursor", + states: "INQUIRY_EVIDENCE_REQUIRED", + locationId: "location_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -3886,13 +4262,23 @@ await client.disputes.submitEvidence({
```typescript -const response = await client.employees.list(); +const response = await client.employees.list({ + locationId: "location_id", + status: "ACTIVE", + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.employees.list(); +let page = await client.employees.list({ + locationId: "location_id", + status: "ACTIVE", + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -4198,7 +4584,9 @@ Lists all event types that you can subscribe to as webhooks or query using the E
```typescript -await client.events.listEventTypes(); +await client.events.listEventTypes({ + apiVersion: "api_version", +}); ```
@@ -4264,13 +4652,25 @@ a subset of the gift cards. Results are sorted by `created_at` in ascending orde
```typescript -const response = await client.giftCards.list(); +const response = await client.giftCards.list({ + type: "type", + state: "state", + limit: 1, + cursor: "cursor", + customerId: "customer_id", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.giftCards.list(); +let page = await client.giftCards.list({ + type: "type", + state: "state", + limit: 1, + cursor: "cursor", + customerId: "customer_id", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -4923,7 +5323,7 @@ await client.inventory.deprecatedBatchChange({
-
client.inventory.deprecatedBatchGetChanges({ ...params }) -> Square.BatchGetInventoryChangesResponse +
client.inventory.deprecatedBatchGetChanges({ ...params }) -> core.Page
@@ -4952,7 +5352,20 @@ is updated to conform to the standard convention.
```typescript -await client.inventory.deprecatedBatchGetChanges({ +const response = await client.inventory.deprecatedBatchGetChanges({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["C6W5YS5QM06F5"], + types: ["PHYSICAL_COUNT"], + states: ["IN_STOCK"], + updatedAfter: "2016-11-01T00:00:00.000Z", + updatedBefore: "2016-12-01T00:00:00.000Z", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.inventory.deprecatedBatchGetChanges({ catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], locationIds: ["C6W5YS5QM06F5"], types: ["PHYSICAL_COUNT"], @@ -4960,6 +5373,9 @@ await client.inventory.deprecatedBatchGetChanges({ updatedAfter: "2016-11-01T00:00:00.000Z", updatedBefore: "2016-12-01T00:00:00.000Z", }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -4994,7 +5410,7 @@ await client.inventory.deprecatedBatchGetChanges({
-
client.inventory.deprecatedBatchGetCounts({ ...params }) -> Square.BatchGetInventoryCountsResponse +
client.inventory.deprecatedBatchGetCounts({ ...params }) -> core.Page
@@ -5023,17 +5439,30 @@ is updated to conform to the standard convention.
```typescript -await client.inventory.deprecatedBatchGetCounts({ +const response = await client.inventory.deprecatedBatchGetCounts({ catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], locationIds: ["59TNP9SA8VGDA"], updatedAfter: "2016-11-16T00:00:00.000Z", }); -``` +for await (const item of response) { + console.log(item); +} -
-
- - +// Or you can manually iterate page-by-page +let page = await client.inventory.deprecatedBatchGetCounts({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["59TNP9SA8VGDA"], + updatedAfter: "2016-11-16T00:00:00.000Z", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + + + + + #### ⚙️ Parameters @@ -5560,6 +5989,8 @@ For more sophisticated queries, use a batch endpoint. ```typescript const response = await client.inventory.get({ catalogObjectId: "catalog_object_id", + locationIds: "location_ids", + cursor: "cursor", }); for await (const item of response) { console.log(item); @@ -5568,6 +5999,8 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.inventory.get({ catalogObjectId: "catalog_object_id", + locationIds: "location_ids", + cursor: "cursor", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5648,6 +6081,8 @@ sophisticated queries, use a batch endpoint. ```typescript const response = await client.inventory.changes({ catalogObjectId: "catalog_object_id", + locationIds: "location_ids", + cursor: "cursor", }); for await (const item of response) { console.log(item); @@ -5656,6 +6091,8 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.inventory.changes({ catalogObjectId: "catalog_object_id", + locationIds: "location_ids", + cursor: "cursor", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5728,6 +6165,8 @@ use in a subsequent request to retrieve the next set of invoices. ```typescript const response = await client.invoices.list({ locationId: "location_id", + cursor: "cursor", + limit: 1, }); for await (const item of response) { console.log(item); @@ -5736,6 +6175,8 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.invoices.list({ locationId: "location_id", + cursor: "cursor", + limit: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -5890,7 +6331,7 @@ await client.invoices.create({
-
client.invoices.search({ ...params }) -> Square.SearchInvoicesResponse +
client.invoices.search({ ...params }) -> core.Page
@@ -5924,7 +6365,25 @@ that you use in a subsequent request to retrieve the next set of invoices.
```typescript -await client.invoices.search({ +const response = await client.invoices.search({ + query: { + filter: { + locationIds: ["ES0RJRZYEC39A"], + customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"], + }, + sort: { + field: "INVOICE_SORT_DATE", + order: "DESC", + }, + }, + limit: 100, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.invoices.search({ query: { filter: { locationIds: ["ES0RJRZYEC39A"], @@ -5937,6 +6396,9 @@ await client.invoices.search({ }, limit: 100, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -6146,6 +6608,7 @@ invoice (you cannot delete a published invoice, including one that is scheduled ```typescript await client.invoices.delete({ invoiceId: "invoice_id", + version: 1, }); ``` @@ -7807,7 +8270,7 @@ await client.locations.checkouts({ ## Loyalty -
client.loyalty.searchEvents({ ...params }) -> Square.SearchLoyaltyEventsResponse +
client.loyalty.searchEvents({ ...params }) -> core.Page
@@ -7842,7 +8305,22 @@ Search results are sorted by `created_at` in descending order.
```typescript -await client.loyalty.searchEvents({ +const response = await client.loyalty.searchEvents({ + query: { + filter: { + orderFilter: { + orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + }, + }, + }, + limit: 30, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.loyalty.searchEvents({ query: { filter: { orderFilter: { @@ -7852,6 +8330,9 @@ await client.loyalty.searchEvents({ }, limit: 30, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -7925,13 +8406,17 @@ endpoint to retrieve the merchant information.
```typescript -const response = await client.merchants.list(); +const response = await client.merchants.list({ + cursor: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.merchants.list(); +let page = await client.merchants.list({ + cursor: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -8646,7 +9131,7 @@ await client.orders.clone({
-
client.orders.search({ ...params }) -> Square.SearchOrdersResponse +
client.orders.search({ ...params }) -> core.Page
@@ -8690,7 +9175,34 @@ not the time it was subsequently transmitted to Square.
```typescript -await client.orders.search({ +const response = await client.orders.search({ + locationIds: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], + query: { + filter: { + stateFilter: { + states: ["COMPLETED"], + }, + dateTimeFilter: { + closedAt: { + startAt: "2018-03-03T20:00:00+00:00", + endAt: "2019-03-04T21:54:45+00:00", + }, + }, + }, + sort: { + sortField: "CLOSED_AT", + sortOrder: "DESC", + }, + }, + limit: 3, + returnEntries: true, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.orders.search({ locationIds: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], query: { filter: { @@ -8712,6 +9224,9 @@ await client.orders.search({ limit: 3, returnEntries: true, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -9021,13 +9536,45 @@ The maximum results per page is 100.
```typescript -const response = await client.payments.list(); +const response = await client.payments.list({ + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "sort_order", + cursor: "cursor", + locationId: "location_id", + total: BigInt("1000000"), + last4: "last_4", + cardBrand: "card_brand", + limit: 1, + isOfflinePayment: true, + offlineBeginTime: "offline_begin_time", + offlineEndTime: "offline_end_time", + updatedAtBeginTime: "updated_at_begin_time", + updatedAtEndTime: "updated_at_end_time", + sortField: "CREATED_AT", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.payments.list(); +let page = await client.payments.list({ + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "sort_order", + cursor: "cursor", + locationId: "location_id", + total: BigInt("1000000"), + last4: "last_4", + cardBrand: "card_brand", + limit: 1, + isOfflinePayment: true, + offlineBeginTime: "offline_begin_time", + offlineEndTime: "offline_end_time", + updatedAtBeginTime: "updated_at_begin_time", + updatedAtEndTime: "updated_at_end_time", + sortField: "CREATED_AT", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -9535,13 +10082,29 @@ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
```typescript -const response = await client.payouts.list(); +const response = await client.payouts.list({ + locationId: "location_id", + status: "SENT", + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "DESC", + cursor: "cursor", + limit: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.payouts.list(); +let page = await client.payouts.list({ + locationId: "location_id", + status: "SENT", + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "DESC", + cursor: "cursor", + limit: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -9676,6 +10239,9 @@ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. ```typescript const response = await client.payouts.listEntries({ payoutId: "payout_id", + sortOrder: "DESC", + cursor: "cursor", + limit: 1, }); for await (const item of response) { console.log(item); @@ -9684,6 +10250,9 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.payouts.listEntries({ payoutId: "payout_id", + sortOrder: "DESC", + cursor: "cursor", + limit: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -9757,13 +10326,37 @@ The maximum results per page is 100.
```typescript -const response = await client.refunds.list(); +const response = await client.refunds.list({ + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "sort_order", + cursor: "cursor", + locationId: "location_id", + status: "status", + sourceType: "source_type", + limit: 1, + updatedAtBeginTime: "updated_at_begin_time", + updatedAtEndTime: "updated_at_end_time", + sortField: "CREATED_AT", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.refunds.list(); +let page = await client.refunds.list({ + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "sort_order", + cursor: "cursor", + locationId: "location_id", + status: "status", + sourceType: "source_type", + limit: 1, + updatedAtBeginTime: "updated_at_begin_time", + updatedAtEndTime: "updated_at_end_time", + sortField: "CREATED_AT", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -10373,7 +10966,7 @@ await client.subscriptions.bulkSwapPlan({
-
client.subscriptions.search({ ...params }) -> Square.SearchSubscriptionsResponse +
client.subscriptions.search({ ...params }) -> core.Page
@@ -10414,7 +11007,21 @@ customer by subscription creation date.
```typescript -await client.subscriptions.search({ +const response = await client.subscriptions.search({ + query: { + filter: { + customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + locationIds: ["S8GWD5R9QB376"], + sourceNames: ["My App"], + }, + }, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.subscriptions.search({ query: { filter: { customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], @@ -10423,6 +11030,9 @@ await client.subscriptions.search({ }, }, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -10487,6 +11097,7 @@ Retrieves a specific subscription. ```typescript await client.subscriptions.get({ subscriptionId: "subscription_id", + include: "include", }); ``` @@ -10821,6 +11432,8 @@ Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions ```typescript const response = await client.subscriptions.listEvents({ subscriptionId: "subscription_id", + cursor: "cursor", + limit: 1, }); for await (const item of response) { console.log(item); @@ -10829,6 +11442,8 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.subscriptions.listEvents({ subscriptionId: "subscription_id", + cursor: "cursor", + limit: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -11254,7 +11869,637 @@ await client.teamMembers.batchCreate({
-**request:** `Square.BatchCreateTeamMembersRequest` +**request:** `Square.BatchCreateTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+ +
+ + +
+
+ +
client.teamMembers.batchUpdate({ ...params }) -> Square.BatchUpdateTeamMembersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates. +This process is non-transactional and processes as much of the request as possible. If one of the updates in +the request cannot be successfully processed, the request is not marked as failed, but the body of the response +contains explicit error information for the failed update. +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.batchUpdate({ + teamMembers: { + "AFMwA08kR-MIF-3Vs0OE": { + teamMember: { + referenceId: "reference_id_2", + isOwner: false, + status: "ACTIVE", + givenName: "Jane", + familyName: "Smith", + emailAddress: "jane_smith@gmail.com", + phoneNumber: "+14159223334", + assignedLocations: { + assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + }, + }, + }, + "fpgteZNMaf0qOK-a4t6P": { + teamMember: { + referenceId: "reference_id_1", + isOwner: false, + status: "ACTIVE", + givenName: "Joe", + familyName: "Doe", + emailAddress: "joe_doe@gmail.com", + phoneNumber: "+14159283333", + assignedLocations: { + assignmentType: "EXPLICIT_LOCATIONS", + locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchUpdateTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.search({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of `TeamMember` objects for a business. +The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether +the team member is the Square account owner. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.teamMembers.search({ + query: { + filter: { + locationIds: ["0G5P3VGACMMQZ"], + status: "ACTIVE", + }, + }, + limit: 10, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.teamMembers.search({ + query: { + filter: { + locationIds: ["0G5P3VGACMMQZ"], + status: "ACTIVE", + }, + }, + limit: 10, +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.get({ ...params }) -> Square.GetTeamMemberResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a `TeamMember` object for the given `TeamMember.id`. +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.get({ + teamMemberId: "team_member_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.GetTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.update({ ...params }) -> Square.UpdateTeamMemberResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates. +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.update({ + teamMemberId: "team_member_id", + body: { + teamMember: { + referenceId: "reference_id_1", + status: "ACTIVE", + givenName: "Joe", + familyName: "Doe", + emailAddress: "joe_doe@gmail.com", + phoneNumber: "+14159283333", + assignedLocations: { + assignmentType: "EXPLICIT_LOCATIONS", + locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], + }, + wageSetting: { + jobAssignments: [ + { + payType: "SALARY", + annualRate: { + amount: BigInt("3000000"), + currency: "USD", + }, + weeklyHours: 40, + jobId: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + payType: "HOURLY", + hourlyRate: { + amount: BigInt("1200"), + currency: "USD", + }, + jobId: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + isOvertimeExempt: true, + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Team + +
client.team.listJobs({ ...params }) -> Square.ListJobsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists jobs in a seller account. Results are sorted by title in ascending order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.listJobs({ + cursor: "cursor", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.ListJobsRequest` + +
+
+ +
+
+ +**requestOptions:** `Team.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.team.createJob({ ...params }) -> Square.CreateJobResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a job in a seller account. A job defines a title and tip eligibility. Note that +compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.createJob({ + job: { + title: "Cashier", + isTipEligible: true, + }, + idempotencyKey: "idempotency-key-0", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateJobRequest` + +
+
+ +
+
+ +**requestOptions:** `Team.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.team.retrieveJob({ ...params }) -> Square.RetrieveJobResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a specified job. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.retrieveJob({ + jobId: "job_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RetrieveJobRequest` + +
+
+ +
+
+ +**requestOptions:** `Team.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.team.updateJob({ ...params }) -> Square.UpdateJobResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the title or tip eligibility of a job. Changes to the title propagate to all +`JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to +tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.updateJob({ + jobId: "job_id", + job: { + title: "Cashier 1", + isTipEligible: true, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateJobRequest`
@@ -11262,7 +12507,7 @@ await client.teamMembers.batchCreate({
-**requestOptions:** `TeamMembers.RequestOptions` +**requestOptions:** `Team.RequestOptions`
@@ -11273,7 +12518,9 @@ await client.teamMembers.batchCreate({
-
client.teamMembers.batchUpdate({ ...params }) -> Square.BatchUpdateTeamMembersResponse +## Terminal + +
client.terminal.dismissTerminalAction({ ...params }) -> Square.DismissTerminalActionResponse
@@ -11285,11 +12532,9 @@ await client.teamMembers.batchCreate({
-Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates. -This process is non-transactional and processes as much of the request as possible. If one of the updates in -the request cannot be successfully processed, the request is not marked as failed, but the body of the response -contains explicit error information for the failed update. -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members). +Dismisses a Terminal action request if the status and type of the request permits it. + +See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.
@@ -11305,38 +12550,8 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t
```typescript -await client.teamMembers.batchUpdate({ - teamMembers: { - "AFMwA08kR-MIF-3Vs0OE": { - teamMember: { - referenceId: "reference_id_2", - isOwner: false, - status: "ACTIVE", - givenName: "Jane", - familyName: "Smith", - emailAddress: "jane_smith@gmail.com", - phoneNumber: "+14159223334", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - }, - }, - "fpgteZNMaf0qOK-a4t6P": { - teamMember: { - referenceId: "reference_id_1", - isOwner: false, - status: "ACTIVE", - givenName: "Joe", - familyName: "Doe", - emailAddress: "joe_doe@gmail.com", - phoneNumber: "+14159283333", - assignedLocations: { - assignmentType: "EXPLICIT_LOCATIONS", - locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], - }, - }, - }, - }, +await client.terminal.dismissTerminalAction({ + actionId: "action_id", }); ``` @@ -11353,7 +12568,7 @@ await client.teamMembers.batchUpdate({
-**request:** `Square.BatchUpdateTeamMembersRequest` +**request:** `Square.DismissTerminalActionRequest`
@@ -11361,7 +12576,7 @@ await client.teamMembers.batchUpdate({
-**requestOptions:** `TeamMembers.RequestOptions` +**requestOptions:** `Terminal.RequestOptions`
@@ -11372,7 +12587,7 @@ await client.teamMembers.batchUpdate({
-
client.teamMembers.search({ ...params }) -> Square.SearchTeamMembersResponse +
client.terminal.dismissTerminalCheckout({ ...params }) -> Square.DismissTerminalCheckoutResponse
@@ -11384,9 +12599,7 @@ await client.teamMembers.batchUpdate({
-Returns a paginated list of `TeamMember` objects for a business. -The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether -the team member is the Square account owner. +Dismisses a Terminal checkout request if the status and type of the request permits it.
@@ -11402,14 +12615,8 @@ the team member is the Square account owner.
```typescript -await client.teamMembers.search({ - query: { - filter: { - locationIds: ["0G5P3VGACMMQZ"], - status: "ACTIVE", - }, - }, - limit: 10, +await client.terminal.dismissTerminalCheckout({ + checkoutId: "checkout_id", }); ``` @@ -11426,7 +12633,7 @@ await client.teamMembers.search({
-**request:** `Square.SearchTeamMembersRequest` +**request:** `Square.DismissTerminalCheckoutRequest`
@@ -11434,7 +12641,7 @@ await client.teamMembers.search({
-**requestOptions:** `TeamMembers.RequestOptions` +**requestOptions:** `Terminal.RequestOptions`
@@ -11445,7 +12652,7 @@ await client.teamMembers.search({
-
client.teamMembers.get({ ...params }) -> Square.GetTeamMemberResponse +
client.terminal.dismissTerminalRefund({ ...params }) -> Square.DismissTerminalRefundResponse
@@ -11457,8 +12664,7 @@ await client.teamMembers.search({
-Retrieves a `TeamMember` object for the given `TeamMember.id`. -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member). +Dismisses a Terminal refund request if the status and type of the request permits it.
@@ -11474,8 +12680,8 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t
```typescript -await client.teamMembers.get({ - teamMemberId: "team_member_id", +await client.terminal.dismissTerminalRefund({ + terminalRefundId: "terminal_refund_id", }); ``` @@ -11492,7 +12698,7 @@ await client.teamMembers.get({
-**request:** `Square.GetTeamMembersRequest` +**request:** `Square.DismissTerminalRefundRequest`
@@ -11500,7 +12706,7 @@ await client.teamMembers.get({
-**requestOptions:** `TeamMembers.RequestOptions` +**requestOptions:** `Terminal.RequestOptions`
@@ -11511,7 +12717,9 @@ await client.teamMembers.get({
-
client.teamMembers.update({ ...params }) -> Square.UpdateTeamMemberResponse +## TransferOrders + +
client.transferOrders.create({ ...params }) -> Square.CreateTransferOrderResponse
@@ -11523,8 +12731,28 @@ await client.teamMembers.get({
-Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates. -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member). +Creates a new transfer order in [DRAFT](entity:TransferOrderStatus) status. A transfer order represents the intent +to move [CatalogItemVariation](entity:CatalogItemVariation)s from one [Location](entity:Location) to another. +The source and destination locations must be different and must belong to your Square account. + +In [DRAFT](entity:TransferOrderStatus) status, you can: + +- Add or remove items +- Modify quantities +- Update shipping information +- Delete the entire order via [DeleteTransferOrder](api-endpoint:TransferOrders-DeleteTransferOrder) + +The request requires source_location_id and destination_location_id. +Inventory levels are not affected until the order is started via +[StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder). + +Common integration points: + +- Sync with warehouse management systems +- Automate regular stock transfers +- Initialize transfers from inventory optimization systems + +Creates a [transfer_order.created](webhook:transfer_order.created) webhook event.
@@ -11540,43 +12768,25 @@ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/t
```typescript -await client.teamMembers.update({ - teamMemberId: "team_member_id", - body: { - teamMember: { - referenceId: "reference_id_1", - status: "ACTIVE", - givenName: "Joe", - familyName: "Doe", - emailAddress: "joe_doe@gmail.com", - phoneNumber: "+14159283333", - assignedLocations: { - assignmentType: "EXPLICIT_LOCATIONS", - locationIds: ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"], +await client.transferOrders.create({ + idempotencyKey: "65cc0586-3e82-384s-b524-3885cffd52", + transferOrder: { + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + expectedAt: "2025-11-09T05:00:00Z", + notes: "Example transfer order for inventory redistribution between locations", + trackingNumber: "TRACK123456789", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "5", }, - wageSetting: { - jobAssignments: [ - { - payType: "SALARY", - annualRate: { - amount: BigInt("3000000"), - currency: "USD", - }, - weeklyHours: 40, - jobId: "FjS8x95cqHiMenw4f1NAUH4P", - }, - { - payType: "HOURLY", - hourlyRate: { - amount: BigInt("1200"), - currency: "USD", - }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", - }, - ], - isOvertimeExempt: true, + { + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + quantityOrdered: "3", }, - }, + ], }, }); ``` @@ -11594,7 +12804,7 @@ await client.teamMembers.update({
-**request:** `Square.UpdateTeamMembersRequest` +**request:** `Square.CreateTransferOrderRequest`
@@ -11602,7 +12812,7 @@ await client.teamMembers.update({
-**requestOptions:** `TeamMembers.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -11613,9 +12823,7 @@ await client.teamMembers.update({
-## Team - -
client.team.listJobs({ ...params }) -> Square.ListJobsResponse +
client.transferOrders.search({ ...params }) -> core.Page
@@ -11627,12 +12835,18 @@ await client.teamMembers.update({
-Lists jobs in a seller account. Results are sorted by title in ascending order. +Searches for transfer orders using filters. Returns a paginated list of matching +[TransferOrder](entity:TransferOrder)s sorted by creation date. -
-
-
-
+Common search scenarios: + +- Find orders for a source [Location](entity:Location) +- Find orders for a destination [Location](entity:Location) +- Find orders in a particular [TransferOrderStatus](entity:TransferOrderStatus) + + + + #### 🔌 Usage @@ -11643,7 +12857,44 @@ Lists jobs in a seller account. Results are sorted by title in ascending order.
```typescript -await client.team.listJobs(); +const response = await client.transferOrders.search({ + query: { + filter: { + sourceLocationIds: ["EXAMPLE_SOURCE_LOCATION_ID_123"], + destinationLocationIds: ["EXAMPLE_DEST_LOCATION_ID_456"], + statuses: ["STARTED", "PARTIALLY_RECEIVED"], + }, + sort: { + field: "UPDATED_AT", + order: "DESC", + }, + }, + cursor: "eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9", + limit: 10, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.transferOrders.search({ + query: { + filter: { + sourceLocationIds: ["EXAMPLE_SOURCE_LOCATION_ID_123"], + destinationLocationIds: ["EXAMPLE_DEST_LOCATION_ID_456"], + statuses: ["STARTED", "PARTIALLY_RECEIVED"], + }, + sort: { + field: "UPDATED_AT", + order: "DESC", + }, + }, + cursor: "eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9", + limit: 10, +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -11659,7 +12910,7 @@ await client.team.listJobs();
-**request:** `Square.ListJobsRequest` +**request:** `Square.SearchTransferOrdersRequest`
@@ -11667,7 +12918,7 @@ await client.team.listJobs();
-**requestOptions:** `Team.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -11678,7 +12929,7 @@ await client.team.listJobs();
-
client.team.createJob({ ...params }) -> Square.CreateJobResponse +
client.transferOrders.get({ ...params }) -> Square.RetrieveTransferOrderResponse
@@ -11690,13 +12941,17 @@ await client.team.listJobs();
-Creates a job in a seller account. A job defines a title and tip eligibility. Note that -compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting. +Retrieves a specific [TransferOrder](entity:TransferOrder) by ID. Returns the complete +order details including: -
-
-
-
+- Basic information (status, dates, notes) +- Line items with ordered and received quantities +- Source and destination [Location](entity:Location)s +- Tracking information (if available) + + + + #### 🔌 Usage @@ -11707,12 +12962,8 @@ compensation is defined in a [job assignment](entity:JobAssignment) in a team me
```typescript -await client.team.createJob({ - job: { - title: "Cashier", - isTipEligible: true, - }, - idempotencyKey: "idempotency-key-0", +await client.transferOrders.get({ + transferOrderId: "transfer_order_id", }); ``` @@ -11729,7 +12980,7 @@ await client.team.createJob({
-**request:** `Square.CreateJobRequest` +**request:** `Square.GetTransferOrdersRequest`
@@ -11737,7 +12988,7 @@ await client.team.createJob({
-**requestOptions:** `Team.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -11748,7 +12999,7 @@ await client.team.createJob({
-
client.team.retrieveJob({ ...params }) -> Square.RetrieveJobResponse +
client.transferOrders.update({ ...params }) -> Square.UpdateTransferOrderResponse
@@ -11760,7 +13011,10 @@ await client.team.createJob({
-Retrieves a specified job. +Updates an existing transfer order. This endpoint supports sparse updates, +allowing you to modify specific fields without affecting others. + +Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
@@ -11776,8 +13030,31 @@ Retrieves a specified job.
```typescript -await client.team.retrieveJob({ - jobId: "job_id", +await client.transferOrders.update({ + transferOrderId: "transfer_order_id", + idempotencyKey: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + transferOrder: { + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_789", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_101", + expectedAt: "2025-11-10T08:00:00Z", + notes: "Updated: Priority transfer due to low stock at destination", + trackingNumber: "TRACK987654321", + lineItems: [ + { + uid: "1", + quantityOrdered: "7", + }, + { + itemVariationId: "EXAMPLE_NEW_ITEM_VARIATION_ID_003", + quantityOrdered: "2", + }, + { + uid: "2", + remove: true, + }, + ], + }, + version: BigInt("1753109537351"), }); ``` @@ -11794,7 +13071,7 @@ await client.team.retrieveJob({
-**request:** `Square.RetrieveJobRequest` +**request:** `Square.UpdateTransferOrderRequest`
@@ -11802,7 +13079,7 @@ await client.team.retrieveJob({
-**requestOptions:** `Team.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -11813,7 +13090,7 @@ await client.team.retrieveJob({
-
client.team.updateJob({ ...params }) -> Square.UpdateJobResponse +
client.transferOrders.delete({ ...params }) -> Square.DeleteTransferOrderResponse
@@ -11825,9 +13102,11 @@ await client.team.retrieveJob({
-Updates the title or tip eligibility of a job. Changes to the title propagate to all -`JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to -tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID. +Deletes a transfer order in [DRAFT](entity:TransferOrderStatus) status. +Only draft orders can be deleted. Once an order is started via +[StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder), it can no longer be deleted. + +Creates a [transfer_order.deleted](webhook:transfer_order.deleted) webhook event.
@@ -11843,12 +13122,9 @@ tip eligibility propagate to all `TeamMemberWage` objects that reference the job
```typescript -await client.team.updateJob({ - jobId: "job_id", - job: { - title: "Cashier 1", - isTipEligible: true, - }, +await client.transferOrders.delete({ + transferOrderId: "transfer_order_id", + version: BigInt("1000000"), }); ``` @@ -11865,7 +13141,7 @@ await client.team.updateJob({
-**request:** `Square.UpdateJobRequest` +**request:** `Square.DeleteTransferOrdersRequest`
@@ -11873,7 +13149,7 @@ await client.team.updateJob({
-**requestOptions:** `Team.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -11882,11 +13158,9 @@ await client.team.updateJob({
-
- -## Terminal +
-
client.terminal.dismissTerminalAction({ ...params }) -> Square.DismissTerminalActionResponse +
client.transferOrders.cancel({ ...params }) -> Square.CancelTransferOrderResponse
@@ -11898,9 +13172,17 @@ await client.team.updateJob({
-Dismisses a Terminal action request if the status and type of the request permits it. +Cancels a transfer order in [STARTED](entity:TransferOrderStatus) or +[PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. Any unreceived quantities will no +longer be receivable and will be immediately returned to the source [Location](entity:Location)'s inventory. -See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details. +Common reasons for cancellation: + +- Items no longer needed at destination +- Source location needs the inventory +- Order created in error + +Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
@@ -11916,8 +13198,10 @@ See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/
```typescript -await client.terminal.dismissTerminalAction({ - actionId: "action_id", +await client.transferOrders.cancel({ + transferOrderId: "transfer_order_id", + idempotencyKey: "65cc0586-3e82-4d08-b524-3885cffd52", + version: BigInt("1753117449752"), }); ``` @@ -11934,7 +13218,7 @@ await client.terminal.dismissTerminalAction({
-**request:** `Square.DismissTerminalActionRequest` +**request:** `Square.CancelTransferOrderRequest`
@@ -11942,7 +13226,7 @@ await client.terminal.dismissTerminalAction({
-**requestOptions:** `Terminal.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -11953,7 +13237,7 @@ await client.terminal.dismissTerminalAction({
-
client.terminal.dismissTerminalCheckout({ ...params }) -> Square.DismissTerminalCheckoutResponse +
client.transferOrders.receive({ ...params }) -> Square.ReceiveTransferOrderResponse
@@ -11965,7 +13249,23 @@ await client.terminal.dismissTerminalAction({
-Dismisses a Terminal checkout request if the status and type of the request permits it. +Records receipt of [CatalogItemVariation](entity:CatalogItemVariation)s for a transfer order. +This endpoint supports partial receiving - you can receive items in multiple batches. + +For each line item, you can specify: + +- Quantity received in good condition (added to destination inventory with [InventoryState](entity:InventoryState) of IN_STOCK) +- Quantity damaged during transit/handling (added to destination inventory with [InventoryState](entity:InventoryState) of WASTE) +- Quantity canceled (returned to source location's inventory) + +The order must be in [STARTED](entity:TransferOrderStatus) or [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. +Received quantities are added to the destination [Location](entity:Location)'s inventory according to their condition. +Canceled quantities are immediately returned to the source [Location](entity:Location)'s inventory. + +When all items are either received, damaged, or canceled, the order moves to +[COMPLETED](entity:TransferOrderStatus) status. + +Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
@@ -11981,8 +13281,25 @@ Dismisses a Terminal checkout request if the status and type of the request perm
```typescript -await client.terminal.dismissTerminalCheckout({ - checkoutId: "checkout_id", +await client.transferOrders.receive({ + transferOrderId: "transfer_order_id", + idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_101", + receipt: { + lineItems: [ + { + transferOrderLineUid: "transfer_order_line_uid", + quantityReceived: "3", + quantityDamaged: "1", + quantityCanceled: "1", + }, + { + transferOrderLineUid: "transfer_order_line_uid", + quantityReceived: "2", + quantityCanceled: "1", + }, + ], + }, + version: BigInt("1753118664873"), }); ``` @@ -11999,7 +13316,7 @@ await client.terminal.dismissTerminalCheckout({
-**request:** `Square.DismissTerminalCheckoutRequest` +**request:** `Square.ReceiveTransferOrderRequest`
@@ -12007,7 +13324,7 @@ await client.terminal.dismissTerminalCheckout({
-**requestOptions:** `Terminal.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -12018,7 +13335,7 @@ await client.terminal.dismissTerminalCheckout({
-
client.terminal.dismissTerminalRefund({ ...params }) -> Square.DismissTerminalRefundResponse +
client.transferOrders.start({ ...params }) -> Square.StartTransferOrderResponse
@@ -12030,7 +13347,14 @@ await client.terminal.dismissTerminalCheckout({
-Dismisses a Terminal refund request if the status and type of the request permits it. +Changes a [DRAFT](entity:TransferOrderStatus) transfer order to [STARTED](entity:TransferOrderStatus) status. +This decrements inventory at the source [Location](entity:Location) and marks it as in-transit. + +The order must be in [DRAFT](entity:TransferOrderStatus) status and have all required fields populated. +Once started, the order can no longer be deleted, but it can be canceled via +[CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder). + +Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
@@ -12046,8 +13370,10 @@ Dismisses a Terminal refund request if the status and type of the request permit
```typescript -await client.terminal.dismissTerminalRefund({ - terminalRefundId: "terminal_refund_id", +await client.transferOrders.start({ + transferOrderId: "transfer_order_id", + idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_789", + version: BigInt("1753109537351"), }); ``` @@ -12064,7 +13390,7 @@ await client.terminal.dismissTerminalRefund({
-**request:** `Square.DismissTerminalRefundRequest` +**request:** `Square.StartTransferOrderRequest`
@@ -12072,7 +13398,7 @@ await client.terminal.dismissTerminalRefund({
-**requestOptions:** `Terminal.RequestOptions` +**requestOptions:** `TransferOrders.RequestOptions`
@@ -12395,7 +13721,7 @@ await client.vendors.create({
-
client.vendors.search({ ...params }) -> Square.SearchVendorsResponse +
client.vendors.search({ ...params }) -> core.Page
@@ -12423,7 +13749,16 @@ Searches for vendors using a filter against supported [Vendor](entity:Vendor) pr
```typescript -await client.vendors.search(); +const response = await client.vendors.search(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.vendors.search(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -12630,13 +13965,19 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ`
```typescript -const response = await client.bookings.customAttributeDefinitions.list(); +const response = await client.bookings.customAttributeDefinitions.list({ + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.bookings.customAttributeDefinitions.list(); +let page = await client.bookings.customAttributeDefinitions.list({ + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -12778,6 +14119,7 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` ```typescript await client.bookings.customAttributeDefinitions.get({ key: "key", + version: 1, }); ``` @@ -13143,6 +14485,9 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` ```typescript const response = await client.bookings.customAttributes.list({ bookingId: "booking_id", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); for await (const item of response) { console.log(item); @@ -13151,6 +14496,9 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.bookings.customAttributes.list({ bookingId: "booking_id", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -13223,6 +14571,8 @@ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` await client.bookings.customAttributes.get({ bookingId: "booking_id", key: "key", + withDefinition: true, + version: 1, }); ``` @@ -13433,13 +14783,19 @@ Lists location booking profiles of a seller.
```typescript -const response = await client.bookings.locationProfiles.list(); +const response = await client.bookings.locationProfiles.list({ + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.bookings.locationProfiles.list(); +let page = await client.bookings.locationProfiles.list({ + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -13507,13 +14863,23 @@ Lists booking profiles for team members.
```typescript -const response = await client.bookings.teamMemberProfiles.list(); +const response = await client.bookings.teamMemberProfiles.list({ + bookableOnly: true, + limit: 1, + cursor: "cursor", + locationId: "location_id", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.bookings.teamMemberProfiles.list(); +let page = await client.bookings.teamMemberProfiles.list({ + bookableOnly: true, + limit: 1, + cursor: "cursor", + locationId: "location_id", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -13649,6 +15015,11 @@ in a date range. ```typescript const response = await client.cashDrawers.shifts.list({ locationId: "location_id", + sortOrder: "DESC", + beginTime: "begin_time", + endTime: "end_time", + limit: 1, + cursor: "cursor", }); for await (const item of response) { console.log(item); @@ -13657,6 +15028,11 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.cashDrawers.shifts.list({ locationId: "location_id", + sortOrder: "DESC", + beginTime: "begin_time", + endTime: "end_time", + limit: 1, + cursor: "cursor", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -13793,6 +15169,8 @@ Provides a paginated list of events for a single cash drawer shift. const response = await client.cashDrawers.shifts.listEvents({ shiftId: "shift_id", locationId: "location_id", + limit: 1, + cursor: "cursor", }); for await (const item of response) { console.log(item); @@ -13802,6 +15180,8 @@ for await (const item of response) { let page = await client.cashDrawers.shifts.listEvents({ shiftId: "shift_id", locationId: "location_id", + limit: 1, + cursor: "cursor", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -14089,6 +15469,9 @@ any [CatalogTax](entity:CatalogTax) objects that apply to it. ```typescript await client.catalog.object.get({ objectId: "object_id", + includeRelatedObjects: true, + catalogVersion: BigInt("1000000"), + includeCategoryPathToRoot: true, }); ``` @@ -14228,13 +15611,19 @@ Lists all payment links.
```typescript -const response = await client.checkout.paymentLinks.list(); +const response = await client.checkout.paymentLinks.list({ + cursor: "cursor", + limit: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.checkout.paymentLinks.list(); +let page = await client.checkout.paymentLinks.list({ + cursor: "cursor", + limit: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -14583,13 +15972,19 @@ seller-defined custom attributes (also known as custom fields) are always set to
```typescript -const response = await client.customers.customAttributeDefinitions.list(); +const response = await client.customers.customAttributeDefinitions.list({ + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.customers.customAttributeDefinitions.list(); +let page = await client.customers.customAttributeDefinitions.list({ + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -14744,6 +16139,7 @@ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note t ```typescript await client.customers.customAttributeDefinitions.get({ key: "key", + version: 1, }); ``` @@ -15068,13 +16464,19 @@ Retrieves the list of customer groups of a business.
```typescript -const response = await client.customers.groups.list(); +const response = await client.customers.groups.list({ + cursor: "cursor", + limit: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.customers.groups.list(); +let page = await client.customers.groups.list({ + cursor: "cursor", + limit: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -15547,13 +16949,19 @@ Retrieves the list of customer segments of a business.
```typescript -const response = await client.customers.segments.list(); +const response = await client.customers.segments.list({ + cursor: "cursor", + limit: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.customers.segments.list(); +let page = await client.customers.segments.list({ + cursor: "cursor", + limit: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -15842,6 +17250,9 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.customers.customAttributes.list({ customerId: "customer_id", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); for await (const item of response) { console.log(item); @@ -15850,6 +17261,9 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.customers.customAttributes.list({ customerId: "customer_id", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -15926,6 +17340,8 @@ To retrieve a custom attribute owned by another application, the `visibility` se await client.customers.customAttributes.get({ customerId: "customer_id", key: "key", + withDefinition: true, + version: 1, }); ``` @@ -16138,13 +17554,23 @@ Lists all DeviceCodes associated with the merchant.
```typescript -const response = await client.devices.codes.list(); +const response = await client.devices.codes.list({ + cursor: "cursor", + locationId: "location_id", + productType: "TERMINAL_API", + status: "UNKNOWN", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.devices.codes.list(); +let page = await client.devices.codes.list({ + cursor: "cursor", + locationId: "location_id", + productType: "TERMINAL_API", + status: "UNKNOWN", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -16350,6 +17776,7 @@ Returns a list of evidence associated with a dispute. ```typescript const response = await client.disputes.evidence.list({ disputeId: "dispute_id", + cursor: "cursor", }); for await (const item of response) { console.log(item); @@ -16358,6 +17785,7 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.disputes.evidence.list({ disputeId: "dispute_id", + cursor: "cursor", }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -16564,13 +17992,31 @@ for all gift cards in a specific region, or for activities within a time window.
```typescript -const response = await client.giftCards.activities.list(); +const response = await client.giftCards.activities.list({ + giftCardId: "gift_card_id", + type: "type", + locationId: "location_id", + beginTime: "begin_time", + endTime: "end_time", + limit: 1, + cursor: "cursor", + sortOrder: "sort_order", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.giftCards.activities.list(); +let page = await client.giftCards.activities.list({ + giftCardId: "gift_card_id", + type: "type", + locationId: "location_id", + beginTime: "begin_time", + endTime: "end_time", + limit: 1, + cursor: "cursor", + sortOrder: "sort_order", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -16713,13 +18159,21 @@ Returns a paginated list of `BreakType` instances for a business.
```typescript -const response = await client.labor.breakTypes.list(); +const response = await client.labor.breakTypes.list({ + locationId: "location_id", + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.labor.breakTypes.list(); +let page = await client.labor.breakTypes.list({ + locationId: "location_id", + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -17075,13 +18529,21 @@ Returns a paginated list of `EmployeeWage` instances for a business.
```typescript -const response = await client.labor.employeeWages.list(); +const response = await client.labor.employeeWages.list({ + employeeId: "employee_id", + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.labor.employeeWages.list(); +let page = await client.labor.employeeWages.list({ + employeeId: "employee_id", + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -17296,7 +18758,7 @@ await client.labor.shifts.create({
-
client.labor.shifts.search({ ...params }) -> Square.SearchShiftsResponse +
client.labor.shifts.search({ ...params }) -> core.Page
@@ -17338,7 +18800,27 @@ The list can be sorted by:
```typescript -await client.labor.shifts.search({ +const response = await client.labor.shifts.search({ + query: { + filter: { + workday: { + dateRange: { + startDate: "2019-01-20", + endDate: "2019-02-03", + }, + matchShiftsBy: "START_AT", + defaultTimezone: "America/Los_Angeles", + }, + }, + }, + limit: 100, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.labor.shifts.search({ query: { filter: { workday: { @@ -17353,6 +18835,9 @@ await client.labor.shifts.search({ }, limit: 100, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -17648,13 +19133,21 @@ Returns a paginated list of `TeamMemberWage` instances for a business.
```typescript -const response = await client.labor.teamMemberWages.list(); +const response = await client.labor.teamMemberWages.list({ + teamMemberId: "team_member_id", + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.labor.teamMemberWages.list(); +let page = await client.labor.teamMemberWages.list({ + teamMemberId: "team_member_id", + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -17787,13 +19280,19 @@ Returns a list of `WorkweekConfig` instances for a business.
```typescript -const response = await client.labor.workweekConfigs.list(); +const response = await client.labor.workweekConfigs.list({ + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.labor.workweekConfigs.list(); +let page = await client.labor.workweekConfigs.list({ + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -17934,13 +19433,21 @@ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`
```typescript -const response = await client.locations.customAttributeDefinitions.list(); +const response = await client.locations.customAttributeDefinitions.list({ + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.locations.customAttributeDefinitions.list(); +let page = await client.locations.customAttributeDefinitions.list({ + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -18089,6 +19596,7 @@ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript await client.locations.customAttributeDefinitions.get({ key: "key", + version: 1, }); ``` @@ -18474,6 +19982,10 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.locations.customAttributes.list({ locationId: "location_id", + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); for await (const item of response) { console.log(item); @@ -18482,6 +19994,10 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.locations.customAttributes.list({ locationId: "location_id", + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -18555,6 +20071,8 @@ To retrieve a custom attribute owned by another application, the `visibility` se await client.locations.customAttributes.get({ locationId: "location_id", key: "key", + withDefinition: true, + version: 1, }); ``` @@ -18769,6 +20287,10 @@ Max results per [page](https://developer.squareup.com/docs/working-with-apis/pag ```typescript await client.locations.transactions.list({ locationId: "location_id", + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "DESC", + cursor: "cursor", }); ``` @@ -19083,7 +20605,7 @@ await client.loyalty.accounts.create({
-
client.loyalty.accounts.search({ ...params }) -> Square.SearchLoyaltyAccountsResponse +
client.loyalty.accounts.search({ ...params }) -> core.Page
@@ -19115,7 +20637,22 @@ Search results are sorted by `created_at` in ascending order.
```typescript -await client.loyalty.accounts.search({ +const response = await client.loyalty.accounts.search({ + query: { + mappings: [ + { + phoneNumber: "+14155551234", + }, + ], + }, + limit: 10, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.loyalty.accounts.search({ query: { mappings: [ { @@ -19125,6 +20662,9 @@ await client.loyalty.accounts.search({ }, limit: 10, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -19666,7 +21206,7 @@ await client.loyalty.rewards.create({
-
client.loyalty.rewards.search({ ...params }) -> Square.SearchLoyaltyRewardsResponse +
client.loyalty.rewards.search({ ...params }) -> core.Page
@@ -19700,12 +21240,26 @@ Search results are sorted by `updated_at` in descending order.
```typescript -await client.loyalty.rewards.search({ +const response = await client.loyalty.rewards.search({ + query: { + loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + }, + limit: 10, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.loyalty.rewards.search({ query: { loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", }, limit: 10, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -19988,6 +21542,9 @@ 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", + status: "ACTIVE", + cursor: "cursor", + limit: 1, }); for await (const item of response) { console.log(item); @@ -19996,6 +21553,9 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.loyalty.programs.promotions.list({ programId: "program_id", + status: "ACTIVE", + cursor: "cursor", + limit: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -20157,8 +21717,8 @@ Retrieves a loyalty promotion. ```typescript await client.loyalty.programs.promotions.get({ - promotionId: "promotion_id", programId: "program_id", + promotionId: "promotion_id", }); ``` @@ -20228,8 +21788,8 @@ This endpoint sets the loyalty promotion to the `CANCELED` state ```typescript await client.loyalty.programs.promotions.cancel({ - promotionId: "promotion_id", programId: "program_id", + promotionId: "promotion_id", }); ``` @@ -20298,13 +21858,21 @@ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`
```typescript -const response = await client.merchants.customAttributeDefinitions.list(); +const response = await client.merchants.customAttributeDefinitions.list({ + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.merchants.customAttributeDefinitions.list(); +let page = await client.merchants.customAttributeDefinitions.list({ + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -20453,6 +22021,7 @@ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript await client.merchants.customAttributeDefinitions.get({ key: "key", + version: 1, }); ``` @@ -20828,6 +22397,10 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.merchants.customAttributes.list({ merchantId: "merchant_id", + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); for await (const item of response) { console.log(item); @@ -20836,6 +22409,10 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.merchants.customAttributes.list({ merchantId: "merchant_id", + visibilityFilter: "ALL", + limit: 1, + cursor: "cursor", + withDefinitions: true, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -20909,6 +22486,8 @@ To retrieve a custom attribute owned by another application, the `visibility` se await client.merchants.customAttributes.get({ merchantId: "merchant_id", key: "key", + withDefinition: true, + version: 1, }); ``` @@ -21121,13 +22700,21 @@ seller-defined custom attributes (also known as custom fields) are always set to
```typescript -const response = await client.orders.customAttributeDefinitions.list(); +const response = await client.orders.customAttributeDefinitions.list({ + visibilityFilter: "ALL", + cursor: "cursor", + limit: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.orders.customAttributeDefinitions.list(); +let page = await client.orders.customAttributeDefinitions.list({ + visibilityFilter: "ALL", + cursor: "cursor", + limit: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -21277,6 +22864,7 @@ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note t ```typescript await client.orders.customAttributeDefinitions.get({ key: "key", + version: 1, }); ``` @@ -21673,6 +23261,10 @@ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. ```typescript const response = await client.orders.customAttributes.list({ orderId: "order_id", + visibilityFilter: "ALL", + cursor: "cursor", + limit: 1, + withDefinitions: true, }); for await (const item of response) { console.log(item); @@ -21681,6 +23273,10 @@ for await (const item of response) { // Or you can manually iterate page-by-page let page = await client.orders.customAttributes.list({ orderId: "order_id", + visibilityFilter: "ALL", + cursor: "cursor", + limit: 1, + withDefinitions: true, }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -21757,6 +23353,8 @@ also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. await client.orders.customAttributes.get({ orderId: "order_id", customAttributeKey: "custom_attribute_key", + version: 1, + withDefinition: true, }); ``` @@ -22183,7 +23781,7 @@ await client.terminal.actions.create({
-
client.terminal.actions.search({ ...params }) -> Square.SearchTerminalActionsResponse +
client.terminal.actions.search({ ...params }) -> core.Page
@@ -22211,7 +23809,25 @@ Retrieves a filtered list of Terminal action requests created by the account mak
```typescript -await client.terminal.actions.search({ +const response = await client.terminal.actions.search({ + query: { + filter: { + createdAt: { + startAt: "2022-04-01T00:00:00.000Z", + }, + }, + sort: { + sortOrder: "DESC", + }, + }, + limit: 2, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.terminal.actions.search({ query: { filter: { createdAt: { @@ -22224,6 +23840,9 @@ await client.terminal.actions.search({ }, limit: 2, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -22467,7 +24086,7 @@ await client.terminal.checkouts.create({
-
client.terminal.checkouts.search({ ...params }) -> Square.SearchTerminalCheckoutsResponse +
client.terminal.checkouts.search({ ...params }) -> core.Page
@@ -22495,7 +24114,20 @@ Returns a filtered list of Terminal checkout requests created by the application
```typescript -await client.terminal.checkouts.search({ +const response = await client.terminal.checkouts.search({ + query: { + filter: { + status: "COMPLETED", + }, + }, + limit: 2, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.terminal.checkouts.search({ query: { filter: { status: "COMPLETED", @@ -22503,6 +24135,9 @@ await client.terminal.checkouts.search({ }, limit: 2, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -22743,7 +24378,7 @@ await client.terminal.refunds.create({
-
client.terminal.refunds.search({ ...params }) -> Square.SearchTerminalRefundsResponse +
client.terminal.refunds.search({ ...params }) -> core.Page
@@ -22771,7 +24406,20 @@ Retrieves a filtered list of Interac Terminal refund requests created by the sel
```typescript -await client.terminal.refunds.search({ +const response = await client.terminal.refunds.search({ + query: { + filter: { + status: "COMPLETED", + }, + }, + limit: 1, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.terminal.refunds.search({ query: { filter: { status: "COMPLETED", @@ -22779,6 +24427,9 @@ await client.terminal.refunds.search({ }, limit: 1, }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -22973,7 +24624,9 @@ Lists all webhook event types that can be subscribed to.
```typescript -await client.webhooks.eventTypes.list(); +await client.webhooks.eventTypes.list({ + apiVersion: "api_version", +}); ```
@@ -23038,13 +24691,23 @@ Lists all webhook subscriptions owned by your application.
```typescript -const response = await client.webhooks.subscriptions.list(); +const response = await client.webhooks.subscriptions.list({ + cursor: "cursor", + includeDisabled: true, + sortOrder: "DESC", + limit: 1, +}); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.webhooks.subscriptions.list(); +let page = await client.webhooks.subscriptions.list({ + cursor: "cursor", + includeDisabled: true, + sortOrder: "DESC", + limit: 1, +}); while (page.hasNextPage()) { page = page.getNextPage(); } diff --git a/src/Client.ts b/src/Client.ts index 19d30e5b7..dfc978661 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -13,6 +13,7 @@ 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 { Channels } from "./api/resources/channels/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"; @@ -36,6 +37,7 @@ 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 { TransferOrders } from "./api/resources/transferOrders/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"; @@ -47,7 +49,7 @@ export declare namespace SquareClient { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -61,7 +63,7 @@ export declare namespace SquareClient { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -77,6 +79,7 @@ export class SquareClient { protected _bookings: Bookings | undefined; protected _cards: Cards | undefined; protected _catalog: Catalog | undefined; + protected _channels: Channels | undefined; protected _customers: Customers | undefined; protected _devices: Devices | undefined; protected _disputes: Disputes | undefined; @@ -100,6 +103,7 @@ export class SquareClient { protected _teamMembers: TeamMembers | undefined; protected _team: Team | undefined; protected _terminal: Terminal | undefined; + protected _transferOrders: TransferOrders | undefined; protected _vendors: Vendors | undefined; protected _cashDrawers: CashDrawers | undefined; protected _webhooks: Webhooks | undefined; @@ -109,11 +113,11 @@ export class SquareClient { ..._options, headers: mergeHeaders( { - "Square-Version": _options?.version ?? "2025-09-24", + "Square-Version": _options?.version ?? "2025-10-16", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "square", - "X-Fern-SDK-Version": "43.1.1", - "User-Agent": "square/43.1.1", + "X-Fern-SDK-Version": "43.1.0", + "User-Agent": "square/43.1.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -154,6 +158,10 @@ export class SquareClient { return (this._catalog ??= new Catalog(this._options)); } + public get channels(): Channels { + return (this._channels ??= new Channels(this._options)); + } + public get customers(): Customers { return (this._customers ??= new Customers(this._options)); } @@ -246,6 +254,10 @@ export class SquareClient { return (this._terminal ??= new Terminal(this._options)); } + public get transferOrders(): TransferOrders { + return (this._transferOrders ??= new TransferOrders(this._options)); + } + public get vendors(): Vendors { return (this._vendors ??= new Vendors(this._options)); } diff --git a/src/api/resources/applePay/client/Client.ts b/src/api/resources/applePay/client/Client.ts index c3d94787f..c22f1f0b2 100644 --- a/src/api/resources/applePay/client/Client.ts +++ b/src/api/resources/applePay/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace ApplePay { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace ApplePay { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -90,7 +90,7 @@ export class ApplePay { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/bankAccounts/client/Client.ts b/src/api/resources/bankAccounts/client/Client.ts index 9b187eb16..6604d5b6f 100644 --- a/src/api/resources/bankAccounts/client/Client.ts +++ b/src/api/resources/bankAccounts/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace BankAccounts { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace BankAccounts { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,11 @@ export class BankAccounts { * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.bankAccounts.list() + * await client.bankAccounts.list({ + * cursor: "cursor", + * limit: 1, + * locationId: "location_id" + * }) */ public async list( request: Square.ListBankAccountsRequest = {}, @@ -83,7 +87,7 @@ export class BankAccounts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -177,7 +181,7 @@ export class BankAccounts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -261,7 +265,7 @@ export class BankAccounts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts b/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts index b5ffadfe8..e7aa36957 100644 --- a/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts +++ b/src/api/resources/bankAccounts/client/requests/ListBankAccountsRequest.ts @@ -4,7 +4,11 @@ /** * @example - * {} + * { + * cursor: "cursor", + * limit: 1, + * locationId: "location_id" + * } */ export interface ListBankAccountsRequest { /** diff --git a/src/api/resources/bookings/client/Client.ts b/src/api/resources/bookings/client/Client.ts index bb61ca529..995525cbb 100644 --- a/src/api/resources/bookings/client/Client.ts +++ b/src/api/resources/bookings/client/Client.ts @@ -20,7 +20,7 @@ export declare namespace Bookings { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -34,7 +34,7 @@ export declare namespace Bookings { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -77,7 +77,15 @@ export class Bookings { * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.bookings.list() + * await client.bookings.list({ + * limit: 1, + * cursor: "cursor", + * customerId: "customer_id", + * teamMemberId: "team_member_id", + * locationId: "location_id", + * startAtMin: "start_at_min", + * startAtMax: "start_at_max" + * }) */ public async list( request: Square.ListBookingsRequest = {}, @@ -120,7 +128,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -226,7 +234,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -319,7 +327,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -410,7 +418,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -491,7 +499,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -574,7 +582,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -658,7 +666,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -750,7 +758,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -838,7 +846,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -931,7 +939,7 @@ export class Bookings { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/bookings/client/requests/ListBookingsRequest.ts b/src/api/resources/bookings/client/requests/ListBookingsRequest.ts index e57f99b22..f8d24958d 100644 --- a/src/api/resources/bookings/client/requests/ListBookingsRequest.ts +++ b/src/api/resources/bookings/client/requests/ListBookingsRequest.ts @@ -4,7 +4,15 @@ /** * @example - * {} + * { + * limit: 1, + * cursor: "cursor", + * customerId: "customer_id", + * teamMemberId: "team_member_id", + * locationId: "location_id", + * startAtMin: "start_at_min", + * startAtMax: "start_at_max" + * } */ export interface ListBookingsRequest { /** diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts index 0c3e2205e..c73c8d222 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributeDefinitions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributeDefinitions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -53,7 +53,10 @@ export class CustomAttributeDefinitions { * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.bookings.customAttributeDefinitions.list() + * await client.bookings.customAttributeDefinitions.list({ + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.bookings.ListCustomAttributeDefinitionsRequest = {}, @@ -83,7 +86,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -187,7 +190,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -252,7 +255,8 @@ export class CustomAttributeDefinitions { * * @example * await client.bookings.customAttributeDefinitions.get({ - * key: "key" + * key: "key", + * version: 1 * }) */ public get( @@ -284,7 +288,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -375,7 +379,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -470,7 +474,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts index 9b086bfb6..e4c05d712 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * key: "key" + * key: "key", + * version: 1 * } */ export interface GetCustomAttributeDefinitionsRequest { diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts index ebdc049cc..ded39f5a0 100644 --- a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -4,7 +4,10 @@ /** * @example - * {} + * { + * limit: 1, + * cursor: "cursor" + * } */ export interface ListCustomAttributeDefinitionsRequest { /** diff --git a/src/api/resources/bookings/resources/customAttributes/client/Client.ts b/src/api/resources/bookings/resources/customAttributes/client/Client.ts index db77e7928..a96a72a7f 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/Client.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -88,7 +88,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -187,7 +187,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -252,7 +252,10 @@ export class CustomAttributes { * * @example * await client.bookings.customAttributes.list({ - * bookingId: "booking_id" + * bookingId: "booking_id", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * }) */ public async list( @@ -286,7 +289,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -359,7 +362,9 @@ export class CustomAttributes { * @example * await client.bookings.customAttributes.get({ * bookingId: "booking_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * }) */ public get( @@ -395,7 +400,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -487,7 +492,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -583,7 +588,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..2dc919041 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -6,7 +6,9 @@ * @example * { * bookingId: "booking_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * } */ export interface GetCustomAttributesRequest { 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..bab55c3f7 100644 --- a/src/api/resources/bookings/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -5,7 +5,10 @@ /** * @example * { - * bookingId: "booking_id" + * bookingId: "booking_id", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * } */ export interface ListCustomAttributesRequest { diff --git a/src/api/resources/bookings/resources/locationProfiles/client/Client.ts b/src/api/resources/bookings/resources/locationProfiles/client/Client.ts index 3ef976809..09dd6d406 100644 --- a/src/api/resources/bookings/resources/locationProfiles/client/Client.ts +++ b/src/api/resources/bookings/resources/locationProfiles/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace LocationProfiles { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace LocationProfiles { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,10 @@ export class LocationProfiles { * @param {LocationProfiles.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.bookings.locationProfiles.list() + * await client.bookings.locationProfiles.list({ + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.bookings.ListLocationProfilesRequest = {}, @@ -80,7 +83,7 @@ export class LocationProfiles { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/bookings/resources/locationProfiles/client/requests/ListLocationProfilesRequest.ts b/src/api/resources/bookings/resources/locationProfiles/client/requests/ListLocationProfilesRequest.ts index 1cc29a3f2..03d1b8bfc 100644 --- a/src/api/resources/bookings/resources/locationProfiles/client/requests/ListLocationProfilesRequest.ts +++ b/src/api/resources/bookings/resources/locationProfiles/client/requests/ListLocationProfilesRequest.ts @@ -4,7 +4,10 @@ /** * @example - * {} + * { + * limit: 1, + * cursor: "cursor" + * } */ export interface ListLocationProfilesRequest { /** diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts index 5841ae00e..d0f230f5f 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace TeamMemberProfiles { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace TeamMemberProfiles { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,12 @@ export class TeamMemberProfiles { * @param {TeamMemberProfiles.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.bookings.teamMemberProfiles.list() + * await client.bookings.teamMemberProfiles.list({ + * bookableOnly: true, + * limit: 1, + * cursor: "cursor", + * locationId: "location_id" + * }) */ public async list( request: Square.bookings.ListTeamMemberProfilesRequest = {}, @@ -86,7 +91,7 @@ export class TeamMemberProfiles { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -182,7 +187,7 @@ export class TeamMemberProfiles { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..bb7d124ab 100644 --- a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/ListTeamMemberProfilesRequest.ts +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/ListTeamMemberProfilesRequest.ts @@ -4,7 +4,12 @@ /** * @example - * {} + * { + * bookableOnly: true, + * limit: 1, + * cursor: "cursor", + * locationId: "location_id" + * } */ export interface ListTeamMemberProfilesRequest { /** diff --git a/src/api/resources/cards/client/Client.ts b/src/api/resources/cards/client/Client.ts index 7574d82d6..c11419162 100644 --- a/src/api/resources/cards/client/Client.ts +++ b/src/api/resources/cards/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Cards { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Cards { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -51,7 +51,13 @@ export class Cards { * @param {Cards.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.cards.list() + * await client.cards.list({ + * cursor: "cursor", + * customerId: "customer_id", + * includeDisabled: true, + * referenceId: "reference_id", + * sortOrder: "DESC" + * }) */ public async list( request: Square.ListCardsRequest = {}, @@ -91,7 +97,7 @@ export class Cards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -198,7 +204,7 @@ export class Cards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -285,7 +291,7 @@ export class Cards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -367,7 +373,7 @@ export class Cards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/cards/client/requests/ListCardsRequest.ts b/src/api/resources/cards/client/requests/ListCardsRequest.ts index 44df40e49..ae1540aa5 100644 --- a/src/api/resources/cards/client/requests/ListCardsRequest.ts +++ b/src/api/resources/cards/client/requests/ListCardsRequest.ts @@ -6,7 +6,13 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * cursor: "cursor", + * customerId: "customer_id", + * includeDisabled: true, + * referenceId: "reference_id", + * sortOrder: "DESC" + * } */ export interface ListCardsRequest { /** diff --git a/src/api/resources/cashDrawers/client/Client.ts b/src/api/resources/cashDrawers/client/Client.ts index 5b580eb2a..bc71ccec3 100644 --- a/src/api/resources/cashDrawers/client/Client.ts +++ b/src/api/resources/cashDrawers/client/Client.ts @@ -13,7 +13,7 @@ export declare namespace CashDrawers { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; diff --git a/src/api/resources/cashDrawers/resources/shifts/client/Client.ts b/src/api/resources/cashDrawers/resources/shifts/client/Client.ts index 182fea033..090764a15 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/Client.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Shifts { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Shifts { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -52,7 +52,12 @@ export class Shifts { * * @example * await client.cashDrawers.shifts.list({ - * locationId: "location_id" + * locationId: "location_id", + * sortOrder: "DESC", + * beginTime: "begin_time", + * endTime: "end_time", + * limit: 1, + * cursor: "cursor" * }) */ public async list( @@ -96,7 +101,7 @@ export class Shifts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -196,7 +201,7 @@ export class Shifts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -254,7 +259,9 @@ export class Shifts { * @example * await client.cashDrawers.shifts.listEvents({ * shiftId: "shift_id", - * locationId: "location_id" + * locationId: "location_id", + * limit: 1, + * cursor: "cursor" * }) */ public async listEvents( @@ -286,7 +293,7 @@ export class Shifts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..69d274f2b 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/requests/ListEventsShiftsRequest.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/ListEventsShiftsRequest.ts @@ -6,7 +6,9 @@ * @example * { * shiftId: "shift_id", - * locationId: "location_id" + * locationId: "location_id", + * limit: 1, + * cursor: "cursor" * } */ export interface ListEventsShiftsRequest { 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..711f5a9cf 100644 --- a/src/api/resources/cashDrawers/resources/shifts/client/requests/ListShiftsRequest.ts +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/ListShiftsRequest.ts @@ -7,7 +7,12 @@ import * as Square from "../../../../../../index"; /** * @example * { - * locationId: "location_id" + * locationId: "location_id", + * sortOrder: "DESC", + * beginTime: "begin_time", + * endTime: "end_time", + * limit: 1, + * cursor: "cursor" * } */ export interface ListShiftsRequest { diff --git a/src/api/resources/catalog/client/Client.ts b/src/api/resources/catalog/client/Client.ts index e1758f968..c6ce86bfb 100644 --- a/src/api/resources/catalog/client/Client.ts +++ b/src/api/resources/catalog/client/Client.ts @@ -18,7 +18,7 @@ export declare namespace Catalog { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -32,7 +32,7 @@ export declare namespace Catalog { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -102,7 +102,7 @@ export class Catalog { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -194,7 +194,7 @@ export class Catalog { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -307,7 +307,7 @@ export class Catalog { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -387,7 +387,7 @@ export class Catalog { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -447,7 +447,11 @@ export class Catalog { * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.catalog.list() + * await client.catalog.list({ + * cursor: "cursor", + * types: "types", + * catalogVersion: BigInt("1000000") + * }) */ public async list( request: Square.ListCatalogRequest = {}, @@ -478,7 +482,7 @@ export class Catalog { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -564,79 +568,88 @@ export class Catalog { * limit: 100 * }) */ - public search( - request: Square.SearchCatalogObjectsRequest = {}, - requestOptions?: Catalog.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); - } - - private async __search( + public async search( request: Square.SearchCatalogObjectsRequest = {}, requestOptions?: Catalog.RequestOptions, - ): 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/catalog/search", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchCatalogObjectsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchCatalogObjectsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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/catalog/search."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchCatalogObjectsRequest, + ): 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/catalog/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchCatalogObjectsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } + if (_response.ok) { + return { + data: serializers.SearchCatalogObjectsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/catalog/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + 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)); + }, + }); } /** @@ -680,81 +693,90 @@ export class Catalog { * }] * }) */ - public searchItems( + public async searchItems( request: Square.SearchCatalogItemsRequest = {}, requestOptions?: Catalog.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchCatalogItemsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchCatalogItemsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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/catalog/search-catalog-items.", - ); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchCatalogItemsRequest, + ): 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/catalog/search-catalog-items", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchCatalogItemsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } + if (_response.ok) { + return { + data: serializers.SearchCatalogItemsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/catalog/search-catalog-items.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.items ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -795,7 +817,7 @@ export class Catalog { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -887,7 +909,7 @@ export class Catalog { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/catalog/client/requests/ListCatalogRequest.ts b/src/api/resources/catalog/client/requests/ListCatalogRequest.ts index 5a2363cda..def3b3f15 100644 --- a/src/api/resources/catalog/client/requests/ListCatalogRequest.ts +++ b/src/api/resources/catalog/client/requests/ListCatalogRequest.ts @@ -4,7 +4,11 @@ /** * @example - * {} + * { + * cursor: "cursor", + * types: "types", + * catalogVersion: BigInt("1000000") + * } */ export interface ListCatalogRequest { /** diff --git a/src/api/resources/catalog/resources/images/client/Client.ts b/src/api/resources/catalog/resources/images/client/Client.ts index 29dfd4f09..dedc2fcf4 100644 --- a/src/api/resources/catalog/resources/images/client/Client.ts +++ b/src/api/resources/catalog/resources/images/client/Client.ts @@ -17,7 +17,7 @@ export declare namespace Images { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -31,7 +31,7 @@ export declare namespace Images { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -99,7 +99,7 @@ export class Images { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", ..._maybeEncodedRequest.headers, }), requestOptions?.headers, @@ -204,7 +204,7 @@ export class Images { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", ..._maybeEncodedRequest.headers, }), requestOptions?.headers, diff --git a/src/api/resources/catalog/resources/object/client/Client.ts b/src/api/resources/catalog/resources/object/client/Client.ts index 2c126f730..51bb3c6c5 100644 --- a/src/api/resources/catalog/resources/object/client/Client.ts +++ b/src/api/resources/catalog/resources/object/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Object_ { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Object_ { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -85,7 +85,7 @@ export class Object_ { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -151,7 +151,10 @@ export class Object_ { * * @example * await client.catalog.object.get({ - * objectId: "object_id" + * objectId: "object_id", + * includeRelatedObjects: true, + * catalogVersion: BigInt("1000000"), + * includeCategoryPathToRoot: true * }) */ public get( @@ -191,7 +194,7 @@ export class Object_ { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -284,7 +287,7 @@ export class Object_ { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..a39970258 100644 --- a/src/api/resources/catalog/resources/object/client/requests/GetObjectRequest.ts +++ b/src/api/resources/catalog/resources/object/client/requests/GetObjectRequest.ts @@ -5,7 +5,10 @@ /** * @example * { - * objectId: "object_id" + * objectId: "object_id", + * includeRelatedObjects: true, + * catalogVersion: BigInt("1000000"), + * includeCategoryPathToRoot: true * } */ export interface GetObjectRequest { diff --git a/src/api/resources/channels/client/Client.ts b/src/api/resources/channels/client/Client.ts new file mode 100644 index 000000000..42016aa0d --- /dev/null +++ b/src/api/resources/channels/client/Client.ts @@ -0,0 +1,336 @@ +/** + * 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 { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers"; +import * as errors from "../../../../errors/index"; + +export declare namespace Channels { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-10-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-10-16"; + /** Additional headers to include in the request. */ + headers?: Record | undefined>; + } +} + +export class Channels { + protected readonly _options: Channels.Options; + + constructor(_options: Channels.Options = {}) { + this._options = _options; + } + + /** + * + * + * @param {Square.ListChannelsRequest} request + * @param {Channels.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.channels.list({ + * referenceType: "UNKNOWN_TYPE", + * referenceId: "reference_id", + * status: "ACTIVE", + * cursor: "cursor", + * limit: 1 + * }) + */ + public async list( + request: Square.ListChannelsRequest = {}, + requestOptions?: Channels.RequestOptions, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.ListChannelsRequest): Promise> => { + const { referenceType, referenceId, status, cursor, limit } = request; + const _queryParams: Record = {}; + if (referenceType !== undefined) { + _queryParams["reference_type"] = serializers.ReferenceType.jsonOrThrow(referenceType, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (referenceId !== undefined) { + _queryParams["reference_id"] = referenceId; + } + if (status !== undefined) { + _queryParams["status"] = serializers.ChannelStatus.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: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/channels", + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.ListChannelsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/channels."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.channels ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * + * + * @param {Square.BulkRetrieveChannelsRequest} request + * @param {Channels.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.channels.bulkRetrieve({ + * channelIds: ["CH_9C03D0B59", "CH_6X139B5MN", "NOT_EXISTING"] + * }) + */ + public bulkRetrieve( + request: Square.BulkRetrieveChannelsRequest, + requestOptions?: Channels.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__bulkRetrieve(request, requestOptions)); + } + + private async __bulkRetrieve( + request: Square.BulkRetrieveChannelsRequest, + requestOptions?: Channels.RequestOptions, + ): 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/channels/bulk-retrieve", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.BulkRetrieveChannelsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.BulkRetrieveChannelsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/channels/bulk-retrieve."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * + * + * @param {Square.GetChannelsRequest} request + * @param {Channels.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.channels.get({ + * channelId: "channel_id" + * }) + */ + public get( + request: Square.GetChannelsRequest, + requestOptions?: Channels.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetChannelsRequest, + requestOptions?: Channels.RequestOptions, + ): Promise> { + const { channelId } = request; + 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/channels/${encodeURIComponent(channelId)}`, + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.RetrieveChannelResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/channels/{channel_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/channels/client/index.ts b/src/api/resources/channels/client/index.ts new file mode 100644 index 000000000..f33205a0f --- /dev/null +++ b/src/api/resources/channels/client/index.ts @@ -0,0 +1,2 @@ +export {}; +export * from "./requests"; diff --git a/src/api/resources/channels/client/requests/BulkRetrieveChannelsRequest.ts b/src/api/resources/channels/client/requests/BulkRetrieveChannelsRequest.ts new file mode 100644 index 000000000..42c908fd0 --- /dev/null +++ b/src/api/resources/channels/client/requests/BulkRetrieveChannelsRequest.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * channelIds: ["CH_9C03D0B59", "CH_6X139B5MN", "NOT_EXISTING"] + * } + */ +export interface BulkRetrieveChannelsRequest { + channelIds: string[]; +} diff --git a/src/api/resources/channels/client/requests/GetChannelsRequest.ts b/src/api/resources/channels/client/requests/GetChannelsRequest.ts new file mode 100644 index 000000000..eb452888a --- /dev/null +++ b/src/api/resources/channels/client/requests/GetChannelsRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * channelId: "channel_id" + * } + */ +export interface GetChannelsRequest { + /** + * A channel id + */ + channelId: string; +} diff --git a/src/api/resources/channels/client/requests/ListChannelsRequest.ts b/src/api/resources/channels/client/requests/ListChannelsRequest.ts new file mode 100644 index 000000000..52e45208d --- /dev/null +++ b/src/api/resources/channels/client/requests/ListChannelsRequest.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * referenceType: "UNKNOWN_TYPE", + * referenceId: "reference_id", + * status: "ACTIVE", + * cursor: "cursor", + * limit: 1 + * } + */ +export interface ListChannelsRequest { + /** + * Type of reference associated to channel + */ + referenceType?: Square.ReferenceType | null; + /** + * id of reference associated to channel + */ + referenceId?: string | null; + /** + * Status of channel + */ + status?: Square.ChannelStatus | null; + /** + * Cursor to fetch the next result + */ + cursor?: string | null; + /** + * Maximum number of results to return. + * When not provided the returned results will be cap at 100 channels. + */ + limit?: number | null; +} diff --git a/src/api/resources/channels/client/requests/index.ts b/src/api/resources/channels/client/requests/index.ts new file mode 100644 index 000000000..8255049a1 --- /dev/null +++ b/src/api/resources/channels/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type ListChannelsRequest } from "./ListChannelsRequest"; +export { type BulkRetrieveChannelsRequest } from "./BulkRetrieveChannelsRequest"; +export { type GetChannelsRequest } from "./GetChannelsRequest"; diff --git a/src/api/resources/channels/index.ts b/src/api/resources/channels/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/channels/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/checkout/client/Client.ts b/src/api/resources/checkout/client/Client.ts index ed4bded17..80aca7915 100644 --- a/src/api/resources/checkout/client/Client.ts +++ b/src/api/resources/checkout/client/Client.ts @@ -17,7 +17,7 @@ export declare namespace Checkout { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -31,7 +31,7 @@ export declare namespace Checkout { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -84,7 +84,7 @@ export class Checkout { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -168,7 +168,7 @@ export class Checkout { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -251,7 +251,7 @@ export class Checkout { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -333,7 +333,7 @@ export class Checkout { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/checkout/resources/paymentLinks/client/Client.ts b/src/api/resources/checkout/resources/paymentLinks/client/Client.ts index 74fa15dbd..0cab603d1 100644 --- a/src/api/resources/checkout/resources/paymentLinks/client/Client.ts +++ b/src/api/resources/checkout/resources/paymentLinks/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace PaymentLinks { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace PaymentLinks { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,10 @@ export class PaymentLinks { * @param {PaymentLinks.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.checkout.paymentLinks.list() + * await client.checkout.paymentLinks.list({ + * cursor: "cursor", + * limit: 1 + * }) */ public async list( request: Square.checkout.ListPaymentLinksRequest = {}, @@ -80,7 +83,7 @@ export class PaymentLinks { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -183,7 +186,7 @@ export class PaymentLinks { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -272,7 +275,7 @@ export class PaymentLinks { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -363,7 +366,7 @@ export class PaymentLinks { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -452,7 +455,7 @@ export class PaymentLinks { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/ListPaymentLinksRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/ListPaymentLinksRequest.ts index eda441448..ebcb3acd2 100644 --- a/src/api/resources/checkout/resources/paymentLinks/client/requests/ListPaymentLinksRequest.ts +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/ListPaymentLinksRequest.ts @@ -4,7 +4,10 @@ /** * @example - * {} + * { + * cursor: "cursor", + * limit: 1 + * } */ export interface ListPaymentLinksRequest { /** diff --git a/src/api/resources/customers/client/Client.ts b/src/api/resources/customers/client/Client.ts index bf3c05dd8..ac505a324 100644 --- a/src/api/resources/customers/client/Client.ts +++ b/src/api/resources/customers/client/Client.ts @@ -21,7 +21,7 @@ export declare namespace Customers { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -35,7 +35,7 @@ export declare namespace Customers { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -84,7 +84,13 @@ export class Customers { * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.customers.list() + * await client.customers.list({ + * cursor: "cursor", + * limit: 1, + * sortField: "DEFAULT", + * sortOrder: "DESC", + * count: true + * }) */ public async list( request: Square.ListCustomersRequest = {}, @@ -129,7 +135,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -244,7 +250,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -373,7 +379,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -461,7 +467,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -549,7 +555,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -648,7 +654,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -741,79 +747,88 @@ export class Customers { * } * }) */ - public search( - request: Square.SearchCustomersRequest = {}, - requestOptions?: Customers.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); - } - - private async __search( + public async search( request: Square.SearchCustomersRequest = {}, requestOptions?: Customers.RequestOptions, - ): 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/customers/search", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchCustomersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchCustomersResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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/customers/search."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchCustomersRequest, + ): 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/customers/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchCustomersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } + if (_response.ok) { + return { + data: serializers.SearchCustomersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/customers/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + 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)); + }, + }); } /** @@ -851,7 +866,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -938,7 +953,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1000,7 +1015,8 @@ export class Customers { * * @example * await client.customers.delete({ - * customerId: "customer_id" + * customerId: "customer_id", + * version: BigInt("1000000") * }) */ public delete( @@ -1032,7 +1048,7 @@ export class Customers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts b/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts index af3a62bb6..7e0dc540a 100644 --- a/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/DeleteCustomersRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * customerId: "customer_id" + * customerId: "customer_id", + * version: BigInt("1000000") * } */ export interface DeleteCustomersRequest { diff --git a/src/api/resources/customers/client/requests/ListCustomersRequest.ts b/src/api/resources/customers/client/requests/ListCustomersRequest.ts index 6d319949c..c10f2c512 100644 --- a/src/api/resources/customers/client/requests/ListCustomersRequest.ts +++ b/src/api/resources/customers/client/requests/ListCustomersRequest.ts @@ -6,7 +6,13 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * cursor: "cursor", + * limit: 1, + * sortField: "DEFAULT", + * sortOrder: "DESC", + * count: true + * } */ export interface ListCustomersRequest { /** diff --git a/src/api/resources/customers/resources/cards/client/Client.ts b/src/api/resources/customers/resources/cards/client/Client.ts index 856308c40..5758d6dca 100644 --- a/src/api/resources/customers/resources/cards/client/Client.ts +++ b/src/api/resources/customers/resources/cards/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Cards { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Cards { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -92,7 +92,7 @@ export class Cards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -182,7 +182,7 @@ export class Cards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts index c181fe772..20e37876d 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributeDefinitions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributeDefinitions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -55,7 +55,10 @@ export class CustomAttributeDefinitions { * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.customers.customAttributeDefinitions.list() + * await client.customers.customAttributeDefinitions.list({ + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.customers.ListCustomAttributeDefinitionsRequest = {}, @@ -85,7 +88,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -201,7 +204,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -267,7 +270,8 @@ export class CustomAttributeDefinitions { * * @example * await client.customers.customAttributeDefinitions.get({ - * key: "key" + * key: "key", + * version: 1 * }) */ public get( @@ -299,7 +303,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -393,7 +397,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -487,7 +491,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -618,7 +622,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts index 9b086bfb6..e4c05d712 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * key: "key" + * key: "key", + * version: 1 * } */ export interface GetCustomAttributeDefinitionsRequest { diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts index ebdc049cc..ded39f5a0 100644 --- a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -4,7 +4,10 @@ /** * @example - * {} + * { + * limit: 1, + * cursor: "cursor" + * } */ export interface ListCustomAttributeDefinitionsRequest { /** diff --git a/src/api/resources/customers/resources/customAttributes/client/Client.ts b/src/api/resources/customers/resources/customAttributes/client/Client.ts index e7c1b22ac..1f255afb0 100644 --- a/src/api/resources/customers/resources/customAttributes/client/Client.ts +++ b/src/api/resources/customers/resources/customAttributes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -58,7 +58,10 @@ export class CustomAttributes { * * @example * await client.customers.customAttributes.list({ - * customerId: "customer_id" + * customerId: "customer_id", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * }) */ public async list( @@ -92,7 +95,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -169,7 +172,9 @@ export class CustomAttributes { * @example * await client.customers.customAttributes.get({ * customerId: "customer_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * }) */ public get( @@ -205,7 +210,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -301,7 +306,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -395,7 +400,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..dec991b8a 100644 --- a/src/api/resources/customers/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/customers/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -6,7 +6,9 @@ * @example * { * customerId: "customer_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * } */ export interface GetCustomAttributesRequest { 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..61d16f54a 100644 --- a/src/api/resources/customers/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/customers/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -5,7 +5,10 @@ /** * @example * { - * customerId: "customer_id" + * customerId: "customer_id", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * } */ export interface ListCustomAttributesRequest { diff --git a/src/api/resources/customers/resources/groups/client/Client.ts b/src/api/resources/customers/resources/groups/client/Client.ts index b3307543e..12c75283d 100644 --- a/src/api/resources/customers/resources/groups/client/Client.ts +++ b/src/api/resources/customers/resources/groups/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Groups { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Groups { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,10 @@ export class Groups { * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.customers.groups.list() + * await client.customers.groups.list({ + * cursor: "cursor", + * limit: 1 + * }) */ public async list( request: Square.customers.ListGroupsRequest = {}, @@ -80,7 +83,7 @@ export class Groups { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -177,7 +180,7 @@ export class Groups { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -264,7 +267,7 @@ export class Groups { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -350,7 +353,7 @@ export class Groups { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -439,7 +442,7 @@ export class Groups { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -526,7 +529,7 @@ export class Groups { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -613,7 +616,7 @@ export class Groups { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/customers/resources/groups/client/requests/ListGroupsRequest.ts b/src/api/resources/customers/resources/groups/client/requests/ListGroupsRequest.ts index f5e1b638e..8f5ce9765 100644 --- a/src/api/resources/customers/resources/groups/client/requests/ListGroupsRequest.ts +++ b/src/api/resources/customers/resources/groups/client/requests/ListGroupsRequest.ts @@ -4,7 +4,10 @@ /** * @example - * {} + * { + * cursor: "cursor", + * limit: 1 + * } */ export interface ListGroupsRequest { /** diff --git a/src/api/resources/customers/resources/segments/client/Client.ts b/src/api/resources/customers/resources/segments/client/Client.ts index a7e416fe4..8417890ef 100644 --- a/src/api/resources/customers/resources/segments/client/Client.ts +++ b/src/api/resources/customers/resources/segments/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Segments { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Segments { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,10 @@ export class Segments { * @param {Segments.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.customers.segments.list() + * await client.customers.segments.list({ + * cursor: "cursor", + * limit: 1 + * }) */ public async list( request: Square.customers.ListSegmentsRequest = {}, @@ -80,7 +83,7 @@ export class Segments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -176,7 +179,7 @@ export class Segments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/customers/resources/segments/client/requests/ListSegmentsRequest.ts b/src/api/resources/customers/resources/segments/client/requests/ListSegmentsRequest.ts index 259e1b80f..4ee529a9f 100644 --- a/src/api/resources/customers/resources/segments/client/requests/ListSegmentsRequest.ts +++ b/src/api/resources/customers/resources/segments/client/requests/ListSegmentsRequest.ts @@ -4,7 +4,10 @@ /** * @example - * {} + * { + * cursor: "cursor", + * limit: 1 + * } */ export interface ListSegmentsRequest { /** diff --git a/src/api/resources/devices/client/Client.ts b/src/api/resources/devices/client/Client.ts index db4ef046b..b84a26b5b 100644 --- a/src/api/resources/devices/client/Client.ts +++ b/src/api/resources/devices/client/Client.ts @@ -17,7 +17,7 @@ export declare namespace Devices { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -31,7 +31,7 @@ export declare namespace Devices { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -57,7 +57,12 @@ export class Devices { * @param {Devices.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.devices.list() + * await client.devices.list({ + * cursor: "cursor", + * sortOrder: "DESC", + * limit: 1, + * locationId: "location_id" + * }) */ public async list( request: Square.ListDevicesRequest = {}, @@ -94,7 +99,7 @@ export class Devices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -188,7 +193,7 @@ export class Devices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/devices/client/requests/ListDevicesRequest.ts b/src/api/resources/devices/client/requests/ListDevicesRequest.ts index 323d264f4..299bd9ec4 100644 --- a/src/api/resources/devices/client/requests/ListDevicesRequest.ts +++ b/src/api/resources/devices/client/requests/ListDevicesRequest.ts @@ -6,7 +6,12 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * cursor: "cursor", + * sortOrder: "DESC", + * limit: 1, + * locationId: "location_id" + * } */ export interface ListDevicesRequest { /** diff --git a/src/api/resources/devices/resources/codes/client/Client.ts b/src/api/resources/devices/resources/codes/client/Client.ts index 1e9b92476..84c30d8f6 100644 --- a/src/api/resources/devices/resources/codes/client/Client.ts +++ b/src/api/resources/devices/resources/codes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Codes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Codes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,12 @@ export class Codes { * @param {Codes.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.devices.codes.list() + * await client.devices.codes.list({ + * cursor: "cursor", + * locationId: "location_id", + * productType: "TERMINAL_API", + * status: "UNKNOWN" + * }) */ public async list( request: Square.devices.ListCodesRequest = {}, @@ -92,7 +97,7 @@ export class Codes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -191,7 +196,7 @@ export class Codes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -278,7 +283,7 @@ export class Codes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..c7e5d8399 100644 --- a/src/api/resources/devices/resources/codes/client/requests/ListCodesRequest.ts +++ b/src/api/resources/devices/resources/codes/client/requests/ListCodesRequest.ts @@ -6,7 +6,12 @@ import * as Square from "../../../../../../index"; /** * @example - * {} + * { + * cursor: "cursor", + * locationId: "location_id", + * productType: "TERMINAL_API", + * status: "UNKNOWN" + * } */ export interface ListCodesRequest { /** diff --git a/src/api/resources/disputes/client/Client.ts b/src/api/resources/disputes/client/Client.ts index 384b8492f..905d9ad14 100644 --- a/src/api/resources/disputes/client/Client.ts +++ b/src/api/resources/disputes/client/Client.ts @@ -18,7 +18,7 @@ export declare namespace Disputes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -32,7 +32,7 @@ export declare namespace Disputes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -57,7 +57,11 @@ export class Disputes { * @param {Disputes.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.disputes.list() + * await client.disputes.list({ + * cursor: "cursor", + * states: "INQUIRY_EVIDENCE_REQUIRED", + * locationId: "location_id" + * }) */ public async list( request: Square.ListDisputesRequest = {}, @@ -91,7 +95,7 @@ export class Disputes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -185,7 +189,7 @@ export class Disputes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -270,7 +274,7 @@ export class Disputes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -371,7 +375,7 @@ export class Disputes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", ..._maybeEncodedRequest.headers, }), requestOptions?.headers, @@ -461,7 +465,7 @@ export class Disputes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -556,7 +560,7 @@ export class Disputes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/disputes/client/requests/ListDisputesRequest.ts b/src/api/resources/disputes/client/requests/ListDisputesRequest.ts index eb1e6a560..228295073 100644 --- a/src/api/resources/disputes/client/requests/ListDisputesRequest.ts +++ b/src/api/resources/disputes/client/requests/ListDisputesRequest.ts @@ -6,7 +6,11 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * cursor: "cursor", + * states: "INQUIRY_EVIDENCE_REQUIRED", + * locationId: "location_id" + * } */ export interface ListDisputesRequest { /** diff --git a/src/api/resources/disputes/resources/evidence/client/Client.ts b/src/api/resources/disputes/resources/evidence/client/Client.ts index 27d03dedb..d8d7bfb9c 100644 --- a/src/api/resources/disputes/resources/evidence/client/Client.ts +++ b/src/api/resources/disputes/resources/evidence/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Evidence { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Evidence { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -51,7 +51,8 @@ export class Evidence { * * @example * await client.disputes.evidence.list({ - * disputeId: "dispute_id" + * disputeId: "dispute_id", + * cursor: "cursor" * }) */ public async list( @@ -79,7 +80,7 @@ export class Evidence { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -178,7 +179,7 @@ export class Evidence { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -263,7 +264,7 @@ export class Evidence { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..b7dcdf22a 100644 --- a/src/api/resources/disputes/resources/evidence/client/requests/ListEvidenceRequest.ts +++ b/src/api/resources/disputes/resources/evidence/client/requests/ListEvidenceRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * disputeId: "dispute_id" + * disputeId: "dispute_id", + * cursor: "cursor" * } */ export interface ListEvidenceRequest { diff --git a/src/api/resources/employees/client/Client.ts b/src/api/resources/employees/client/Client.ts index bcd53029d..2c3743bfd 100644 --- a/src/api/resources/employees/client/Client.ts +++ b/src/api/resources/employees/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Employees { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Employees { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,12 @@ export class Employees { * @param {Employees.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.employees.list() + * await client.employees.list({ + * locationId: "location_id", + * status: "ACTIVE", + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.ListEmployeesRequest = {}, @@ -89,7 +94,7 @@ export class Employees { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -183,7 +188,7 @@ export class Employees { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/employees/client/requests/ListEmployeesRequest.ts b/src/api/resources/employees/client/requests/ListEmployeesRequest.ts index 78453e229..1a727fa8e 100644 --- a/src/api/resources/employees/client/requests/ListEmployeesRequest.ts +++ b/src/api/resources/employees/client/requests/ListEmployeesRequest.ts @@ -6,7 +6,12 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * locationId: "location_id", + * status: "ACTIVE", + * limit: 1, + * cursor: "cursor" + * } */ export interface ListEmployeesRequest { /** diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts index 22aabb86c..11aeda797 100644 --- a/src/api/resources/events/client/Client.ts +++ b/src/api/resources/events/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Events { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Events { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -75,7 +75,7 @@ export class Events { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -158,7 +158,7 @@ export class Events { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -231,7 +231,7 @@ export class Events { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -284,7 +284,9 @@ export class Events { * @param {Events.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.events.listEventTypes() + * await client.events.listEventTypes({ + * apiVersion: "api_version" + * }) */ public listEventTypes( request: Square.ListEventTypesRequest = {}, @@ -315,7 +317,7 @@ export class Events { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/events/client/requests/ListEventTypesRequest.ts b/src/api/resources/events/client/requests/ListEventTypesRequest.ts index 58176164e..dacf1b022 100644 --- a/src/api/resources/events/client/requests/ListEventTypesRequest.ts +++ b/src/api/resources/events/client/requests/ListEventTypesRequest.ts @@ -4,7 +4,9 @@ /** * @example - * {} + * { + * apiVersion: "api_version" + * } */ export interface ListEventTypesRequest { /** diff --git a/src/api/resources/giftCards/client/Client.ts b/src/api/resources/giftCards/client/Client.ts index 4e9e20593..4276c4951 100644 --- a/src/api/resources/giftCards/client/Client.ts +++ b/src/api/resources/giftCards/client/Client.ts @@ -17,7 +17,7 @@ export declare namespace GiftCards { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -31,7 +31,7 @@ export declare namespace GiftCards { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -57,7 +57,13 @@ export class GiftCards { * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.giftCards.list() + * await client.giftCards.list({ + * type: "type", + * state: "state", + * limit: 1, + * cursor: "cursor", + * customerId: "customer_id" + * }) */ public async list( request: Square.ListGiftCardsRequest = {}, @@ -96,7 +102,7 @@ export class GiftCards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -197,7 +203,7 @@ export class GiftCards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -283,7 +289,7 @@ export class GiftCards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -369,7 +375,7 @@ export class GiftCards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -457,7 +463,7 @@ export class GiftCards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -547,7 +553,7 @@ export class GiftCards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -636,7 +642,7 @@ export class GiftCards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts b/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts index 2a4b28c88..6d23cec0d 100644 --- a/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts +++ b/src/api/resources/giftCards/client/requests/ListGiftCardsRequest.ts @@ -4,7 +4,13 @@ /** * @example - * {} + * { + * type: "type", + * state: "state", + * limit: 1, + * cursor: "cursor", + * customerId: "customer_id" + * } */ export interface ListGiftCardsRequest { /** diff --git a/src/api/resources/giftCards/resources/activities/client/Client.ts b/src/api/resources/giftCards/resources/activities/client/Client.ts index 0bd5bd348..d7ac9af25 100644 --- a/src/api/resources/giftCards/resources/activities/client/Client.ts +++ b/src/api/resources/giftCards/resources/activities/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Activities { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Activities { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -53,7 +53,16 @@ export class Activities { * @param {Activities.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.giftCards.activities.list() + * await client.giftCards.activities.list({ + * giftCardId: "gift_card_id", + * type: "type", + * locationId: "location_id", + * beginTime: "begin_time", + * endTime: "end_time", + * limit: 1, + * cursor: "cursor", + * sortOrder: "sort_order" + * }) */ public async list( request: Square.giftCards.ListActivitiesRequest = {}, @@ -101,7 +110,7 @@ export class Activities { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -206,7 +215,7 @@ export class Activities { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..88a40604c 100644 --- a/src/api/resources/giftCards/resources/activities/client/requests/ListActivitiesRequest.ts +++ b/src/api/resources/giftCards/resources/activities/client/requests/ListActivitiesRequest.ts @@ -4,7 +4,16 @@ /** * @example - * {} + * { + * giftCardId: "gift_card_id", + * type: "type", + * locationId: "location_id", + * beginTime: "begin_time", + * endTime: "end_time", + * limit: 1, + * cursor: "cursor", + * sortOrder: "sort_order" + * } */ export interface ListActivitiesRequest { /** diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 23678d5af..84c19b91c 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -6,6 +6,7 @@ export * as bankAccounts from "./bankAccounts"; export * as bookings from "./bookings"; export * as cards from "./cards"; export * as catalog from "./catalog"; +export * as channels from "./channels"; export * as customers from "./customers"; export * as devices from "./devices"; export * as disputes from "./disputes"; @@ -29,6 +30,7 @@ export * as subscriptions from "./subscriptions"; export * as teamMembers from "./teamMembers"; export * as team from "./team"; export * as terminal from "./terminal"; +export * as transferOrders from "./transferOrders"; export * as vendors from "./vendors"; export * as cashDrawers from "./cashDrawers"; export * as webhooks from "./webhooks"; @@ -40,6 +42,7 @@ export * from "./bankAccounts/client/requests"; export * from "./bookings/client/requests"; export * from "./cards/client/requests"; export * from "./catalog/client/requests"; +export * from "./channels/client/requests"; export * from "./customers/client/requests"; export * from "./devices/client/requests"; export * from "./disputes/client/requests"; @@ -62,4 +65,5 @@ export * from "./subscriptions/client/requests"; export * from "./teamMembers/client/requests"; export * from "./team/client/requests"; export * from "./terminal/client/requests"; +export * from "./transferOrders/client/requests"; export * from "./vendors/client/requests"; diff --git a/src/api/resources/inventory/client/Client.ts b/src/api/resources/inventory/client/Client.ts index 7f471db53..6acb85846 100644 --- a/src/api/resources/inventory/client/Client.ts +++ b/src/api/resources/inventory/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Inventory { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Inventory { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -79,7 +79,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -163,7 +163,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -259,7 +259,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -328,81 +328,90 @@ export class Inventory { * updatedBefore: "2016-12-01T00:00:00.000Z" * }) */ - public deprecatedBatchGetChanges( + public async 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> { - 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/batch-retrieve-changes", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - 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 { - data: serializers.BatchGetInventoryChangesResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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/batch-retrieve-changes.", - ); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, + ): Promise> { + 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/batch-retrieve-changes", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + 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 { + data: serializers.BatchGetInventoryChangesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/batch-retrieve-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: 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)); + }, + }); } /** @@ -419,81 +428,90 @@ export class Inventory { * updatedAfter: "2016-11-16T00:00:00.000Z" * }) */ - public deprecatedBatchGetCounts( + public async 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> { - 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/batch-retrieve-counts", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - 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 { - data: serializers.BatchGetInventoryCountsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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/batch-retrieve-counts.", - ); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, + ): Promise> { + 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/batch-retrieve-counts", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + 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 { + data: serializers.BatchGetInventoryCountsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/batch-retrieve-counts.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + 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)); + }, + }); } /** @@ -547,7 +565,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -644,7 +662,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -753,7 +771,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -855,7 +873,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -939,7 +957,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1023,7 +1041,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1082,7 +1100,9 @@ export class Inventory { * * @example * await client.inventory.get({ - * catalogObjectId: "catalog_object_id" + * catalogObjectId: "catalog_object_id", + * locationIds: "location_ids", + * cursor: "cursor" * }) */ public async get( @@ -1113,7 +1133,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1194,7 +1214,9 @@ export class Inventory { * * @example * await client.inventory.changes({ - * catalogObjectId: "catalog_object_id" + * catalogObjectId: "catalog_object_id", + * locationIds: "location_ids", + * cursor: "cursor" * }) */ public async changes( @@ -1225,7 +1247,7 @@ export class Inventory { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts b/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts index 0ecaff2d6..4be1ccbc5 100644 --- a/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/ChangesInventoryRequest.ts @@ -5,7 +5,9 @@ /** * @example * { - * catalogObjectId: "catalog_object_id" + * catalogObjectId: "catalog_object_id", + * locationIds: "location_ids", + * cursor: "cursor" * } */ export interface ChangesInventoryRequest { diff --git a/src/api/resources/inventory/client/requests/GetInventoryRequest.ts b/src/api/resources/inventory/client/requests/GetInventoryRequest.ts index 7d4dab332..c4cb90342 100644 --- a/src/api/resources/inventory/client/requests/GetInventoryRequest.ts +++ b/src/api/resources/inventory/client/requests/GetInventoryRequest.ts @@ -5,7 +5,9 @@ /** * @example * { - * catalogObjectId: "catalog_object_id" + * catalogObjectId: "catalog_object_id", + * locationIds: "location_ids", + * cursor: "cursor" * } */ export interface GetInventoryRequest { diff --git a/src/api/resources/invoices/client/Client.ts b/src/api/resources/invoices/client/Client.ts index 5f93306c5..4dbad3bf3 100644 --- a/src/api/resources/invoices/client/Client.ts +++ b/src/api/resources/invoices/client/Client.ts @@ -17,7 +17,7 @@ export declare namespace Invoices { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -31,7 +31,7 @@ export declare namespace Invoices { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -54,7 +54,9 @@ export class Invoices { * * @example * await client.invoices.list({ - * locationId: "location_id" + * locationId: "location_id", + * cursor: "cursor", + * limit: 1 * }) */ public async list( @@ -84,7 +86,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -221,7 +223,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -300,79 +302,88 @@ export class Invoices { * limit: 100 * }) */ - public search( + public async 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> { - 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/search", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchInvoicesRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchInvoicesResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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/invoices/search."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchInvoicesRequest, + ): 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/invoices/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchInvoicesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } + if (_response.ok) { + return { + data: serializers.SearchInvoicesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/invoices/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + 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)); + }, + }); } /** @@ -410,7 +421,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -502,7 +513,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -564,7 +575,8 @@ export class Invoices { * * @example * await client.invoices.delete({ - * invoiceId: "invoice_id" + * invoiceId: "invoice_id", + * version: 1 * }) */ public delete( @@ -596,7 +608,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -702,7 +714,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", ..._maybeEncodedRequest.headers, }), requestOptions?.headers, @@ -791,7 +803,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -878,7 +890,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -982,7 +994,7 @@ export class Invoices { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts b/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts index 2cf9546a6..97e237452 100644 --- a/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts +++ b/src/api/resources/invoices/client/requests/DeleteInvoicesRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * invoiceId: "invoice_id" + * invoiceId: "invoice_id", + * version: 1 * } */ export interface DeleteInvoicesRequest { diff --git a/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts b/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts index d38f8f30a..501cde386 100644 --- a/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts +++ b/src/api/resources/invoices/client/requests/ListInvoicesRequest.ts @@ -5,7 +5,9 @@ /** * @example * { - * locationId: "location_id" + * locationId: "location_id", + * cursor: "cursor", + * limit: 1 * } */ export interface ListInvoicesRequest { diff --git a/src/api/resources/labor/client/Client.ts b/src/api/resources/labor/client/Client.ts index cb58539c6..c30f736c2 100644 --- a/src/api/resources/labor/client/Client.ts +++ b/src/api/resources/labor/client/Client.ts @@ -21,7 +21,7 @@ export declare namespace Labor { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -35,7 +35,7 @@ export declare namespace Labor { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -125,7 +125,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -219,7 +219,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -318,7 +318,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -407,7 +407,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -511,7 +511,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -604,7 +604,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -735,7 +735,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -846,7 +846,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -933,7 +933,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1049,7 +1049,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1136,7 +1136,7 @@ export class Labor { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/labor/resources/breakTypes/client/Client.ts b/src/api/resources/labor/resources/breakTypes/client/Client.ts index b67c613d7..40c6efed1 100644 --- a/src/api/resources/labor/resources/breakTypes/client/Client.ts +++ b/src/api/resources/labor/resources/breakTypes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace BreakTypes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace BreakTypes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,11 @@ export class BreakTypes { * @param {BreakTypes.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.labor.breakTypes.list() + * await client.labor.breakTypes.list({ + * locationId: "location_id", + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.labor.ListBreakTypesRequest = {}, @@ -83,7 +87,7 @@ export class BreakTypes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -195,7 +199,7 @@ export class BreakTypes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -282,7 +286,7 @@ export class BreakTypes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -370,7 +374,7 @@ export class BreakTypes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -459,7 +463,7 @@ export class BreakTypes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..f8d653dfc 100644 --- a/src/api/resources/labor/resources/breakTypes/client/requests/ListBreakTypesRequest.ts +++ b/src/api/resources/labor/resources/breakTypes/client/requests/ListBreakTypesRequest.ts @@ -4,7 +4,11 @@ /** * @example - * {} + * { + * locationId: "location_id", + * limit: 1, + * cursor: "cursor" + * } */ export interface ListBreakTypesRequest { /** diff --git a/src/api/resources/labor/resources/employeeWages/client/Client.ts b/src/api/resources/labor/resources/employeeWages/client/Client.ts index edd3ca44c..9335b4cf0 100644 --- a/src/api/resources/labor/resources/employeeWages/client/Client.ts +++ b/src/api/resources/labor/resources/employeeWages/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace EmployeeWages { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace EmployeeWages { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,11 @@ export class EmployeeWages { * @param {EmployeeWages.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.labor.employeeWages.list() + * await client.labor.employeeWages.list({ + * employeeId: "employee_id", + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.labor.ListEmployeeWagesRequest = {}, @@ -83,7 +87,7 @@ export class EmployeeWages { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -179,7 +183,7 @@ export class EmployeeWages { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..24a7da1d0 100644 --- a/src/api/resources/labor/resources/employeeWages/client/requests/ListEmployeeWagesRequest.ts +++ b/src/api/resources/labor/resources/employeeWages/client/requests/ListEmployeeWagesRequest.ts @@ -4,7 +4,11 @@ /** * @example - * {} + * { + * employeeId: "employee_id", + * limit: 1, + * cursor: "cursor" + * } */ export interface ListEmployeeWagesRequest { /** diff --git a/src/api/resources/labor/resources/shifts/client/Client.ts b/src/api/resources/labor/resources/shifts/client/Client.ts index a413facbc..456024d83 100644 --- a/src/api/resources/labor/resources/shifts/client/Client.ts +++ b/src/api/resources/labor/resources/shifts/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Shifts { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Shifts { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -120,7 +120,7 @@ export class Shifts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -208,79 +208,90 @@ export class Shifts { * limit: 100 * }) */ - public search( + public async 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> { - 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/shifts/search", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.labor.SearchShiftsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchShiftsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.labor.SearchShiftsRequest, + ): 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/labor/shifts/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.labor.SearchShiftsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchShiftsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/labor/shifts/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.shifts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -318,7 +329,7 @@ export class Shifts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -433,7 +444,7 @@ export class Shifts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -520,7 +531,7 @@ export class Shifts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/labor/resources/teamMemberWages/client/Client.ts b/src/api/resources/labor/resources/teamMemberWages/client/Client.ts index 6d1a5c8a1..7d903d3c5 100644 --- a/src/api/resources/labor/resources/teamMemberWages/client/Client.ts +++ b/src/api/resources/labor/resources/teamMemberWages/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace TeamMemberWages { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace TeamMemberWages { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,11 @@ export class TeamMemberWages { * @param {TeamMemberWages.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.labor.teamMemberWages.list() + * await client.labor.teamMemberWages.list({ + * teamMemberId: "team_member_id", + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.labor.ListTeamMemberWagesRequest = {}, @@ -83,7 +87,7 @@ export class TeamMemberWages { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -179,7 +183,7 @@ export class TeamMemberWages { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..4bdcfeb7a 100644 --- a/src/api/resources/labor/resources/teamMemberWages/client/requests/ListTeamMemberWagesRequest.ts +++ b/src/api/resources/labor/resources/teamMemberWages/client/requests/ListTeamMemberWagesRequest.ts @@ -4,7 +4,11 @@ /** * @example - * {} + * { + * teamMemberId: "team_member_id", + * limit: 1, + * cursor: "cursor" + * } */ export interface ListTeamMemberWagesRequest { /** diff --git a/src/api/resources/labor/resources/workweekConfigs/client/Client.ts b/src/api/resources/labor/resources/workweekConfigs/client/Client.ts index c6b4a3f98..deab7baab 100644 --- a/src/api/resources/labor/resources/workweekConfigs/client/Client.ts +++ b/src/api/resources/labor/resources/workweekConfigs/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace WorkweekConfigs { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace WorkweekConfigs { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,10 @@ export class WorkweekConfigs { * @param {WorkweekConfigs.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.labor.workweekConfigs.list() + * await client.labor.workweekConfigs.list({ + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.labor.ListWorkweekConfigsRequest = {}, @@ -80,7 +83,7 @@ export class WorkweekConfigs { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -181,7 +184,7 @@ export class WorkweekConfigs { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/labor/resources/workweekConfigs/client/requests/ListWorkweekConfigsRequest.ts b/src/api/resources/labor/resources/workweekConfigs/client/requests/ListWorkweekConfigsRequest.ts index 606f88dfa..2f8a70af2 100644 --- a/src/api/resources/labor/resources/workweekConfigs/client/requests/ListWorkweekConfigsRequest.ts +++ b/src/api/resources/labor/resources/workweekConfigs/client/requests/ListWorkweekConfigsRequest.ts @@ -4,7 +4,10 @@ /** * @example - * {} + * { + * limit: 1, + * cursor: "cursor" + * } */ export interface ListWorkweekConfigsRequest { /** diff --git a/src/api/resources/locations/client/Client.ts b/src/api/resources/locations/client/Client.ts index 18fa9a7e1..77b9640d7 100644 --- a/src/api/resources/locations/client/Client.ts +++ b/src/api/resources/locations/client/Client.ts @@ -19,7 +19,7 @@ export declare namespace Locations { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -33,7 +33,7 @@ export declare namespace Locations { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -89,7 +89,7 @@ export class Locations { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -184,7 +184,7 @@ export class Locations { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -272,7 +272,7 @@ export class Locations { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -371,7 +371,7 @@ export class Locations { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -538,7 +538,7 @@ export class Locations { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts index d5e85b31f..dfb270ca4 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributeDefinitions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributeDefinitions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -53,7 +53,11 @@ export class CustomAttributeDefinitions { * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.locations.customAttributeDefinitions.list() + * await client.locations.customAttributeDefinitions.list({ + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.locations.ListCustomAttributeDefinitionsRequest = {}, @@ -89,7 +93,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -201,7 +205,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -265,7 +269,8 @@ export class CustomAttributeDefinitions { * * @example * await client.locations.customAttributeDefinitions.get({ - * key: "key" + * key: "key", + * version: 1 * }) */ public get( @@ -297,7 +302,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -388,7 +393,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -480,7 +485,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts index 9b086bfb6..e4c05d712 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * key: "key" + * key: "key", + * version: 1 * } */ export interface GetCustomAttributeDefinitionsRequest { 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..4818482a3 100644 --- a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -6,7 +6,11 @@ import * as Square from "../../../../../../index"; /** * @example - * {} + * { + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor" + * } */ export interface ListCustomAttributeDefinitionsRequest { /** diff --git a/src/api/resources/locations/resources/customAttributes/client/Client.ts b/src/api/resources/locations/resources/customAttributes/client/Client.ts index 881484463..9ce72fa20 100644 --- a/src/api/resources/locations/resources/customAttributes/client/Client.ts +++ b/src/api/resources/locations/resources/customAttributes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -89,7 +89,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -208,7 +208,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -275,7 +275,11 @@ export class CustomAttributes { * * @example * await client.locations.customAttributes.list({ - * locationId: "location_id" + * locationId: "location_id", + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * }) */ public async list( @@ -315,7 +319,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -389,7 +393,9 @@ export class CustomAttributes { * @example * await client.locations.customAttributes.get({ * locationId: "location_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * }) */ public get( @@ -425,7 +431,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -518,7 +524,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -610,7 +616,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..7ca5414a6 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -6,7 +6,9 @@ * @example * { * locationId: "location_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * } */ export interface GetCustomAttributesRequest { 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..a7f35f860 100644 --- a/src/api/resources/locations/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/locations/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -7,7 +7,11 @@ import * as Square from "../../../../../../index"; /** * @example * { - * locationId: "location_id" + * locationId: "location_id", + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * } */ export interface ListCustomAttributesRequest { diff --git a/src/api/resources/locations/resources/transactions/client/Client.ts b/src/api/resources/locations/resources/transactions/client/Client.ts index 9611fb25c..6fbea9efd 100644 --- a/src/api/resources/locations/resources/transactions/client/Client.ts +++ b/src/api/resources/locations/resources/transactions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Transactions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Transactions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -56,7 +56,11 @@ export class Transactions { * * @example * await client.locations.transactions.list({ - * locationId: "location_id" + * locationId: "location_id", + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "DESC", + * cursor: "cursor" * }) */ public list( @@ -103,7 +107,7 @@ export class Transactions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -188,7 +192,7 @@ export class Transactions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -277,7 +281,7 @@ export class Transactions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -366,7 +370,7 @@ export class Transactions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..9a850cf0b 100644 --- a/src/api/resources/locations/resources/transactions/client/requests/ListTransactionsRequest.ts +++ b/src/api/resources/locations/resources/transactions/client/requests/ListTransactionsRequest.ts @@ -7,7 +7,11 @@ import * as Square from "../../../../../../index"; /** * @example * { - * locationId: "location_id" + * locationId: "location_id", + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "DESC", + * cursor: "cursor" * } */ export interface ListTransactionsRequest { diff --git a/src/api/resources/loyalty/client/Client.ts b/src/api/resources/loyalty/client/Client.ts index b586afbe2..bb9c2d64c 100644 --- a/src/api/resources/loyalty/client/Client.ts +++ b/src/api/resources/loyalty/client/Client.ts @@ -19,7 +19,7 @@ export declare namespace Loyalty { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -33,7 +33,7 @@ export declare namespace Loyalty { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -86,79 +86,90 @@ export class Loyalty { * limit: 30 * }) */ - public searchEvents( + public async searchEvents( request: Square.SearchLoyaltyEventsRequest = {}, requestOptions?: Loyalty.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchLoyaltyEventsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchLoyaltyEventsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchLoyaltyEventsRequest, + ): 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/loyalty/events/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchLoyaltyEventsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchLoyaltyEventsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/loyalty/events/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.events ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } protected async _getAuthorizationHeader(): Promise { diff --git a/src/api/resources/loyalty/resources/accounts/client/Client.ts b/src/api/resources/loyalty/resources/accounts/client/Client.ts index e0358a93e..fba88e90e 100644 --- a/src/api/resources/loyalty/resources/accounts/client/Client.ts +++ b/src/api/resources/loyalty/resources/accounts/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Accounts { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Accounts { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -83,7 +83,7 @@ export class Accounts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -155,79 +155,90 @@ export class Accounts { * limit: 10 * }) */ - public search( + public async search( request: Square.loyalty.SearchLoyaltyAccountsRequest = {}, requestOptions?: Accounts.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.loyalty.SearchLoyaltyAccountsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchLoyaltyAccountsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.loyalty.SearchLoyaltyAccountsRequest, + ): 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/loyalty/accounts/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.SearchLoyaltyAccountsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchLoyaltyAccountsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/loyalty/accounts/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.loyaltyAccounts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -265,7 +276,7 @@ export class Accounts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -366,7 +377,7 @@ export class Accounts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -464,7 +475,7 @@ export class Accounts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/loyalty/resources/programs/client/Client.ts b/src/api/resources/loyalty/resources/programs/client/Client.ts index 2bb28e6f6..4a12dc254 100644 --- a/src/api/resources/loyalty/resources/programs/client/Client.ts +++ b/src/api/resources/loyalty/resources/programs/client/Client.ts @@ -17,7 +17,7 @@ export declare namespace Programs { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -31,7 +31,7 @@ export declare namespace Programs { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -82,7 +82,7 @@ export class Programs { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -165,7 +165,7 @@ export class Programs { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -264,7 +264,7 @@ export class Programs { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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 663e77ec3..6bdb8c8c6 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 @@ -16,7 +16,7 @@ export declare namespace Promotions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Promotions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -52,7 +52,10 @@ export class Promotions { * * @example * await client.loyalty.programs.promotions.list({ - * programId: "program_id" + * programId: "program_id", + * status: "ACTIVE", + * cursor: "cursor", + * limit: 1 * }) */ public async list( @@ -89,7 +92,7 @@ export class Promotions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -212,7 +215,7 @@ export class Promotions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -274,8 +277,8 @@ export class Promotions { * * @example * await client.loyalty.programs.promotions.get({ - * promotionId: "promotion_id", - * programId: "program_id" + * programId: "program_id", + * promotionId: "promotion_id" * }) */ public get( @@ -289,7 +292,7 @@ export class Promotions { request: Square.loyalty.programs.GetPromotionsRequest, requestOptions?: Promotions.RequestOptions, ): Promise> { - const { promotionId, programId } = request; + const { programId, promotionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -302,7 +305,7 @@ export class Promotions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -363,8 +366,8 @@ export class Promotions { * * @example * await client.loyalty.programs.promotions.cancel({ - * promotionId: "promotion_id", - * programId: "program_id" + * programId: "program_id", + * promotionId: "promotion_id" * }) */ public cancel( @@ -378,7 +381,7 @@ export class Promotions { request: Square.loyalty.programs.CancelPromotionsRequest, requestOptions?: Promotions.RequestOptions, ): Promise> { - const { promotionId, programId } = request; + const { programId, promotionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -391,7 +394,7 @@ export class Promotions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..419b7deb7 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,18 +5,18 @@ /** * @example * { - * promotionId: "promotion_id", - * programId: "program_id" + * programId: "program_id", + * promotionId: "promotion_id" * } */ export interface CancelPromotionsRequest { + /** + * The ID of the base [loyalty program](entity:LoyaltyProgram). + */ + programId: string; /** * The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a * promotion that has an `ACTIVE` or `SCHEDULED` status. */ promotionId: string; - /** - * The ID of the base [loyalty program](entity:LoyaltyProgram). - */ - programId: string; } diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/GetPromotionsRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/GetPromotionsRequest.ts index 5138a2719..df500e557 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" + * programId: "program_id", + * promotionId: "promotion_id" * } */ export interface GetPromotionsRequest { - /** - * The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve. - */ - promotionId: string; /** * The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID, * call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword. */ programId: string; + /** + * The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve. + */ + promotionId: 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..46d676b3a 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 @@ -7,7 +7,10 @@ import * as Square from "../../../../../../../../index"; /** * @example * { - * programId: "program_id" + * programId: "program_id", + * status: "ACTIVE", + * cursor: "cursor", + * limit: 1 * } */ export interface ListPromotionsRequest { diff --git a/src/api/resources/loyalty/resources/rewards/client/Client.ts b/src/api/resources/loyalty/resources/rewards/client/Client.ts index 42ac8cd70..9aaa54828 100644 --- a/src/api/resources/loyalty/resources/rewards/client/Client.ts +++ b/src/api/resources/loyalty/resources/rewards/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Rewards { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Rewards { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -89,7 +89,7 @@ export class Rewards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -161,79 +161,90 @@ export class Rewards { * limit: 10 * }) */ - public search( + public async 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> { - 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/rewards/search", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.loyalty.SearchLoyaltyRewardsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchLoyaltyRewardsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.loyalty.SearchLoyaltyRewardsRequest, + ): 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/loyalty/rewards/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.SearchLoyaltyRewardsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchLoyaltyRewardsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/loyalty/rewards/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.rewards ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -271,7 +282,7 @@ export class Rewards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -362,7 +373,7 @@ export class Rewards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -457,7 +468,7 @@ export class Rewards { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/merchants/client/Client.ts b/src/api/resources/merchants/client/Client.ts index 77a5eb469..cd995f488 100644 --- a/src/api/resources/merchants/client/Client.ts +++ b/src/api/resources/merchants/client/Client.ts @@ -18,7 +18,7 @@ export declare namespace Merchants { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -32,7 +32,7 @@ export declare namespace Merchants { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -71,7 +71,9 @@ export class Merchants { * @param {Merchants.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.merchants.list() + * await client.merchants.list({ + * cursor: 1 + * }) */ public async list( request: Square.ListMerchantsRequest = {}, @@ -98,7 +100,7 @@ export class Merchants { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -192,7 +194,7 @@ export class Merchants { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/merchants/client/requests/ListMerchantsRequest.ts b/src/api/resources/merchants/client/requests/ListMerchantsRequest.ts index 30bb590cc..a7cbfe78b 100644 --- a/src/api/resources/merchants/client/requests/ListMerchantsRequest.ts +++ b/src/api/resources/merchants/client/requests/ListMerchantsRequest.ts @@ -4,7 +4,9 @@ /** * @example - * {} + * { + * cursor: 1 + * } */ export interface ListMerchantsRequest { /** diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts index 099160964..c7507644c 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributeDefinitions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributeDefinitions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -53,7 +53,11 @@ export class CustomAttributeDefinitions { * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.merchants.customAttributeDefinitions.list() + * await client.merchants.customAttributeDefinitions.list({ + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor" + * }) */ public async list( request: Square.merchants.ListCustomAttributeDefinitionsRequest = {}, @@ -89,7 +93,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -201,7 +205,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -265,7 +269,8 @@ export class CustomAttributeDefinitions { * * @example * await client.merchants.customAttributeDefinitions.get({ - * key: "key" + * key: "key", + * version: 1 * }) */ public get( @@ -297,7 +302,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -388,7 +393,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -480,7 +485,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts index 9b086bfb6..e4c05d712 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * key: "key" + * key: "key", + * version: 1 * } */ export interface GetCustomAttributeDefinitionsRequest { 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..4818482a3 100644 --- a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -6,7 +6,11 @@ import * as Square from "../../../../../../index"; /** * @example - * {} + * { + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor" + * } */ export interface ListCustomAttributeDefinitionsRequest { /** diff --git a/src/api/resources/merchants/resources/customAttributes/client/Client.ts b/src/api/resources/merchants/resources/customAttributes/client/Client.ts index a138aceb9..e3b7177ca 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/Client.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -86,7 +86,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -198,7 +198,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -265,7 +265,11 @@ export class CustomAttributes { * * @example * await client.merchants.customAttributes.list({ - * merchantId: "merchant_id" + * merchantId: "merchant_id", + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * }) */ public async list( @@ -305,7 +309,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -379,7 +383,9 @@ export class CustomAttributes { * @example * await client.merchants.customAttributes.get({ * merchantId: "merchant_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * }) */ public get( @@ -415,7 +421,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -508,7 +514,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -600,7 +606,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..ddedc056e 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -6,7 +6,9 @@ * @example * { * merchantId: "merchant_id", - * key: "key" + * key: "key", + * withDefinition: true, + * version: 1 * } */ export interface GetCustomAttributesRequest { 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..649e8a162 100644 --- a/src/api/resources/merchants/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -7,7 +7,11 @@ import * as Square from "../../../../../../index"; /** * @example * { - * merchantId: "merchant_id" + * merchantId: "merchant_id", + * visibilityFilter: "ALL", + * limit: 1, + * cursor: "cursor", + * withDefinitions: true * } */ export interface ListCustomAttributesRequest { diff --git a/src/api/resources/mobile/client/Client.ts b/src/api/resources/mobile/client/Client.ts index a773ec579..96e12e7b0 100644 --- a/src/api/resources/mobile/client/Client.ts +++ b/src/api/resources/mobile/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Mobile { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Mobile { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -91,7 +91,7 @@ export class Mobile { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/oAuth/client/Client.ts b/src/api/resources/oAuth/client/Client.ts index 15cf3b3f3..537e7526d 100644 --- a/src/api/resources/oAuth/client/Client.ts +++ b/src/api/resources/oAuth/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace OAuth { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace OAuth { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -91,7 +91,7 @@ export class OAuth { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -200,7 +200,7 @@ export class OAuth { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -294,7 +294,7 @@ export class OAuth { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -363,7 +363,7 @@ export class OAuth { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/orders/client/Client.ts b/src/api/resources/orders/client/Client.ts index 43b4e7035..ded152132 100644 --- a/src/api/resources/orders/client/Client.ts +++ b/src/api/resources/orders/client/Client.ts @@ -18,7 +18,7 @@ export declare namespace Orders { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -32,7 +32,7 @@ export declare namespace Orders { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -140,7 +140,7 @@ export class Orders { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -229,7 +229,7 @@ export class Orders { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -337,7 +337,7 @@ export class Orders { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -426,7 +426,7 @@ export class Orders { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -524,79 +524,86 @@ export class Orders { * returnEntries: true * }) */ - public search( + public async search( request: Square.SearchOrdersRequest = {}, requestOptions?: Orders.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchOrdersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchOrdersResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async (request: Square.SearchOrdersRequest): 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/orders/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchOrdersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchOrdersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/orders/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.orders ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -634,7 +641,7 @@ export class Orders { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -744,7 +751,7 @@ export class Orders { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -846,7 +853,7 @@ export class Orders { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts index 46231e197..899a7ba8d 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributeDefinitions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributeDefinitions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -55,7 +55,11 @@ export class CustomAttributeDefinitions { * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.orders.customAttributeDefinitions.list() + * await client.orders.customAttributeDefinitions.list({ + * visibilityFilter: "ALL", + * cursor: "cursor", + * limit: 1 + * }) */ public async list( request: Square.orders.ListCustomAttributeDefinitionsRequest = {}, @@ -91,7 +95,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -199,7 +203,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -265,7 +269,8 @@ export class CustomAttributeDefinitions { * * @example * await client.orders.customAttributeDefinitions.get({ - * key: "key" + * key: "key", + * version: 1 * }) */ public get( @@ -297,7 +302,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -389,7 +394,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -480,7 +485,7 @@ export class CustomAttributeDefinitions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts index f0d58ef27..b72b1159b 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/GetCustomAttributeDefinitionsRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * key: "key" + * key: "key", + * version: 1 * } */ export interface GetCustomAttributeDefinitionsRequest { 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..3f1c4b730 100644 --- a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/ListCustomAttributeDefinitionsRequest.ts @@ -6,7 +6,11 @@ import * as Square from "../../../../../../index"; /** * @example - * {} + * { + * visibilityFilter: "ALL", + * cursor: "cursor", + * limit: 1 + * } */ export interface ListCustomAttributeDefinitionsRequest { /** diff --git a/src/api/resources/orders/resources/customAttributes/client/Client.ts b/src/api/resources/orders/resources/customAttributes/client/Client.ts index f0f7e46dd..c67c62da9 100644 --- a/src/api/resources/orders/resources/customAttributes/client/Client.ts +++ b/src/api/resources/orders/resources/customAttributes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace CustomAttributes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace CustomAttributes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -99,7 +99,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -217,7 +217,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -286,7 +286,11 @@ export class CustomAttributes { * * @example * await client.orders.customAttributes.list({ - * orderId: "order_id" + * orderId: "order_id", + * visibilityFilter: "ALL", + * cursor: "cursor", + * limit: 1, + * withDefinitions: true * }) */ public async list( @@ -326,7 +330,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -403,7 +407,9 @@ export class CustomAttributes { * @example * await client.orders.customAttributes.get({ * orderId: "order_id", - * customAttributeKey: "custom_attribute_key" + * customAttributeKey: "custom_attribute_key", + * version: 1, + * withDefinition: true * }) */ public get( @@ -439,7 +445,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -537,7 +543,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -631,7 +637,7 @@ export class CustomAttributes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..4c8dbdb0d 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/GetCustomAttributesRequest.ts @@ -6,7 +6,9 @@ * @example * { * orderId: "order_id", - * customAttributeKey: "custom_attribute_key" + * customAttributeKey: "custom_attribute_key", + * version: 1, + * withDefinition: true * } */ export interface GetCustomAttributesRequest { 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..206799d76 100644 --- a/src/api/resources/orders/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts +++ b/src/api/resources/orders/resources/customAttributes/client/requests/ListCustomAttributesRequest.ts @@ -7,7 +7,11 @@ import * as Square from "../../../../../../index"; /** * @example * { - * orderId: "order_id" + * orderId: "order_id", + * visibilityFilter: "ALL", + * cursor: "cursor", + * limit: 1, + * withDefinitions: true * } */ export interface ListCustomAttributesRequest { diff --git a/src/api/resources/payments/client/Client.ts b/src/api/resources/payments/client/Client.ts index 07a1cfa66..c5e81a7cb 100644 --- a/src/api/resources/payments/client/Client.ts +++ b/src/api/resources/payments/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Payments { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Payments { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -55,7 +55,23 @@ export class Payments { * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.payments.list() + * await client.payments.list({ + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "sort_order", + * cursor: "cursor", + * locationId: "location_id", + * total: BigInt("1000000"), + * last4: "last_4", + * cardBrand: "card_brand", + * limit: 1, + * isOfflinePayment: true, + * offlineBeginTime: "offline_begin_time", + * offlineEndTime: "offline_end_time", + * updatedAtBeginTime: "updated_at_begin_time", + * updatedAtEndTime: "updated_at_end_time", + * sortField: "CREATED_AT" + * }) */ public async list( request: Square.ListPaymentsRequest = {}, @@ -141,7 +157,7 @@ export class Payments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -255,7 +271,7 @@ export class Payments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -351,7 +367,7 @@ export class Payments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -438,7 +454,7 @@ export class Payments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -532,7 +548,7 @@ export class Payments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -620,7 +636,7 @@ export class Payments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -706,7 +722,7 @@ export class Payments { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/payments/client/requests/ListPaymentsRequest.ts b/src/api/resources/payments/client/requests/ListPaymentsRequest.ts index 686751d03..affd3d479 100644 --- a/src/api/resources/payments/client/requests/ListPaymentsRequest.ts +++ b/src/api/resources/payments/client/requests/ListPaymentsRequest.ts @@ -6,7 +6,23 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "sort_order", + * cursor: "cursor", + * locationId: "location_id", + * total: BigInt("1000000"), + * last4: "last_4", + * cardBrand: "card_brand", + * limit: 1, + * isOfflinePayment: true, + * offlineBeginTime: "offline_begin_time", + * offlineEndTime: "offline_end_time", + * updatedAtBeginTime: "updated_at_begin_time", + * updatedAtEndTime: "updated_at_end_time", + * sortField: "CREATED_AT" + * } */ export interface ListPaymentsRequest { /** diff --git a/src/api/resources/payouts/client/Client.ts b/src/api/resources/payouts/client/Client.ts index e4eb3bdf8..19a6b714f 100644 --- a/src/api/resources/payouts/client/Client.ts +++ b/src/api/resources/payouts/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Payouts { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Payouts { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -52,7 +52,15 @@ export class Payouts { * @param {Payouts.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.payouts.list() + * await client.payouts.list({ + * locationId: "location_id", + * status: "SENT", + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "DESC", + * cursor: "cursor", + * limit: 1 + * }) */ public async list( request: Square.ListPayoutsRequest = {}, @@ -101,7 +109,7 @@ export class Payouts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -196,7 +204,7 @@ export class Payouts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -251,7 +259,10 @@ export class Payouts { * * @example * await client.payouts.listEntries({ - * payoutId: "payout_id" + * payoutId: "payout_id", + * sortOrder: "DESC", + * cursor: "cursor", + * limit: 1 * }) */ public async listEntries( @@ -288,7 +299,7 @@ export class Payouts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts b/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts index e12ee9e59..6b329f73c 100644 --- a/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts +++ b/src/api/resources/payouts/client/requests/ListEntriesPayoutsRequest.ts @@ -7,7 +7,10 @@ import * as Square from "../../../../index"; /** * @example * { - * payoutId: "payout_id" + * payoutId: "payout_id", + * sortOrder: "DESC", + * cursor: "cursor", + * limit: 1 * } */ export interface ListEntriesPayoutsRequest { diff --git a/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts b/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts index c585aace4..49f693190 100644 --- a/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts +++ b/src/api/resources/payouts/client/requests/ListPayoutsRequest.ts @@ -6,7 +6,15 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * locationId: "location_id", + * status: "SENT", + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "DESC", + * cursor: "cursor", + * limit: 1 + * } */ export interface ListPayoutsRequest { /** diff --git a/src/api/resources/refunds/client/Client.ts b/src/api/resources/refunds/client/Client.ts index a2f73cc06..6832f14e8 100644 --- a/src/api/resources/refunds/client/Client.ts +++ b/src/api/resources/refunds/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Refunds { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Refunds { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -55,7 +55,19 @@ export class Refunds { * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.refunds.list() + * await client.refunds.list({ + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "sort_order", + * cursor: "cursor", + * locationId: "location_id", + * status: "status", + * sourceType: "source_type", + * limit: 1, + * updatedAtBeginTime: "updated_at_begin_time", + * updatedAtEndTime: "updated_at_end_time", + * sortField: "CREATED_AT" + * }) */ public async list( request: Square.ListRefundsRequest = {}, @@ -127,7 +139,7 @@ export class Refunds { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -233,7 +245,7 @@ export class Refunds { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -320,7 +332,7 @@ export class Refunds { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/refunds/client/requests/ListRefundsRequest.ts b/src/api/resources/refunds/client/requests/ListRefundsRequest.ts index f21e73500..e7e2d1d54 100644 --- a/src/api/resources/refunds/client/requests/ListRefundsRequest.ts +++ b/src/api/resources/refunds/client/requests/ListRefundsRequest.ts @@ -6,7 +6,19 @@ import * as Square from "../../../../index"; /** * @example - * {} + * { + * beginTime: "begin_time", + * endTime: "end_time", + * sortOrder: "sort_order", + * cursor: "cursor", + * locationId: "location_id", + * status: "status", + * sourceType: "source_type", + * limit: 1, + * updatedAtBeginTime: "updated_at_begin_time", + * updatedAtEndTime: "updated_at_end_time", + * sortField: "CREATED_AT" + * } */ export interface ListRefundsRequest { /** diff --git a/src/api/resources/sites/client/Client.ts b/src/api/resources/sites/client/Client.ts index 00e3e261a..3942631c3 100644 --- a/src/api/resources/sites/client/Client.ts +++ b/src/api/resources/sites/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Sites { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Sites { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -73,7 +73,7 @@ export class Sites { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/snippets/client/Client.ts b/src/api/resources/snippets/client/Client.ts index e66b004b5..e118cc663 100644 --- a/src/api/resources/snippets/client/Client.ts +++ b/src/api/resources/snippets/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Snippets { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Snippets { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -83,7 +83,7 @@ export class Snippets { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -173,7 +173,7 @@ export class Snippets { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -265,7 +265,7 @@ export class Snippets { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/subscriptions/client/Client.ts b/src/api/resources/subscriptions/client/Client.ts index 90adfebd7..8f209271c 100644 --- a/src/api/resources/subscriptions/client/Client.ts +++ b/src/api/resources/subscriptions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Subscriptions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Subscriptions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -97,7 +97,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -186,7 +186,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -270,79 +270,90 @@ export class Subscriptions { * } * }) */ - public search( + public async search( request: Square.SearchSubscriptionsRequest = {}, requestOptions?: Subscriptions.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchSubscriptionsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchSubscriptionsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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/subscriptions/search."); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchSubscriptionsRequest, + ): 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/subscriptions/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchSubscriptionsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - } + if (_response.ok) { + return { + data: serializers.SearchSubscriptionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/subscriptions/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + 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)); + }, + }); } /** @@ -353,7 +364,8 @@ export class Subscriptions { * * @example * await client.subscriptions.get({ - * subscriptionId: "subscription_id" + * subscriptionId: "subscription_id", + * include: "include" * }) */ public get( @@ -385,7 +397,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -473,7 +485,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -563,7 +575,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -648,7 +660,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -739,7 +751,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -795,7 +807,9 @@ export class Subscriptions { * * @example * await client.subscriptions.listEvents({ - * subscriptionId: "subscription_id" + * subscriptionId: "subscription_id", + * cursor: "cursor", + * limit: 1 * }) */ public async listEvents( @@ -826,7 +840,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -922,7 +936,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1011,7 +1025,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -1106,7 +1120,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts index 90b54e807..4604762dd 100644 --- a/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts +++ b/src/api/resources/subscriptions/client/requests/GetSubscriptionsRequest.ts @@ -5,7 +5,8 @@ /** * @example * { - * subscriptionId: "subscription_id" + * subscriptionId: "subscription_id", + * include: "include" * } */ export interface GetSubscriptionsRequest { diff --git a/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts index 85ef351a1..d2597584e 100644 --- a/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts +++ b/src/api/resources/subscriptions/client/requests/ListEventsSubscriptionsRequest.ts @@ -5,7 +5,9 @@ /** * @example * { - * subscriptionId: "subscription_id" + * subscriptionId: "subscription_id", + * cursor: "cursor", + * limit: 1 * } */ export interface ListEventsSubscriptionsRequest { diff --git a/src/api/resources/team/client/Client.ts b/src/api/resources/team/client/Client.ts index 0984b062d..0e86f4be0 100644 --- a/src/api/resources/team/client/Client.ts +++ b/src/api/resources/team/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Team { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Team { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,9 @@ export class Team { * @param {Team.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.team.listJobs() + * await client.team.listJobs({ + * cursor: "cursor" + * }) */ public listJobs( request: Square.ListJobsRequest = {}, @@ -81,7 +83,7 @@ export class Team { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -167,7 +169,7 @@ export class Team { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -254,7 +256,7 @@ export class Team { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -343,7 +345,7 @@ export class Team { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/team/client/requests/ListJobsRequest.ts b/src/api/resources/team/client/requests/ListJobsRequest.ts index ac21e815f..0202a0ebc 100644 --- a/src/api/resources/team/client/requests/ListJobsRequest.ts +++ b/src/api/resources/team/client/requests/ListJobsRequest.ts @@ -4,7 +4,9 @@ /** * @example - * {} + * { + * cursor: "cursor" + * } */ export interface ListJobsRequest { /** diff --git a/src/api/resources/teamMembers/client/Client.ts b/src/api/resources/teamMembers/client/Client.ts index 495a71500..a154a1c2c 100644 --- a/src/api/resources/teamMembers/client/Client.ts +++ b/src/api/resources/teamMembers/client/Client.ts @@ -17,7 +17,7 @@ export declare namespace TeamMembers { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -31,7 +31,7 @@ export declare namespace TeamMembers { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -119,7 +119,7 @@ export class TeamMembers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -236,7 +236,7 @@ export class TeamMembers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -356,7 +356,7 @@ export class TeamMembers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -427,79 +427,90 @@ export class TeamMembers { * limit: 10 * }) */ - public search( + public async search( request: Square.SearchTeamMembersRequest = {}, requestOptions?: TeamMembers.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchTeamMembersRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchTeamMembersResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchTeamMembersRequest, + ): 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/team-members/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchTeamMembersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchTeamMembersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/team-members/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.teamMembers ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -538,7 +549,7 @@ export class TeamMembers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -655,7 +666,7 @@ export class TeamMembers { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts b/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts index cedfe5800..eed114e5f 100644 --- a/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts +++ b/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace WageSetting { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace WageSetting { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -83,7 +83,7 @@ export class WageSetting { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -192,7 +192,7 @@ export class WageSetting { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/terminal/client/Client.ts b/src/api/resources/terminal/client/Client.ts index f3f0bb3ae..d436cce33 100644 --- a/src/api/resources/terminal/client/Client.ts +++ b/src/api/resources/terminal/client/Client.ts @@ -19,7 +19,7 @@ export declare namespace Terminal { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -33,7 +33,7 @@ export declare namespace Terminal { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -98,7 +98,7 @@ export class Terminal { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -181,7 +181,7 @@ export class Terminal { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -264,7 +264,7 @@ export class Terminal { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/terminal/resources/actions/client/Client.ts b/src/api/resources/terminal/resources/actions/client/Client.ts index 830e5a8e0..cb1201d18 100644 --- a/src/api/resources/terminal/resources/actions/client/Client.ts +++ b/src/api/resources/terminal/resources/actions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Actions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Actions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -86,7 +86,7 @@ export class Actions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -159,79 +159,90 @@ export class Actions { * limit: 2 * }) */ - public search( + public async search( request: Square.terminal.SearchTerminalActionsRequest = {}, requestOptions?: Actions.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.terminal.SearchTerminalActionsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchTerminalActionsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.terminal.SearchTerminalActionsRequest, + ): 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/terminals/actions/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.terminal.SearchTerminalActionsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchTerminalActionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/terminals/actions/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.action ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -269,7 +280,7 @@ export class Actions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -352,7 +363,7 @@ export class Actions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/terminal/resources/checkouts/client/Client.ts b/src/api/resources/terminal/resources/checkouts/client/Client.ts index bcce81a0d..f4ec74749 100644 --- a/src/api/resources/terminal/resources/checkouts/client/Client.ts +++ b/src/api/resources/terminal/resources/checkouts/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Checkouts { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Checkouts { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -89,7 +89,7 @@ export class Checkouts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -157,81 +157,90 @@ export class Checkouts { * limit: 2 * }) */ - public search( + public async search( request: Square.terminal.SearchTerminalCheckoutsRequest = {}, requestOptions?: Checkouts.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.terminal.SearchTerminalCheckoutsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchTerminalCheckoutsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.terminal.SearchTerminalCheckoutsRequest, + ): 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/terminals/checkouts/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.terminal.SearchTerminalCheckoutsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - case "timeout": - throw new errors.SquareTimeoutError( - "Timeout exceeded when calling POST /v2/terminals/checkouts/search.", - ); - case "unknown": - throw new errors.SquareError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + if (_response.ok) { + return { + data: serializers.SearchTerminalCheckoutsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/terminals/checkouts/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.checkouts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -269,7 +278,7 @@ export class Checkouts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -352,7 +361,7 @@ export class Checkouts { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/terminal/resources/refunds/client/Client.ts b/src/api/resources/terminal/resources/refunds/client/Client.ts index 239b3469d..9bd100a47 100644 --- a/src/api/resources/terminal/resources/refunds/client/Client.ts +++ b/src/api/resources/terminal/resources/refunds/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Refunds { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Refunds { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -86,7 +86,7 @@ export class Refunds { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -154,79 +154,90 @@ export class Refunds { * limit: 1 * }) */ - public search( + public async search( request: Square.terminal.SearchTerminalRefundsRequest = {}, requestOptions?: Refunds.RequestOptions, - ): 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: 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: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.terminal.SearchTerminalRefundsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchTerminalRefundsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.terminal.SearchTerminalRefundsRequest, + ): 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/terminals/refunds/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.terminal.SearchTerminalRefundsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchTerminalRefundsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/terminals/refunds/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + 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)); + }, + }); } /** @@ -264,7 +275,7 @@ export class Refunds { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -347,7 +358,7 @@ export class Refunds { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/transferOrders/client/Client.ts b/src/api/resources/transferOrders/client/Client.ts new file mode 100644 index 000000000..ea4b0ebf1 --- /dev/null +++ b/src/api/resources/transferOrders/client/Client.ts @@ -0,0 +1,899 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace TransferOrders { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-10-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-10-16"; + /** Additional headers to include in the request. */ + headers?: Record | undefined>; + } +} + +export class TransferOrders { + protected readonly _options: TransferOrders.Options; + + constructor(_options: TransferOrders.Options = {}) { + this._options = _options; + } + + /** + * Creates a new transfer order in [DRAFT](entity:TransferOrderStatus) status. A transfer order represents the intent + * to move [CatalogItemVariation](entity:CatalogItemVariation)s from one [Location](entity:Location) to another. + * The source and destination locations must be different and must belong to your Square account. + * + * In [DRAFT](entity:TransferOrderStatus) status, you can: + * - Add or remove items + * - Modify quantities + * - Update shipping information + * - Delete the entire order via [DeleteTransferOrder](api-endpoint:TransferOrders-DeleteTransferOrder) + * + * The request requires source_location_id and destination_location_id. + * Inventory levels are not affected until the order is started via + * [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder). + * + * Common integration points: + * - Sync with warehouse management systems + * - Automate regular stock transfers + * - Initialize transfers from inventory optimization systems + * + * Creates a [transfer_order.created](webhook:transfer_order.created) webhook event. + * + * @param {Square.CreateTransferOrderRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.create({ + * idempotencyKey: "65cc0586-3e82-384s-b524-3885cffd52", + * transferOrder: { + * sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + * destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + * expectedAt: "2025-11-09T05:00:00Z", + * notes: "Example transfer order for inventory redistribution between locations", + * trackingNumber: "TRACK123456789", + * createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + * lineItems: [{ + * itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + * quantityOrdered: "5" + * }, { + * itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + * quantityOrdered: "3" + * }] + * } + * }) + */ + public create( + request: Square.CreateTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Square.CreateTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): 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/transfer-orders", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.CreateTransferOrderRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.CreateTransferOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/transfer-orders."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Searches for transfer orders using filters. Returns a paginated list of matching + * [TransferOrder](entity:TransferOrder)s sorted by creation date. + * + * Common search scenarios: + * - Find orders for a source [Location](entity:Location) + * - Find orders for a destination [Location](entity:Location) + * - Find orders in a particular [TransferOrderStatus](entity:TransferOrderStatus) + * + * @param {Square.SearchTransferOrdersRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.search({ + * query: { + * filter: { + * sourceLocationIds: ["EXAMPLE_SOURCE_LOCATION_ID_123"], + * destinationLocationIds: ["EXAMPLE_DEST_LOCATION_ID_456"], + * statuses: ["STARTED", "PARTIALLY_RECEIVED"] + * }, + * sort: { + * field: "UPDATED_AT", + * order: "DESC" + * } + * }, + * cursor: "eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9", + * limit: 10 + * }) + */ + public async search( + request: Square.SearchTransferOrdersRequest = {}, + requestOptions?: TransferOrders.RequestOptions, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchTransferOrdersRequest, + ): 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/transfer-orders/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchTransferOrdersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.SearchTransferOrdersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/transfer-orders/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.transferOrders ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a specific [TransferOrder](entity:TransferOrder) by ID. Returns the complete + * order details including: + * + * - Basic information (status, dates, notes) + * - Line items with ordered and received quantities + * - Source and destination [Location](entity:Location)s + * - Tracking information (if available) + * + * @param {Square.GetTransferOrdersRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.get({ + * transferOrderId: "transfer_order_id" + * }) + */ + public get( + request: Square.GetTransferOrdersRequest, + requestOptions?: TransferOrders.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); + } + + private async __get( + request: Square.GetTransferOrdersRequest, + requestOptions?: TransferOrders.RequestOptions, + ): Promise> { + const { transferOrderId } = request; + 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/transfer-orders/${encodeURIComponent(transferOrderId)}`, + ), + method: "GET", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.RetrieveTransferOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/transfer-orders/{transfer_order_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Updates an existing transfer order. This endpoint supports sparse updates, + * allowing you to modify specific fields without affecting others. + * + * Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event. + * + * @param {Square.UpdateTransferOrderRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.update({ + * transferOrderId: "transfer_order_id", + * idempotencyKey: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + * transferOrder: { + * sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_789", + * destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_101", + * expectedAt: "2025-11-10T08:00:00Z", + * notes: "Updated: Priority transfer due to low stock at destination", + * trackingNumber: "TRACK987654321", + * lineItems: [{ + * uid: "1", + * quantityOrdered: "7" + * }, { + * itemVariationId: "EXAMPLE_NEW_ITEM_VARIATION_ID_003", + * quantityOrdered: "2" + * }, { + * uid: "2", + * remove: true + * }] + * }, + * version: BigInt("1753109537351") + * }) + */ + public update( + request: Square.UpdateTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); + } + + private async __update( + request: Square.UpdateTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): Promise> { + const { transferOrderId, ..._body } = request; + 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/transfer-orders/${encodeURIComponent(transferOrderId)}`, + ), + method: "PUT", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.UpdateTransferOrderRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.UpdateTransferOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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 PUT /v2/transfer-orders/{transfer_order_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Deletes a transfer order in [DRAFT](entity:TransferOrderStatus) status. + * Only draft orders can be deleted. Once an order is started via + * [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder), it can no longer be deleted. + * + * Creates a [transfer_order.deleted](webhook:transfer_order.deleted) webhook event. + * + * @param {Square.DeleteTransferOrdersRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.delete({ + * transferOrderId: "transfer_order_id", + * version: BigInt("1000000") + * }) + */ + public delete( + request: Square.DeleteTransferOrdersRequest, + requestOptions?: TransferOrders.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions)); + } + + private async __delete( + request: Square.DeleteTransferOrdersRequest, + requestOptions?: TransferOrders.RequestOptions, + ): Promise> { + const { transferOrderId, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.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/transfer-orders/${encodeURIComponent(transferOrderId)}`, + ), + method: "DELETE", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.DeleteTransferOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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 DELETE /v2/transfer-orders/{transfer_order_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Cancels a transfer order in [STARTED](entity:TransferOrderStatus) or + * [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. Any unreceived quantities will no + * longer be receivable and will be immediately returned to the source [Location](entity:Location)'s inventory. + * + * Common reasons for cancellation: + * - Items no longer needed at destination + * - Source location needs the inventory + * - Order created in error + * + * Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event. + * + * @param {Square.CancelTransferOrderRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.cancel({ + * transferOrderId: "transfer_order_id", + * idempotencyKey: "65cc0586-3e82-4d08-b524-3885cffd52", + * version: BigInt("1753117449752") + * }) + */ + public cancel( + request: Square.CancelTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__cancel(request, requestOptions)); + } + + private async __cancel( + request: Square.CancelTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): Promise> { + const { transferOrderId, ..._body } = request; + 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/transfer-orders/${encodeURIComponent(transferOrderId)}/cancel`, + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.CancelTransferOrderRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.CancelTransferOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/transfer-orders/{transfer_order_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Records receipt of [CatalogItemVariation](entity:CatalogItemVariation)s for a transfer order. + * This endpoint supports partial receiving - you can receive items in multiple batches. + * + * For each line item, you can specify: + * - Quantity received in good condition (added to destination inventory with [InventoryState](entity:InventoryState) of IN_STOCK) + * - Quantity damaged during transit/handling (added to destination inventory with [InventoryState](entity:InventoryState) of WASTE) + * - Quantity canceled (returned to source location's inventory) + * + * The order must be in [STARTED](entity:TransferOrderStatus) or [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. + * Received quantities are added to the destination [Location](entity:Location)'s inventory according to their condition. + * Canceled quantities are immediately returned to the source [Location](entity:Location)'s inventory. + * + * When all items are either received, damaged, or canceled, the order moves to + * [COMPLETED](entity:TransferOrderStatus) status. + * + * Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event. + * + * @param {Square.ReceiveTransferOrderRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.receive({ + * transferOrderId: "transfer_order_id", + * idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_101", + * receipt: { + * lineItems: [{ + * transferOrderLineUid: "transfer_order_line_uid", + * quantityReceived: "3", + * quantityDamaged: "1", + * quantityCanceled: "1" + * }, { + * transferOrderLineUid: "transfer_order_line_uid", + * quantityReceived: "2", + * quantityCanceled: "1" + * }] + * }, + * version: BigInt("1753118664873") + * }) + */ + public receive( + request: Square.ReceiveTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__receive(request, requestOptions)); + } + + private async __receive( + request: Square.ReceiveTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): Promise> { + const { transferOrderId, ..._body } = request; + 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/transfer-orders/${encodeURIComponent(transferOrderId)}/receive`, + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.ReceiveTransferOrderRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.ReceiveTransferOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/transfer-orders/{transfer_order_id}/receive.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Changes a [DRAFT](entity:TransferOrderStatus) transfer order to [STARTED](entity:TransferOrderStatus) status. + * This decrements inventory at the source [Location](entity:Location) and marks it as in-transit. + * + * The order must be in [DRAFT](entity:TransferOrderStatus) status and have all required fields populated. + * Once started, the order can no longer be deleted, but it can be canceled via + * [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder). + * + * Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event. + * + * @param {Square.StartTransferOrderRequest} request + * @param {TransferOrders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.transferOrders.start({ + * transferOrderId: "transfer_order_id", + * idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_789", + * version: BigInt("1753109537351") + * }) + */ + public start( + request: Square.StartTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__start(request, requestOptions)); + } + + private async __start( + request: Square.StartTransferOrderRequest, + requestOptions?: TransferOrders.RequestOptions, + ): Promise> { + const { transferOrderId, ..._body } = request; + 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/transfer-orders/${encodeURIComponent(transferOrderId)}/start`, + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.StartTransferOrderRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.StartTransferOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/transfer-orders/{transfer_order_id}/start.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/transferOrders/client/index.ts b/src/api/resources/transferOrders/client/index.ts new file mode 100644 index 000000000..f33205a0f --- /dev/null +++ b/src/api/resources/transferOrders/client/index.ts @@ -0,0 +1,2 @@ +export {}; +export * from "./requests"; diff --git a/src/api/resources/transferOrders/client/requests/CancelTransferOrderRequest.ts b/src/api/resources/transferOrders/client/requests/CancelTransferOrderRequest.ts new file mode 100644 index 000000000..0f9610db4 --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/CancelTransferOrderRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * transferOrderId: "transfer_order_id", + * idempotencyKey: "65cc0586-3e82-4d08-b524-3885cffd52", + * version: BigInt("1753117449752") + * } + */ +export interface CancelTransferOrderRequest { + /** + * The ID of the transfer order to cancel. Must be in STARTED or PARTIALLY_RECEIVED status. + */ + transferOrderId: string; + /** + * A unique string that identifies this UpdateTransferOrder request. Keys can be + * any valid string but must be unique for every UpdateTransferOrder request. + */ + idempotencyKey: string; + /** Version for optimistic concurrency */ + version?: bigint; +} diff --git a/src/api/resources/transferOrders/client/requests/CreateTransferOrderRequest.ts b/src/api/resources/transferOrders/client/requests/CreateTransferOrderRequest.ts new file mode 100644 index 000000000..faba51024 --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/CreateTransferOrderRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * idempotencyKey: "65cc0586-3e82-384s-b524-3885cffd52", + * transferOrder: { + * sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + * destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + * expectedAt: "2025-11-09T05:00:00Z", + * notes: "Example transfer order for inventory redistribution between locations", + * trackingNumber: "TRACK123456789", + * createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + * lineItems: [{ + * itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + * quantityOrdered: "5" + * }, { + * itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + * quantityOrdered: "3" + * }] + * } + * } + */ +export interface CreateTransferOrderRequest { + /** + * A unique string that identifies this CreateTransferOrder request. Keys can be + * any valid string but must be unique for every CreateTransferOrder request. + */ + idempotencyKey: string; + /** The transfer order to create */ + transferOrder: Square.CreateTransferOrderData; +} diff --git a/src/api/resources/transferOrders/client/requests/DeleteTransferOrdersRequest.ts b/src/api/resources/transferOrders/client/requests/DeleteTransferOrdersRequest.ts new file mode 100644 index 000000000..06b9d4593 --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/DeleteTransferOrdersRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * transferOrderId: "transfer_order_id", + * version: BigInt("1000000") + * } + */ +export interface DeleteTransferOrdersRequest { + /** + * The ID of the transfer order to delete + */ + transferOrderId: string; + /** + * Version for optimistic concurrency + */ + version?: bigint | null; +} diff --git a/src/api/resources/transferOrders/client/requests/GetTransferOrdersRequest.ts b/src/api/resources/transferOrders/client/requests/GetTransferOrdersRequest.ts new file mode 100644 index 000000000..63f1481de --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/GetTransferOrdersRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * transferOrderId: "transfer_order_id" + * } + */ +export interface GetTransferOrdersRequest { + /** + * The ID of the transfer order to retrieve + */ + transferOrderId: string; +} diff --git a/src/api/resources/transferOrders/client/requests/ReceiveTransferOrderRequest.ts b/src/api/resources/transferOrders/client/requests/ReceiveTransferOrderRequest.ts new file mode 100644 index 000000000..d7786a107 --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/ReceiveTransferOrderRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * transferOrderId: "transfer_order_id", + * idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_101", + * receipt: { + * lineItems: [{ + * transferOrderLineUid: "transfer_order_line_uid", + * quantityReceived: "3", + * quantityDamaged: "1", + * quantityCanceled: "1" + * }, { + * transferOrderLineUid: "transfer_order_line_uid", + * quantityReceived: "2", + * quantityCanceled: "1" + * }] + * }, + * version: BigInt("1753118664873") + * } + */ +export interface ReceiveTransferOrderRequest { + /** + * The ID of the transfer order to receive items for + */ + transferOrderId: string; + /** A unique key to make this request idempotent */ + idempotencyKey: string; + /** The receipt details */ + receipt: Square.TransferOrderGoodsReceipt; + /** Version for optimistic concurrency */ + version?: bigint; +} diff --git a/src/api/resources/transferOrders/client/requests/SearchTransferOrdersRequest.ts b/src/api/resources/transferOrders/client/requests/SearchTransferOrdersRequest.ts new file mode 100644 index 000000000..1dd02b62c --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/SearchTransferOrdersRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * sourceLocationIds: ["EXAMPLE_SOURCE_LOCATION_ID_123"], + * destinationLocationIds: ["EXAMPLE_DEST_LOCATION_ID_456"], + * statuses: ["STARTED", "PARTIALLY_RECEIVED"] + * }, + * sort: { + * field: "UPDATED_AT", + * order: "DESC" + * } + * }, + * cursor: "eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9", + * limit: 10 + * } + */ +export interface SearchTransferOrdersRequest { + /** The search query */ + query?: Square.TransferOrderQuery; + /** Pagination cursor from a previous search response */ + cursor?: string; + /** Maximum number of results to return (1-100) */ + limit?: number; +} diff --git a/src/api/resources/transferOrders/client/requests/StartTransferOrderRequest.ts b/src/api/resources/transferOrders/client/requests/StartTransferOrderRequest.ts new file mode 100644 index 000000000..cad5a9131 --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/StartTransferOrderRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * transferOrderId: "transfer_order_id", + * idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_789", + * version: BigInt("1753109537351") + * } + */ +export interface StartTransferOrderRequest { + /** + * The ID of the transfer order to start. Must be in DRAFT status. + */ + transferOrderId: string; + /** + * A unique string that identifies this UpdateTransferOrder request. Keys can be + * any valid string but must be unique for every UpdateTransferOrder request. + */ + idempotencyKey: string; + /** Version for optimistic concurrency */ + version?: bigint; +} diff --git a/src/api/resources/transferOrders/client/requests/UpdateTransferOrderRequest.ts b/src/api/resources/transferOrders/client/requests/UpdateTransferOrderRequest.ts new file mode 100644 index 000000000..2882b1415 --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/UpdateTransferOrderRequest.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * transferOrderId: "transfer_order_id", + * idempotencyKey: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + * transferOrder: { + * sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_789", + * destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_101", + * expectedAt: "2025-11-10T08:00:00Z", + * notes: "Updated: Priority transfer due to low stock at destination", + * trackingNumber: "TRACK987654321", + * lineItems: [{ + * uid: "1", + * quantityOrdered: "7" + * }, { + * itemVariationId: "EXAMPLE_NEW_ITEM_VARIATION_ID_003", + * quantityOrdered: "2" + * }, { + * uid: "2", + * remove: true + * }] + * }, + * version: BigInt("1753109537351") + * } + */ +export interface UpdateTransferOrderRequest { + /** + * The ID of the transfer order to update + */ + transferOrderId: string; + /** A unique string that identifies this UpdateTransferOrder request. Keys must contain only alphanumeric characters, dashes and underscores */ + idempotencyKey: string; + /** The transfer order updates to apply */ + transferOrder: Square.UpdateTransferOrderData; + /** Version for optimistic concurrency */ + version?: bigint; +} diff --git a/src/api/resources/transferOrders/client/requests/index.ts b/src/api/resources/transferOrders/client/requests/index.ts new file mode 100644 index 000000000..f984bc5f1 --- /dev/null +++ b/src/api/resources/transferOrders/client/requests/index.ts @@ -0,0 +1,8 @@ +export { type CreateTransferOrderRequest } from "./CreateTransferOrderRequest"; +export { type SearchTransferOrdersRequest } from "./SearchTransferOrdersRequest"; +export { type GetTransferOrdersRequest } from "./GetTransferOrdersRequest"; +export { type UpdateTransferOrderRequest } from "./UpdateTransferOrderRequest"; +export { type DeleteTransferOrdersRequest } from "./DeleteTransferOrdersRequest"; +export { type CancelTransferOrderRequest } from "./CancelTransferOrderRequest"; +export { type ReceiveTransferOrderRequest } from "./ReceiveTransferOrderRequest"; +export { type StartTransferOrderRequest } from "./StartTransferOrderRequest"; diff --git a/src/api/resources/transferOrders/index.ts b/src/api/resources/transferOrders/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/transferOrders/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/v1Transactions/client/Client.ts b/src/api/resources/v1Transactions/client/Client.ts index 7e0b91a53..feb0094bb 100644 --- a/src/api/resources/v1Transactions/client/Client.ts +++ b/src/api/resources/v1Transactions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace V1Transactions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace V1Transactions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -51,7 +51,10 @@ export class V1Transactions { * * @example * await client.v1Transactions.v1ListOrders({ - * locationId: "location_id" + * locationId: "location_id", + * order: "DESC", + * limit: 1, + * batchToken: "batch_token" * }) */ public v1ListOrders( @@ -94,7 +97,7 @@ export class V1Transactions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -177,7 +180,7 @@ export class V1Transactions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -262,7 +265,7 @@ export class V1Transactions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts b/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts index ef21b9525..b485a1a5f 100644 --- a/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts +++ b/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts @@ -7,7 +7,10 @@ import * as Square from "../../../../index"; /** * @example * { - * locationId: "location_id" + * locationId: "location_id", + * order: "DESC", + * limit: 1, + * batchToken: "batch_token" * } */ export interface V1ListOrdersRequest { diff --git a/src/api/resources/vendors/client/Client.ts b/src/api/resources/vendors/client/Client.ts index d924fa434..716ec92d3 100644 --- a/src/api/resources/vendors/client/Client.ts +++ b/src/api/resources/vendors/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Vendors { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Vendors { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -97,7 +97,7 @@ export class Vendors { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -183,7 +183,7 @@ export class Vendors { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -276,7 +276,7 @@ export class Vendors { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -381,7 +381,7 @@ export class Vendors { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -442,79 +442,88 @@ export class Vendors { * @example * await client.vendors.search() */ - public search( + public async 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> { - 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/vendors/search", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", - }), - requestOptions?.headers, - ), - contentType: "application/json", - requestType: "json", - body: serializers.SearchVendorsRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.SearchVendorsResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.SquareError({ - statusCode: _response.error.statusCode, - 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, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Square.SearchVendorsRequest, + ): 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/vendors/search", + ), + method: "POST", + headers: mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? "2025-10-16", + }), + requestOptions?.headers, + ), + contentType: "application/json", + requestType: "json", + body: serializers.SearchVendorsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); - 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, - }); - } + if (_response.ok) { + return { + data: serializers.SearchVendorsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + 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/vendors/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.cursor != null && !(typeof response?.cursor === "string" && response?.cursor === ""), + getItems: (response) => response?.vendors ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); } /** @@ -552,7 +561,7 @@ export class Vendors { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -642,7 +651,7 @@ export class Vendors { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts index 295179460..c0d48deaf 100644 --- a/src/api/resources/webhooks/client/Client.ts +++ b/src/api/resources/webhooks/client/Client.ts @@ -14,7 +14,7 @@ export declare namespace Webhooks { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; diff --git a/src/api/resources/webhooks/resources/eventTypes/client/Client.ts b/src/api/resources/webhooks/resources/eventTypes/client/Client.ts index 2e74fa548..66b829363 100644 --- a/src/api/resources/webhooks/resources/eventTypes/client/Client.ts +++ b/src/api/resources/webhooks/resources/eventTypes/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace EventTypes { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace EventTypes { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,9 @@ export class EventTypes { * @param {EventTypes.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.webhooks.eventTypes.list() + * await client.webhooks.eventTypes.list({ + * apiVersion: "api_version" + * }) */ public list( request: Square.webhooks.ListEventTypesRequest = {}, @@ -81,7 +83,7 @@ export class EventTypes { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..dacf1b022 100644 --- a/src/api/resources/webhooks/resources/eventTypes/client/requests/ListEventTypesRequest.ts +++ b/src/api/resources/webhooks/resources/eventTypes/client/requests/ListEventTypesRequest.ts @@ -4,7 +4,9 @@ /** * @example - * {} + * { + * apiVersion: "api_version" + * } */ export interface ListEventTypesRequest { /** diff --git a/src/api/resources/webhooks/resources/subscriptions/client/Client.ts b/src/api/resources/webhooks/resources/subscriptions/client/Client.ts index f23d405e8..c39e407b6 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/Client.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/Client.ts @@ -16,7 +16,7 @@ export declare namespace Subscriptions { baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; @@ -30,7 +30,7 @@ export declare namespace Subscriptions { /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the Square-Version header */ - version?: "2025-09-24"; + version?: "2025-10-16"; /** Additional headers to include in the request. */ headers?: Record | undefined>; } @@ -50,7 +50,12 @@ export class Subscriptions { * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await client.webhooks.subscriptions.list() + * await client.webhooks.subscriptions.list({ + * cursor: "cursor", + * includeDisabled: true, + * sortOrder: "DESC", + * limit: 1 + * }) */ public async list( request: Square.webhooks.ListSubscriptionsRequest = {}, @@ -89,7 +94,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -190,7 +195,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -277,7 +282,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -364,7 +369,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -453,7 +458,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -537,7 +542,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), @@ -627,7 +632,7 @@ export class Subscriptions { this._options?.headers, mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader(), - "Square-Version": requestOptions?.version ?? "2025-09-24", + "Square-Version": requestOptions?.version ?? "2025-10-16", }), requestOptions?.headers, ), 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..3507e8a2b 100644 --- a/src/api/resources/webhooks/resources/subscriptions/client/requests/ListSubscriptionsRequest.ts +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/ListSubscriptionsRequest.ts @@ -6,7 +6,12 @@ import * as Square from "../../../../../../index"; /** * @example - * {} + * { + * cursor: "cursor", + * includeDisabled: true, + * sortOrder: "DESC", + * limit: 1 + * } */ export interface ListSubscriptionsRequest { /** diff --git a/src/api/types/BulkRetrieveChannelsRequestConstants.ts b/src/api/types/BulkRetrieveChannelsRequestConstants.ts new file mode 100644 index 000000000..181509f5e --- /dev/null +++ b/src/api/types/BulkRetrieveChannelsRequestConstants.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type BulkRetrieveChannelsRequestConstants = "MAX_BATCH_SIZE"; diff --git a/src/api/types/BulkRetrieveChannelsResponse.ts b/src/api/types/BulkRetrieveChannelsResponse.ts new file mode 100644 index 000000000..aeb031c2f --- /dev/null +++ b/src/api/types/BulkRetrieveChannelsResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the request body for the + * [BulkRetrieveChannels](api-endpoint:Channels-BulkRetrieveChannels) endpoint. + */ +export interface BulkRetrieveChannelsResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** + * A map of channel IDs to channel responses which tell whether + * retrieval for a specific channel is success or not. + * Channel response of a success retrieval would contain channel info + * whereas channel response of a failed retrieval would have error info. + */ + responses?: Record; +} diff --git a/src/api/types/CancelTransferOrderResponse.ts b/src/api/types/CancelTransferOrderResponse.ts new file mode 100644 index 000000000..b2d0da40c --- /dev/null +++ b/src/api/types/CancelTransferOrderResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response for canceling a transfer order + */ +export interface CancelTransferOrderResponse { + /** The updated transfer order with status changed to CANCELED */ + transferOrder?: Square.TransferOrder; + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/Channel.ts b/src/api/types/Channel.ts new file mode 100644 index 000000000..6a655fc63 --- /dev/null +++ b/src/api/types/Channel.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface Channel { + /** The channel's unique ID. */ + id?: string; + /** The unique ID of the merchant this channel belongs to. */ + merchantId?: string; + /** The name of the channel. */ + name?: string | null; + /** The version number which is incremented each time an update is made to the channel. */ + version?: number; + /** Represents an entity the channel is associated with. */ + reference?: Square.Reference; + /** + * Status of the channel. + * See [Status](#type-status) for possible values + */ + status?: Square.ChannelStatus; + /** + * The timestamp for when the channel was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + * For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). + */ + createdAt?: string; + /** + * The timestamp for when the channel was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + * For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). + */ + updatedAt?: string; +} diff --git a/src/api/types/ChannelStatus.ts b/src/api/types/ChannelStatus.ts new file mode 100644 index 000000000..b10da68a2 --- /dev/null +++ b/src/api/types/ChannelStatus.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ChannelStatus = "ACTIVE" | "INACTIVE"; +export const ChannelStatus = { + Active: "ACTIVE", + Inactive: "INACTIVE", +} as const; diff --git a/src/api/types/CreateTransferOrderData.ts b/src/api/types/CreateTransferOrderData.ts new file mode 100644 index 000000000..889cda53a --- /dev/null +++ b/src/api/types/CreateTransferOrderData.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Data for creating a new transfer order to move [CatalogItemVariation](entity:CatalogItemVariation)s + * between [Location](entity:Location)s. Used with the [CreateTransferOrder](api-endpoint:TransferOrders-CreateTransferOrder) + * endpoint. + */ +export interface CreateTransferOrderData { + /** + * The source [Location](entity:Location) that will send the items. Must be an active location + * in your Square account with sufficient inventory of the requested items. + */ + sourceLocationId: string; + /** + * The destination [Location](entity:Location) that will receive the items. Must be an active location + * in your Square account + */ + destinationLocationId: string; + /** Expected transfer date in RFC 3339 format (e.g. "2023-10-01T12:00:00Z"). */ + expectedAt?: string | null; + /** Optional notes about the transfer */ + notes?: string | null; + /** Optional shipment tracking number */ + trackingNumber?: string | null; + /** + * ID of the [TeamMember](entity:TeamMember) creating this transfer order. Used for tracking + * and auditing purposes. + */ + createdByTeamMemberId?: string | null; + /** List of [CatalogItemVariation](entity:CatalogItemVariation)s to transfer, including quantities */ + lineItems?: Square.CreateTransferOrderLineData[] | null; +} diff --git a/src/api/types/CreateTransferOrderLineData.ts b/src/api/types/CreateTransferOrderLineData.ts new file mode 100644 index 000000000..99db9a31f --- /dev/null +++ b/src/api/types/CreateTransferOrderLineData.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Data for creating a new transfer order line item. Each line item specifies a + * [CatalogItemVariation](entity:CatalogItemVariation) and quantity to transfer. + */ +export interface CreateTransferOrderLineData { + /** + * ID of the [CatalogItemVariation](entity:CatalogItemVariation) to transfer. Must reference a valid + * item variation in the [Catalog](api:Catalog). The item variation must be: + * - Active and available for sale + * - Enabled for inventory tracking + * - Available at the source location + */ + itemVariationId: string; + /** Total quantity ordered */ + quantityOrdered: string; +} diff --git a/src/api/types/CreateTransferOrderResponse.ts b/src/api/types/CreateTransferOrderResponse.ts new file mode 100644 index 000000000..e8d117fe7 --- /dev/null +++ b/src/api/types/CreateTransferOrderResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response for creating a transfer order. + */ +export interface CreateTransferOrderResponse { + /** The created transfer order */ + transferOrder?: Square.TransferOrder; + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CustomAttribute.ts b/src/api/types/CustomAttribute.ts index 78cde8e8f..ee921ef55 100644 --- a/src/api/types/CustomAttribute.ts +++ b/src/api/types/CustomAttribute.ts @@ -23,7 +23,13 @@ export interface CustomAttribute { * underscores (_), and hyphens (-). */ key?: string | null; - value?: unknown; + /** + * The value assigned to the custom attribute. It is validated against the custom + * attribute definition's schema on write operations. For more information about custom + * attribute values, + * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). + */ + value?: unknown | null; /** * Read only. The current version of the custom attribute. This field is incremented when the custom attribute is changed. * When updating an existing custom attribute value, you can provide this field diff --git a/src/api/types/DeleteTransferOrderResponse.ts b/src/api/types/DeleteTransferOrderResponse.ts new file mode 100644 index 000000000..2b83f2ccc --- /dev/null +++ b/src/api/types/DeleteTransferOrderResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response for deleting a transfer order + */ +export interface DeleteTransferOrderResponse { + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListChannelsRequestConstants.ts b/src/api/types/ListChannelsRequestConstants.ts new file mode 100644 index 000000000..8cfda1584 --- /dev/null +++ b/src/api/types/ListChannelsRequestConstants.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ListChannelsRequestConstants = "MAX_PAGE_SIZE"; diff --git a/src/api/types/ListChannelsResponse.ts b/src/api/types/ListChannelsResponse.ts new file mode 100644 index 000000000..c16d7b2ee --- /dev/null +++ b/src/api/types/ListChannelsResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListChannelsResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** List of requested Channel. */ + channels?: Square.Channel[]; + /** The token required to retrieve the next page of results. */ + cursor?: string; +} diff --git a/src/api/types/ReceiveTransferOrderResponse.ts b/src/api/types/ReceiveTransferOrderResponse.ts new file mode 100644 index 000000000..090bfc4e6 --- /dev/null +++ b/src/api/types/ReceiveTransferOrderResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response for receiving items for a transfer order + */ +export interface ReceiveTransferOrderResponse { + /** The updated transfer order */ + transferOrder?: Square.TransferOrder; + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/Reference.ts b/src/api/types/Reference.ts new file mode 100644 index 000000000..414e8e515 --- /dev/null +++ b/src/api/types/Reference.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface Reference { + /** + * The type of entity a channel is associated with. + * See [Type](#type-type) for possible values + */ + type?: Square.ReferenceType; + /** The id of the entity a channel is associated with. */ + id?: string; +} diff --git a/src/api/types/ReferenceType.ts b/src/api/types/ReferenceType.ts new file mode 100644 index 000000000..0dd9de135 --- /dev/null +++ b/src/api/types/ReferenceType.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of platform concept a channel can represent. + */ +export type ReferenceType = + | "UNKNOWN_TYPE" + | "LOCATION" + | "FIRST_PARTY_INTEGRATION" + | "OAUTH_APPLICATION" + | "ONLINE_SITE" + | "ONLINE_CHECKOUT" + | "INVOICE" + | "GIFT_CARD" + | "GIFT_CARD_MARKETPLACE" + | "RECURRING_SUBSCRIPTION" + | "ONLINE_BOOKING_FLOW" + | "SQUARE_ASSISTANT" + | "CASH_LOCAL" + | "POINT_OF_SALE" + | "KIOSK"; +export const ReferenceType = { + UnknownType: "UNKNOWN_TYPE", + Location: "LOCATION", + FirstPartyIntegration: "FIRST_PARTY_INTEGRATION", + OauthApplication: "OAUTH_APPLICATION", + OnlineSite: "ONLINE_SITE", + OnlineCheckout: "ONLINE_CHECKOUT", + Invoice: "INVOICE", + GiftCard: "GIFT_CARD", + GiftCardMarketplace: "GIFT_CARD_MARKETPLACE", + RecurringSubscription: "RECURRING_SUBSCRIPTION", + OnlineBookingFlow: "ONLINE_BOOKING_FLOW", + SquareAssistant: "SQUARE_ASSISTANT", + CashLocal: "CASH_LOCAL", + PointOfSale: "POINT_OF_SALE", + Kiosk: "KIOSK", +} as const; diff --git a/src/api/types/RetrieveChannelResponse.ts b/src/api/types/RetrieveChannelResponse.ts new file mode 100644 index 000000000..04a3f8ad2 --- /dev/null +++ b/src/api/types/RetrieveChannelResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface RetrieveChannelResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested Channel. */ + channel?: Square.Channel; +} diff --git a/src/api/types/RetrieveTransferOrderResponse.ts b/src/api/types/RetrieveTransferOrderResponse.ts new file mode 100644 index 000000000..f122e6979 --- /dev/null +++ b/src/api/types/RetrieveTransferOrderResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response containing the requested transfer order + */ +export interface RetrieveTransferOrderResponse { + /** The requested transfer order */ + transferOrder?: Square.TransferOrder; + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/SearchTransferOrdersResponse.ts b/src/api/types/SearchTransferOrdersResponse.ts new file mode 100644 index 000000000..2e0de46ed --- /dev/null +++ b/src/api/types/SearchTransferOrdersResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response for searching transfer orders + */ +export interface SearchTransferOrdersResponse { + /** List of transfer orders matching the search criteria */ + transferOrders?: Square.TransferOrder[]; + /** Pagination cursor for fetching the next page of results */ + cursor?: string; + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/StartTransferOrderResponse.ts b/src/api/types/StartTransferOrderResponse.ts new file mode 100644 index 000000000..a58c3d150 --- /dev/null +++ b/src/api/types/StartTransferOrderResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response for starting a transfer order. + */ +export interface StartTransferOrderResponse { + /** The updated transfer order with status changed to STARTED */ + transferOrder?: Square.TransferOrder; + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/TransferOrder.ts b/src/api/types/TransferOrder.ts new file mode 100644 index 000000000..38e9be59d --- /dev/null +++ b/src/api/types/TransferOrder.ts @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a transfer order for moving [CatalogItemVariation](entity:CatalogItemVariation)s + * between [Location](entity:Location)s. Transfer orders track the entire lifecycle of an inventory + * transfer, including: + * - What items and quantities are being moved + * - Source and destination locations + * - Current [TransferOrderStatus](entity:TransferOrderStatus) + * - Shipping information and tracking + * - Which [TeamMember](entity:TeamMember) initiated the transfer + * + * This object is commonly used to: + * - Track [CatalogItemVariation](entity:CatalogItemVariation) movements between [Location](entity:Location)s + * - Reconcile expected vs received quantities + * - Monitor transfer progress and shipping status + * - Audit inventory movement history + */ +export interface TransferOrder { + /** + * Unique system-generated identifier for this transfer order. Use this ID for: + * - Retrieving transfer order details + * - Tracking status changes via webhooks + * - Linking transfers in external systems + */ + id?: string; + /** + * The source [Location](entity:Location) sending the [CatalogItemVariation](entity:CatalogItemVariation)s. + * This location must: + * - Be active in your Square organization + * - Have sufficient inventory for the items being transferred + * - Not be the same as the destination location + * + * This field is not updatable. + */ + sourceLocationId?: string | null; + /** + * The destination [Location](entity:Location) receiving the [CatalogItemVariation](entity:CatalogItemVariation)s. + * This location must: + * - Be active in your Square organization + * - Not be the same as the source location + * + * This field is not updatable. + */ + destinationLocationId?: string | null; + /** + * Current [TransferOrderStatus](entity:TransferOrderStatus) indicating where the order is in its lifecycle. + * Status transitions follow this progression: + * 1. [DRAFT](entity:TransferOrderStatus) -> [STARTED](entity:TransferOrderStatus) via [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder) + * 2. [STARTED](entity:TransferOrderStatus) -> [PARTIALLY_RECEIVED](entity:TransferOrderStatus) via [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder) + * 3. [PARTIALLY_RECEIVED](entity:TransferOrderStatus) -> [COMPLETED](entity:TransferOrderStatus) after all items received + * + * Orders can be [CANCELED](entity:TransferOrderStatus) from [STARTED](entity:TransferOrderStatus) or + * [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. + * + * This field is read-only and reflects the current state of the transfer order, and cannot be updated directly. Use the appropriate + * endpoints (e.g. [StartPurchaseOrder](api-endpoint:TransferOrders-StartTransferOrder), to change the status. + * See [TransferOrderStatus](#type-transferorderstatus) for possible values + */ + status?: Square.TransferOrderStatus; + /** + * Timestamp when the transfer order was created, in RFC 3339 format. + * Used for: + * - Auditing transfer history + * - Tracking order age + * - Reporting and analytics + */ + createdAt?: string; + /** + * Timestamp when the transfer order was last updated, in RFC 3339 format. + * Updated when: + * - Order status changes + * - Items are received + * - Notes or metadata are modified + */ + updatedAt?: string; + /** + * Expected transfer completion date, in RFC 3339 format. + * Used for: + * - Planning inventory availability + * - Scheduling receiving staff + * - Monitoring transfer timeliness + */ + expectedAt?: string | null; + /** Timestamp when the transfer order was completed or canceled, in RFC 3339 format (e.g. "2023-10-01T12:00:00Z"). */ + completedAt?: string; + /** Optional notes about the transfer. */ + notes?: string | null; + /** Shipment tracking number for monitoring transfer progress. */ + trackingNumber?: string | null; + /** ID of the [TeamMember](entity:TeamMember) who created this transfer order. This field is not writeable by the Connect V2 API. */ + createdByTeamMemberId?: string; + /** List of [CatalogItemVariation](entity:CatalogItemVariation)s being transferred. */ + lineItems?: Square.TransferOrderLine[] | null; + /** + * Version for optimistic concurrency control. This is a monotonically increasing integer + * that changes whenever the transfer order is modified. Use this when calling + * [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder) and other endpoints to ensure you're + * not overwriting concurrent changes. + */ + version?: bigint; +} diff --git a/src/api/types/TransferOrderCreatedEvent.ts b/src/api/types/TransferOrderCreatedEvent.ts new file mode 100644 index 000000000..1d5b14e75 --- /dev/null +++ b/src/api/types/TransferOrderCreatedEvent.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Published when a transfer_order is created. + */ +export interface TransferOrderCreatedEvent { + /** The ID of the target merchant associated with the event. */ + merchantId?: string | null; + /** The type of event this represents, `"transfer_order.created"`. */ + type?: string | null; + /** A unique ID for the event. */ + eventId?: string | null; + /** Timestamp of when the event was created, in RFC 3339 format. */ + createdAt?: string; + /** Data associated with the event. */ + data?: Square.TransferOrderCreatedEventData; +} diff --git a/src/api/types/TransferOrderCreatedEventData.ts b/src/api/types/TransferOrderCreatedEventData.ts new file mode 100644 index 000000000..18dc372b5 --- /dev/null +++ b/src/api/types/TransferOrderCreatedEventData.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TransferOrderCreatedEventData { + /** Name of the affected object’s type, `"transfer_order"`. */ + type?: string | null; + /** ID of the affected transfer_order. */ + id?: string; + /** An object containing the created transfer_order. */ + object?: Square.TransferOrderCreatedEventObject; +} diff --git a/src/api/types/TransferOrderCreatedEventObject.ts b/src/api/types/TransferOrderCreatedEventObject.ts new file mode 100644 index 000000000..66358281f --- /dev/null +++ b/src/api/types/TransferOrderCreatedEventObject.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TransferOrderCreatedEventObject { + /** The created transfer_order. */ + transferOrder?: Square.TransferOrder; +} diff --git a/src/api/types/TransferOrderDeletedEvent.ts b/src/api/types/TransferOrderDeletedEvent.ts new file mode 100644 index 000000000..b6826d923 --- /dev/null +++ b/src/api/types/TransferOrderDeletedEvent.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Published when a transfer_order is deleted. + */ +export interface TransferOrderDeletedEvent { + /** The ID of the target merchant associated with the event. */ + merchantId?: string | null; + /** The type of event this represents, `"transfer_order.deleted"`. */ + type?: string | null; + /** A unique ID for the event. */ + eventId?: string | null; + /** Timestamp of when the event was created, in RFC 3339 format. */ + createdAt?: string; + /** Data associated with the event. */ + data?: Square.TransferOrderDeletedEventData; +} diff --git a/src/api/types/TransferOrderDeletedEventData.ts b/src/api/types/TransferOrderDeletedEventData.ts new file mode 100644 index 000000000..f2359ac43 --- /dev/null +++ b/src/api/types/TransferOrderDeletedEventData.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TransferOrderDeletedEventData { + /** Name of the affected object’s type, `"transfer_order"`. */ + type?: string | null; + /** ID of the affected transfer_order. */ + id?: string; + /** Is true if the affected object was deleted. Otherwise absent. */ + deleted?: boolean | null; +} diff --git a/src/api/types/TransferOrderFilter.ts b/src/api/types/TransferOrderFilter.ts new file mode 100644 index 000000000..1df1a25fe --- /dev/null +++ b/src/api/types/TransferOrderFilter.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Filter criteria for searching transfer orders + */ +export interface TransferOrderFilter { + /** Filter by source location IDs */ + sourceLocationIds?: string[] | null; + /** Filter by destination location IDs */ + destinationLocationIds?: string[] | null; + /** + * Filter by order statuses + * See [TransferOrderStatus](#type-transferorderstatus) for possible values + */ + statuses?: Square.TransferOrderStatus[] | null; +} diff --git a/src/api/types/TransferOrderGoodsReceipt.ts b/src/api/types/TransferOrderGoodsReceipt.ts new file mode 100644 index 000000000..ad44aca8c --- /dev/null +++ b/src/api/types/TransferOrderGoodsReceipt.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The goods receipt details for a transfer order. This object represents a single receipt + * of goods against a transfer order, tracking: + * + * - Which [CatalogItemVariation](entity:CatalogItemVariation)s were received + * - Quantities received in good condition + * - Quantities damaged during transit/handling + * - Quantities canceled during receipt + * + * Multiple goods receipts can be created for a single transfer order to handle: + * - Partial deliveries + * - Multiple shipments + * - Split receipts across different dates + * - Cancellations of specific quantities + * + * Each receipt automatically: + * - Updates the transfer order status + * - Adjusts received quantities + * - Updates inventory levels at both source and destination [Location](entity:Location)s + */ +export interface TransferOrderGoodsReceipt { + /** + * Line items being received. Each line item specifies: + * - The item being received + * - Quantity received in good condition + * - Quantity received damaged + * - Quantity canceled + * + * Constraints: + * - Must include at least one line item + * - Maximum of 1000 line items per receipt + * - Each line item must reference a valid item from the transfer order + * - Total of received, damaged, and canceled quantities cannot exceed ordered quantity + */ + lineItems?: Square.TransferOrderGoodsReceiptLineItem[] | null; +} diff --git a/src/api/types/TransferOrderGoodsReceiptLineItem.ts b/src/api/types/TransferOrderGoodsReceiptLineItem.ts new file mode 100644 index 000000000..e22fafd1e --- /dev/null +++ b/src/api/types/TransferOrderGoodsReceiptLineItem.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A simplified line item for goods receipts in transfer orders + */ +export interface TransferOrderGoodsReceiptLineItem { + /** The unique identifier of the Transfer Order line being received */ + transferOrderLineUid: string; + /** + * The quantity received for this line item as a decimal string (e.g. "10.5"). + * These items will be added to the destination [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of IN_STOCK. + */ + quantityReceived?: string | null; + /** + * The quantity that was damaged during shipping/handling as a decimal string (e.g. "1.5"). + * These items will be added to the destination [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of WASTE. + */ + quantityDamaged?: string | null; + /** The quantity that was canceled during shipping/handling as a decimal string (e.g. "1.5"). These will be immediately added to inventory in the source location. */ + quantityCanceled?: string | null; +} diff --git a/src/api/types/TransferOrderLine.ts b/src/api/types/TransferOrderLine.ts new file mode 100644 index 000000000..2dc146fe3 --- /dev/null +++ b/src/api/types/TransferOrderLine.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a line item in a transfer order. Each line item tracks a specific + * [CatalogItemVariation](entity:CatalogItemVariation) being transferred, including ordered quantities + * and receipt status. + */ +export interface TransferOrderLine { + /** Unique system-generated identifier for the line item. Provide when updating/removing a line via [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder). */ + uid?: string; + /** + * The required identifier of the [CatalogItemVariation](entity:CatalogItemVariation) being transferred. Must reference + * a valid catalog item variation that exists in the [Catalog](api:Catalog). + */ + itemVariationId: string; + /** + * Total quantity ordered, formatted as a decimal string (e.g. "10 or 10.0000"). Required to be a positive number. + * + * To remove a line item, set `remove` to `true` in [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder). + */ + quantityOrdered: string; + /** Calculated quantity of this line item's yet to be received stock. This is the difference between the total quantity ordered and the sum of quantities received, canceled, and damaged. */ + quantityPending?: string; + /** + * Quantity received at destination. These items are added to the destination + * [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of IN_STOCK. + * + * This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder). + */ + quantityReceived?: string; + /** + * Quantity received in damaged condition. These items are added to the destination + * [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of WASTE. + * + * This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder). + */ + quantityDamaged?: string; + /** + * Quantity that was canceled. These items will be immediately added to inventory in the source location. + * + * This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder) or [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder). + */ + quantityCanceled?: string; +} diff --git a/src/api/types/TransferOrderQuery.ts b/src/api/types/TransferOrderQuery.ts new file mode 100644 index 000000000..13e3a282b --- /dev/null +++ b/src/api/types/TransferOrderQuery.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Query parameters for searching transfer orders + */ +export interface TransferOrderQuery { + /** Filter criteria */ + filter?: Square.TransferOrderFilter; + /** Sort configuration */ + sort?: Square.TransferOrderSort; +} diff --git a/src/api/types/TransferOrderSort.ts b/src/api/types/TransferOrderSort.ts new file mode 100644 index 000000000..64a794fdf --- /dev/null +++ b/src/api/types/TransferOrderSort.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Sort configuration for search results + */ +export interface TransferOrderSort { + /** + * Field to sort by + * See [TransferOrderSortField](#type-transferordersortfield) for possible values + */ + field?: Square.TransferOrderSortField; + /** + * Sort order direction + * See [SortOrder](#type-sortorder) for possible values + */ + order?: Square.SortOrder; +} diff --git a/src/api/types/TransferOrderSortField.ts b/src/api/types/TransferOrderSortField.ts new file mode 100644 index 000000000..b704e8b4f --- /dev/null +++ b/src/api/types/TransferOrderSortField.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Fields that can be used for sorting [TransferOrder](entity:TransferOrder)s in search results. + * Used with [SearchTransferOrders](api-endpoint:TransferOrders-SearchTransferOrders) to control + * the order of returned results. + */ +export type TransferOrderSortField = "CREATED_AT" | "UPDATED_AT"; +export const TransferOrderSortField = { + CreatedAt: "CREATED_AT", + UpdatedAt: "UPDATED_AT", +} as const; diff --git a/src/api/types/TransferOrderStatus.ts b/src/api/types/TransferOrderStatus.ts new file mode 100644 index 000000000..b3eb9eb2d --- /dev/null +++ b/src/api/types/TransferOrderStatus.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Status values for transfer orders. Represents the current state of a + * [TransferOrder](entity:TransferOrder) in its lifecycle from creation to completion. + * Each status determines what actions are available and how inventory is affected. + */ +export type TransferOrderStatus = "DRAFT" | "STARTED" | "PARTIALLY_RECEIVED" | "COMPLETED" | "CANCELED"; +export const TransferOrderStatus = { + Draft: "DRAFT", + Started: "STARTED", + PartiallyReceived: "PARTIALLY_RECEIVED", + Completed: "COMPLETED", + Canceled: "CANCELED", +} as const; diff --git a/src/api/types/TransferOrderUpdatedEvent.ts b/src/api/types/TransferOrderUpdatedEvent.ts new file mode 100644 index 000000000..ae0203992 --- /dev/null +++ b/src/api/types/TransferOrderUpdatedEvent.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Published when a transfer_order is updated. + */ +export interface TransferOrderUpdatedEvent { + /** The ID of the target merchant associated with the event. */ + merchantId?: string | null; + /** The type of event this represents, `"transfer_order.updated"`. */ + type?: string | null; + /** A unique ID for the event. */ + eventId?: string | null; + /** Timestamp of when the event was created, in RFC 3339 format. */ + createdAt?: string; + /** Data associated with the event. */ + data?: Square.TransferOrderUpdatedEventData; +} diff --git a/src/api/types/TransferOrderUpdatedEventData.ts b/src/api/types/TransferOrderUpdatedEventData.ts new file mode 100644 index 000000000..bf6998995 --- /dev/null +++ b/src/api/types/TransferOrderUpdatedEventData.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TransferOrderUpdatedEventData { + /** Name of the affected object’s type, `"transfer_order"`. */ + type?: string | null; + /** ID of the affected transfer_order. */ + id?: string; + /** An object containing the updated transfer_order. */ + object?: Square.TransferOrderUpdatedEventObject; +} diff --git a/src/api/types/TransferOrderUpdatedEventObject.ts b/src/api/types/TransferOrderUpdatedEventObject.ts new file mode 100644 index 000000000..198e8811d --- /dev/null +++ b/src/api/types/TransferOrderUpdatedEventObject.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TransferOrderUpdatedEventObject { + /** The updated transfer_order. */ + transferOrder?: Square.TransferOrder; +} diff --git a/src/api/types/UpdateTransferOrderData.ts b/src/api/types/UpdateTransferOrderData.ts new file mode 100644 index 000000000..3308e4fa1 --- /dev/null +++ b/src/api/types/UpdateTransferOrderData.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Data model for updating a transfer order. All fields are optional. + */ +export interface UpdateTransferOrderData { + /** + * The source [Location](entity:Location) that will send the items. Must be an active location + * in your Square account with sufficient inventory of the requested items. + */ + sourceLocationId?: string | null; + /** + * The destination [Location](entity:Location) that will receive the items. Must be an active location + * in your Square account. + */ + destinationLocationId?: string | null; + /** Expected transfer date in RFC 3339 format (e.g. "2023-10-01T12:00:00Z"). */ + expectedAt?: string | null; + /** Optional notes about the transfer */ + notes?: string | null; + /** Shipment tracking number */ + trackingNumber?: string | null; + /** List of items being transferred */ + lineItems?: Square.UpdateTransferOrderLineData[] | null; +} diff --git a/src/api/types/UpdateTransferOrderLineData.ts b/src/api/types/UpdateTransferOrderLineData.ts new file mode 100644 index 000000000..c12b58f0a --- /dev/null +++ b/src/api/types/UpdateTransferOrderLineData.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a line item update in a transfer order + */ +export interface UpdateTransferOrderLineData { + /** Line item id being updated. Required for updating/removing existing line items, but should not be set for new line items. */ + uid?: string | null; + /** + * Catalog item variation being transferred + * + * Required for new line items, but otherwise is not updatable. + */ + itemVariationId?: string | null; + /** Total quantity ordered */ + quantityOrdered?: string | null; + /** Flag to remove the line item during update. Must include `uid` in removal request */ + remove?: boolean | null; +} diff --git a/src/api/types/UpdateTransferOrderResponse.ts b/src/api/types/UpdateTransferOrderResponse.ts new file mode 100644 index 000000000..d83cdba68 --- /dev/null +++ b/src/api/types/UpdateTransferOrderResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response for updating a transfer order + */ +export interface UpdateTransferOrderResponse { + /** The updated transfer order */ + transferOrder?: Square.TransferOrder; + /** Any errors that occurred during the request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 58eb9f815..a6114f07f 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -82,6 +82,8 @@ export * from "./BulkDeleteOrderCustomAttributesResponse"; export * from "./BulkPublishScheduledShiftsData"; export * from "./BulkPublishScheduledShiftsResponse"; export * from "./BulkRetrieveBookingsResponse"; +export * from "./BulkRetrieveChannelsRequestConstants"; +export * from "./BulkRetrieveChannelsResponse"; export * from "./BulkRetrieveCustomersResponse"; export * from "./BulkRetrieveTeamMemberBookingProfilesResponse"; export * from "./BatchGetVendorsResponse"; @@ -124,6 +126,7 @@ export * from "./CancelSubscriptionResponse"; export * from "./CancelTerminalActionResponse"; export * from "./CancelTerminalCheckoutResponse"; export * from "./CancelTerminalRefundResponse"; +export * from "./CancelTransferOrderResponse"; export * from "./CaptureTransactionResponse"; export * from "./Card"; export * from "./CardAutomaticallyUpdatedEvent"; @@ -234,6 +237,8 @@ export * from "./CatalogVersionUpdatedEventObject"; export * from "./CategoryPathToRootNode"; export * from "./ChangeBillingAnchorDateResponse"; export * from "./ChangeTiming"; +export * from "./Channel"; +export * from "./ChannelStatus"; export * from "./ChargeRequestAdditionalRecipient"; export * from "./Checkout"; export * from "./CheckoutLocationSettings"; @@ -302,6 +307,9 @@ export * from "./CreateTerminalActionResponse"; export * from "./CreateTerminalCheckoutResponse"; export * from "./CreateTerminalRefundResponse"; export * from "./CreateTimecardResponse"; +export * from "./CreateTransferOrderData"; +export * from "./CreateTransferOrderLineData"; +export * from "./CreateTransferOrderResponse"; export * from "./CreateVendorResponse"; export * from "./CreateWebhookSubscriptionResponse"; export * from "./Currency"; @@ -393,6 +401,7 @@ export * from "./DeleteShiftResponse"; export * from "./DeleteSnippetResponse"; export * from "./DeleteSubscriptionActionResponse"; export * from "./DeleteTimecardResponse"; +export * from "./DeleteTransferOrderResponse"; export * from "./DeleteWebhookSubscriptionResponse"; export * from "./Destination"; export * from "./DestinationDetails"; @@ -647,6 +656,8 @@ export * from "./ListCardsResponse"; export * from "./ListCashDrawerShiftEventsResponse"; export * from "./ListCashDrawerShiftsResponse"; export * from "./ListCatalogResponse"; +export * from "./ListChannelsRequestConstants"; +export * from "./ListChannelsResponse"; export * from "./ListCustomerCustomAttributeDefinitionsResponse"; export * from "./ListCustomerCustomAttributesResponse"; export * from "./ListCustomerGroupsResponse"; @@ -943,7 +954,10 @@ export * from "./QrCodeOptions"; export * from "./QuickPay"; export * from "./Range"; export * from "./ReceiptOptions"; +export * from "./ReceiveTransferOrderResponse"; export * from "./RedeemLoyaltyRewardResponse"; +export * from "./Reference"; +export * from "./ReferenceType"; export * from "./Refund"; export * from "./RefundCreatedEvent"; export * from "./RefundCreatedEventData"; @@ -964,6 +978,7 @@ export * from "./GetBusinessBookingProfileResponse"; export * from "./GetCardResponse"; export * from "./GetCashDrawerShiftResponse"; export * from "./GetCatalogObjectResponse"; +export * from "./RetrieveChannelResponse"; export * from "./GetCustomerCustomAttributeDefinitionResponse"; export * from "./GetCustomerCustomAttributeResponse"; export * from "./GetCustomerGroupResponse"; @@ -1006,6 +1021,7 @@ export * from "./GetTeamMemberResponse"; export * from "./RetrieveTimecardResponse"; export * from "./RetrieveTokenStatusResponse"; export * from "./GetTransactionResponse"; +export * from "./RetrieveTransferOrderResponse"; export * from "./GetVendorResponse"; export * from "./GetWageSettingResponse"; export * from "./GetWebhookSubscriptionResponse"; @@ -1064,6 +1080,7 @@ export * from "./SearchTerminalActionsResponse"; export * from "./SearchTerminalCheckoutsResponse"; export * from "./SearchTerminalRefundsResponse"; export * from "./SearchTimecardsResponse"; +export * from "./SearchTransferOrdersResponse"; export * from "./SearchVendorsRequestFilter"; export * from "./SearchVendorsRequestSort"; export * from "./SearchVendorsRequestSortField"; @@ -1091,6 +1108,7 @@ export * from "./SourceApplication"; export * from "./SquareAccountDetails"; export * from "./StandardUnitDescription"; export * from "./StandardUnitDescriptionGroup"; +export * from "./StartTransferOrderResponse"; export * from "./SubmitEvidenceResponse"; export * from "./Subscription"; export * from "./SubscriptionAction"; @@ -1192,6 +1210,23 @@ export * from "./TipSettings"; export * from "./Transaction"; export * from "./TransactionProduct"; export * from "./TransactionType"; +export * from "./TransferOrder"; +export * from "./TransferOrderCreatedEvent"; +export * from "./TransferOrderCreatedEventData"; +export * from "./TransferOrderCreatedEventObject"; +export * from "./TransferOrderDeletedEvent"; +export * from "./TransferOrderDeletedEventData"; +export * from "./TransferOrderFilter"; +export * from "./TransferOrderGoodsReceipt"; +export * from "./TransferOrderGoodsReceiptLineItem"; +export * from "./TransferOrderLine"; +export * from "./TransferOrderQuery"; +export * from "./TransferOrderSort"; +export * from "./TransferOrderSortField"; +export * from "./TransferOrderStatus"; +export * from "./TransferOrderUpdatedEvent"; +export * from "./TransferOrderUpdatedEventData"; +export * from "./TransferOrderUpdatedEventObject"; export * from "./UnlinkCustomerFromGiftCardResponse"; export * from "./UpdateBookingCustomAttributeDefinitionResponse"; export * from "./UpdateBookingResponse"; @@ -1220,6 +1255,9 @@ export * from "./UpdateSubscriptionResponse"; export * from "./UpdateTeamMemberRequest"; export * from "./UpdateTeamMemberResponse"; export * from "./UpdateTimecardResponse"; +export * from "./UpdateTransferOrderData"; +export * from "./UpdateTransferOrderLineData"; +export * from "./UpdateTransferOrderResponse"; export * from "./UpdateVendorRequest"; export * from "./UpdateVendorResponse"; export * from "./UpdateWageSettingResponse"; diff --git a/src/serialization/resources/channels/client/index.ts b/src/serialization/resources/channels/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/channels/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/channels/client/requests/BulkRetrieveChannelsRequest.ts b/src/serialization/resources/channels/client/requests/BulkRetrieveChannelsRequest.ts new file mode 100644 index 000000000..1d6074e88 --- /dev/null +++ b/src/serialization/resources/channels/client/requests/BulkRetrieveChannelsRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BulkRetrieveChannelsRequest: core.serialization.Schema< + serializers.BulkRetrieveChannelsRequest.Raw, + Square.BulkRetrieveChannelsRequest +> = core.serialization.object({ + channelIds: core.serialization.property("channel_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace BulkRetrieveChannelsRequest { + export interface Raw { + channel_ids: string[]; + } +} diff --git a/src/serialization/resources/channels/client/requests/index.ts b/src/serialization/resources/channels/client/requests/index.ts new file mode 100644 index 000000000..1b0856e98 --- /dev/null +++ b/src/serialization/resources/channels/client/requests/index.ts @@ -0,0 +1 @@ +export { BulkRetrieveChannelsRequest } from "./BulkRetrieveChannelsRequest"; diff --git a/src/serialization/resources/channels/index.ts b/src/serialization/resources/channels/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/channels/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index 4ac63f244..51fc24220 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -12,6 +12,8 @@ export * as cards from "./cards"; export * from "./cards/client/requests"; export * as catalog from "./catalog"; export * from "./catalog/client/requests"; +export * as channels from "./channels"; +export * from "./channels/client/requests"; export * as customers from "./customers"; export * from "./customers/client/requests"; export * as disputes from "./disputes"; @@ -44,6 +46,8 @@ export * as teamMembers from "./teamMembers"; export * from "./teamMembers/client/requests"; export * as team from "./team"; export * from "./team/client/requests"; +export * as transferOrders from "./transferOrders"; +export * from "./transferOrders/client/requests"; export * as vendors from "./vendors"; export * from "./vendors/client/requests"; export * as devices from "./devices"; diff --git a/src/serialization/resources/transferOrders/client/index.ts b/src/serialization/resources/transferOrders/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/transferOrders/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/transferOrders/client/requests/CancelTransferOrderRequest.ts b/src/serialization/resources/transferOrders/client/requests/CancelTransferOrderRequest.ts new file mode 100644 index 000000000..1642cb61d --- /dev/null +++ b/src/serialization/resources/transferOrders/client/requests/CancelTransferOrderRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CancelTransferOrderRequest: core.serialization.Schema< + serializers.CancelTransferOrderRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + version: core.serialization.bigint().optional(), +}); + +export declare namespace CancelTransferOrderRequest { + export interface Raw { + idempotency_key: string; + version?: (bigint | number) | null; + } +} diff --git a/src/serialization/resources/transferOrders/client/requests/CreateTransferOrderRequest.ts b/src/serialization/resources/transferOrders/client/requests/CreateTransferOrderRequest.ts new file mode 100644 index 000000000..29f8ae59d --- /dev/null +++ b/src/serialization/resources/transferOrders/client/requests/CreateTransferOrderRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CreateTransferOrderData } from "../../../../types/CreateTransferOrderData"; + +export const CreateTransferOrderRequest: core.serialization.Schema< + serializers.CreateTransferOrderRequest.Raw, + Square.CreateTransferOrderRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + transferOrder: core.serialization.property("transfer_order", CreateTransferOrderData), +}); + +export declare namespace CreateTransferOrderRequest { + export interface Raw { + idempotency_key: string; + transfer_order: CreateTransferOrderData.Raw; + } +} diff --git a/src/serialization/resources/transferOrders/client/requests/ReceiveTransferOrderRequest.ts b/src/serialization/resources/transferOrders/client/requests/ReceiveTransferOrderRequest.ts new file mode 100644 index 000000000..8c52fdd2b --- /dev/null +++ b/src/serialization/resources/transferOrders/client/requests/ReceiveTransferOrderRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { TransferOrderGoodsReceipt } from "../../../../types/TransferOrderGoodsReceipt"; + +export const ReceiveTransferOrderRequest: core.serialization.Schema< + serializers.ReceiveTransferOrderRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + receipt: TransferOrderGoodsReceipt, + version: core.serialization.bigint().optional(), +}); + +export declare namespace ReceiveTransferOrderRequest { + export interface Raw { + idempotency_key: string; + receipt: TransferOrderGoodsReceipt.Raw; + version?: (bigint | number) | null; + } +} diff --git a/src/serialization/resources/transferOrders/client/requests/SearchTransferOrdersRequest.ts b/src/serialization/resources/transferOrders/client/requests/SearchTransferOrdersRequest.ts new file mode 100644 index 000000000..3e933e01b --- /dev/null +++ b/src/serialization/resources/transferOrders/client/requests/SearchTransferOrdersRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { TransferOrderQuery } from "../../../../types/TransferOrderQuery"; + +export const SearchTransferOrdersRequest: core.serialization.Schema< + serializers.SearchTransferOrdersRequest.Raw, + Square.SearchTransferOrdersRequest +> = core.serialization.object({ + query: TransferOrderQuery.optional(), + cursor: core.serialization.string().optional(), + limit: core.serialization.number().optional(), +}); + +export declare namespace SearchTransferOrdersRequest { + export interface Raw { + query?: TransferOrderQuery.Raw | null; + cursor?: string | null; + limit?: number | null; + } +} diff --git a/src/serialization/resources/transferOrders/client/requests/StartTransferOrderRequest.ts b/src/serialization/resources/transferOrders/client/requests/StartTransferOrderRequest.ts new file mode 100644 index 000000000..f3b558d7c --- /dev/null +++ b/src/serialization/resources/transferOrders/client/requests/StartTransferOrderRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const StartTransferOrderRequest: core.serialization.Schema< + serializers.StartTransferOrderRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + version: core.serialization.bigint().optional(), +}); + +export declare namespace StartTransferOrderRequest { + export interface Raw { + idempotency_key: string; + version?: (bigint | number) | null; + } +} diff --git a/src/serialization/resources/transferOrders/client/requests/UpdateTransferOrderRequest.ts b/src/serialization/resources/transferOrders/client/requests/UpdateTransferOrderRequest.ts new file mode 100644 index 000000000..f6d398ecd --- /dev/null +++ b/src/serialization/resources/transferOrders/client/requests/UpdateTransferOrderRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { UpdateTransferOrderData } from "../../../../types/UpdateTransferOrderData"; + +export const UpdateTransferOrderRequest: core.serialization.Schema< + serializers.UpdateTransferOrderRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + transferOrder: core.serialization.property("transfer_order", UpdateTransferOrderData), + version: core.serialization.bigint().optional(), +}); + +export declare namespace UpdateTransferOrderRequest { + export interface Raw { + idempotency_key: string; + transfer_order: UpdateTransferOrderData.Raw; + version?: (bigint | number) | null; + } +} diff --git a/src/serialization/resources/transferOrders/client/requests/index.ts b/src/serialization/resources/transferOrders/client/requests/index.ts new file mode 100644 index 000000000..8c4b45ffa --- /dev/null +++ b/src/serialization/resources/transferOrders/client/requests/index.ts @@ -0,0 +1,6 @@ +export { CreateTransferOrderRequest } from "./CreateTransferOrderRequest"; +export { SearchTransferOrdersRequest } from "./SearchTransferOrdersRequest"; +export { UpdateTransferOrderRequest } from "./UpdateTransferOrderRequest"; +export { CancelTransferOrderRequest } from "./CancelTransferOrderRequest"; +export { ReceiveTransferOrderRequest } from "./ReceiveTransferOrderRequest"; +export { StartTransferOrderRequest } from "./StartTransferOrderRequest"; diff --git a/src/serialization/resources/transferOrders/index.ts b/src/serialization/resources/transferOrders/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/transferOrders/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/types/BulkRetrieveChannelsRequestConstants.ts b/src/serialization/types/BulkRetrieveChannelsRequestConstants.ts new file mode 100644 index 000000000..1e8ea7bcc --- /dev/null +++ b/src/serialization/types/BulkRetrieveChannelsRequestConstants.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BulkRetrieveChannelsRequestConstants: core.serialization.Schema< + serializers.BulkRetrieveChannelsRequestConstants.Raw, + Square.BulkRetrieveChannelsRequestConstants +> = core.serialization.stringLiteral("MAX_BATCH_SIZE"); + +export declare namespace BulkRetrieveChannelsRequestConstants { + export type Raw = "MAX_BATCH_SIZE"; +} diff --git a/src/serialization/types/BulkRetrieveChannelsResponse.ts b/src/serialization/types/BulkRetrieveChannelsResponse.ts new file mode 100644 index 000000000..a9f30befa --- /dev/null +++ b/src/serialization/types/BulkRetrieveChannelsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { RetrieveChannelResponse } from "./RetrieveChannelResponse"; + +export const BulkRetrieveChannelsResponse: core.serialization.ObjectSchema< + serializers.BulkRetrieveChannelsResponse.Raw, + Square.BulkRetrieveChannelsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + responses: core.serialization.record(core.serialization.string(), RetrieveChannelResponse).optional(), +}); + +export declare namespace BulkRetrieveChannelsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + responses?: Record | null; + } +} diff --git a/src/serialization/types/CancelTransferOrderResponse.ts b/src/serialization/types/CancelTransferOrderResponse.ts new file mode 100644 index 000000000..e125ad7a1 --- /dev/null +++ b/src/serialization/types/CancelTransferOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; +import { Error_ } from "./Error_"; + +export const CancelTransferOrderResponse: core.serialization.ObjectSchema< + serializers.CancelTransferOrderResponse.Raw, + Square.CancelTransferOrderResponse +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CancelTransferOrderResponse { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/Channel.ts b/src/serialization/types/Channel.ts new file mode 100644 index 000000000..d4d8dd500 --- /dev/null +++ b/src/serialization/types/Channel.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Reference } from "./Reference"; +import { ChannelStatus } from "./ChannelStatus"; + +export const Channel: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + merchantId: core.serialization.property("merchant_id", core.serialization.string().optional()), + name: core.serialization.string().optionalNullable(), + version: core.serialization.number().optional(), + reference: Reference.optional(), + status: ChannelStatus.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace Channel { + export interface Raw { + id?: string | null; + merchant_id?: string | null; + name?: (string | null) | null; + version?: number | null; + reference?: Reference.Raw | null; + status?: ChannelStatus.Raw | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/ChannelStatus.ts b/src/serialization/types/ChannelStatus.ts new file mode 100644 index 000000000..18bb0c931 --- /dev/null +++ b/src/serialization/types/ChannelStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ChannelStatus: core.serialization.Schema = + core.serialization.enum_(["ACTIVE", "INACTIVE"]); + +export declare namespace ChannelStatus { + export type Raw = "ACTIVE" | "INACTIVE"; +} diff --git a/src/serialization/types/CreateTransferOrderData.ts b/src/serialization/types/CreateTransferOrderData.ts new file mode 100644 index 000000000..d87af9b3d --- /dev/null +++ b/src/serialization/types/CreateTransferOrderData.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CreateTransferOrderLineData } from "./CreateTransferOrderLineData"; + +export const CreateTransferOrderData: core.serialization.ObjectSchema< + serializers.CreateTransferOrderData.Raw, + Square.CreateTransferOrderData +> = core.serialization.object({ + sourceLocationId: core.serialization.property("source_location_id", core.serialization.string()), + destinationLocationId: core.serialization.property("destination_location_id", core.serialization.string()), + expectedAt: core.serialization.property("expected_at", core.serialization.string().optionalNullable()), + notes: core.serialization.string().optionalNullable(), + trackingNumber: core.serialization.property("tracking_number", core.serialization.string().optionalNullable()), + createdByTeamMemberId: core.serialization.property( + "created_by_team_member_id", + core.serialization.string().optionalNullable(), + ), + lineItems: core.serialization.property( + "line_items", + core.serialization.list(CreateTransferOrderLineData).optionalNullable(), + ), +}); + +export declare namespace CreateTransferOrderData { + export interface Raw { + source_location_id: string; + destination_location_id: string; + expected_at?: (string | null) | null; + notes?: (string | null) | null; + tracking_number?: (string | null) | null; + created_by_team_member_id?: (string | null) | null; + line_items?: (CreateTransferOrderLineData.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CreateTransferOrderLineData.ts b/src/serialization/types/CreateTransferOrderLineData.ts new file mode 100644 index 000000000..5819787be --- /dev/null +++ b/src/serialization/types/CreateTransferOrderLineData.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CreateTransferOrderLineData: core.serialization.ObjectSchema< + serializers.CreateTransferOrderLineData.Raw, + Square.CreateTransferOrderLineData +> = core.serialization.object({ + itemVariationId: core.serialization.property("item_variation_id", core.serialization.string()), + quantityOrdered: core.serialization.property("quantity_ordered", core.serialization.string()), +}); + +export declare namespace CreateTransferOrderLineData { + export interface Raw { + item_variation_id: string; + quantity_ordered: string; + } +} diff --git a/src/serialization/types/CreateTransferOrderResponse.ts b/src/serialization/types/CreateTransferOrderResponse.ts new file mode 100644 index 000000000..f6e02796d --- /dev/null +++ b/src/serialization/types/CreateTransferOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; +import { Error_ } from "./Error_"; + +export const CreateTransferOrderResponse: core.serialization.ObjectSchema< + serializers.CreateTransferOrderResponse.Raw, + Square.CreateTransferOrderResponse +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateTransferOrderResponse { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CustomAttribute.ts b/src/serialization/types/CustomAttribute.ts index 7456f606c..2f671981f 100644 --- a/src/serialization/types/CustomAttribute.ts +++ b/src/serialization/types/CustomAttribute.ts @@ -11,7 +11,7 @@ import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; export const CustomAttribute: core.serialization.ObjectSchema = core.serialization.object({ key: core.serialization.string().optionalNullable(), - value: core.serialization.unknown().optional(), + value: core.serialization.unknown().optionalNullable(), version: core.serialization.number().optional(), visibility: CustomAttributeDefinitionVisibility.optional(), definition: CustomAttributeDefinition.optional(), @@ -22,7 +22,7 @@ export const CustomAttribute: core.serialization.ObjectSchema = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteTransferOrderResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListChannelsRequestConstants.ts b/src/serialization/types/ListChannelsRequestConstants.ts new file mode 100644 index 000000000..492bd7fef --- /dev/null +++ b/src/serialization/types/ListChannelsRequestConstants.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ListChannelsRequestConstants: core.serialization.Schema< + serializers.ListChannelsRequestConstants.Raw, + Square.ListChannelsRequestConstants +> = core.serialization.stringLiteral("MAX_PAGE_SIZE"); + +export declare namespace ListChannelsRequestConstants { + export type Raw = "MAX_PAGE_SIZE"; +} diff --git a/src/serialization/types/ListChannelsResponse.ts b/src/serialization/types/ListChannelsResponse.ts new file mode 100644 index 000000000..d7d109dd8 --- /dev/null +++ b/src/serialization/types/ListChannelsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Channel } from "./Channel"; + +export const ListChannelsResponse: core.serialization.ObjectSchema< + serializers.ListChannelsResponse.Raw, + Square.ListChannelsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + channels: core.serialization.list(Channel).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListChannelsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + channels?: Channel.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ReceiveTransferOrderResponse.ts b/src/serialization/types/ReceiveTransferOrderResponse.ts new file mode 100644 index 000000000..90d2ecbbe --- /dev/null +++ b/src/serialization/types/ReceiveTransferOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; +import { Error_ } from "./Error_"; + +export const ReceiveTransferOrderResponse: core.serialization.ObjectSchema< + serializers.ReceiveTransferOrderResponse.Raw, + Square.ReceiveTransferOrderResponse +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ReceiveTransferOrderResponse { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/Reference.ts b/src/serialization/types/Reference.ts new file mode 100644 index 000000000..d3c83c1eb --- /dev/null +++ b/src/serialization/types/Reference.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ReferenceType } from "./ReferenceType"; + +export const Reference: core.serialization.ObjectSchema = + core.serialization.object({ + type: ReferenceType.optional(), + id: core.serialization.string().optional(), + }); + +export declare namespace Reference { + export interface Raw { + type?: ReferenceType.Raw | null; + id?: string | null; + } +} diff --git a/src/serialization/types/ReferenceType.ts b/src/serialization/types/ReferenceType.ts new file mode 100644 index 000000000..1de4d0d77 --- /dev/null +++ b/src/serialization/types/ReferenceType.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ReferenceType: core.serialization.Schema = + core.serialization.enum_([ + "UNKNOWN_TYPE", + "LOCATION", + "FIRST_PARTY_INTEGRATION", + "OAUTH_APPLICATION", + "ONLINE_SITE", + "ONLINE_CHECKOUT", + "INVOICE", + "GIFT_CARD", + "GIFT_CARD_MARKETPLACE", + "RECURRING_SUBSCRIPTION", + "ONLINE_BOOKING_FLOW", + "SQUARE_ASSISTANT", + "CASH_LOCAL", + "POINT_OF_SALE", + "KIOSK", + ]); + +export declare namespace ReferenceType { + export type Raw = + | "UNKNOWN_TYPE" + | "LOCATION" + | "FIRST_PARTY_INTEGRATION" + | "OAUTH_APPLICATION" + | "ONLINE_SITE" + | "ONLINE_CHECKOUT" + | "INVOICE" + | "GIFT_CARD" + | "GIFT_CARD_MARKETPLACE" + | "RECURRING_SUBSCRIPTION" + | "ONLINE_BOOKING_FLOW" + | "SQUARE_ASSISTANT" + | "CASH_LOCAL" + | "POINT_OF_SALE" + | "KIOSK"; +} diff --git a/src/serialization/types/RetrieveChannelResponse.ts b/src/serialization/types/RetrieveChannelResponse.ts new file mode 100644 index 000000000..0bb1147f0 --- /dev/null +++ b/src/serialization/types/RetrieveChannelResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Channel } from "./Channel"; + +export const RetrieveChannelResponse: core.serialization.ObjectSchema< + serializers.RetrieveChannelResponse.Raw, + Square.RetrieveChannelResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + channel: Channel.optional(), +}); + +export declare namespace RetrieveChannelResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + channel?: Channel.Raw | null; + } +} diff --git a/src/serialization/types/RetrieveTransferOrderResponse.ts b/src/serialization/types/RetrieveTransferOrderResponse.ts new file mode 100644 index 000000000..b0cf1a404 --- /dev/null +++ b/src/serialization/types/RetrieveTransferOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; +import { Error_ } from "./Error_"; + +export const RetrieveTransferOrderResponse: core.serialization.ObjectSchema< + serializers.RetrieveTransferOrderResponse.Raw, + Square.RetrieveTransferOrderResponse +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveTransferOrderResponse { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/SearchTransferOrdersResponse.ts b/src/serialization/types/SearchTransferOrdersResponse.ts new file mode 100644 index 000000000..36fd4ef47 --- /dev/null +++ b/src/serialization/types/SearchTransferOrdersResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; +import { Error_ } from "./Error_"; + +export const SearchTransferOrdersResponse: core.serialization.ObjectSchema< + serializers.SearchTransferOrdersResponse.Raw, + Square.SearchTransferOrdersResponse +> = core.serialization.object({ + transferOrders: core.serialization.property("transfer_orders", core.serialization.list(TransferOrder).optional()), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace SearchTransferOrdersResponse { + export interface Raw { + transfer_orders?: TransferOrder.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/StartTransferOrderResponse.ts b/src/serialization/types/StartTransferOrderResponse.ts new file mode 100644 index 000000000..08684f95e --- /dev/null +++ b/src/serialization/types/StartTransferOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; +import { Error_ } from "./Error_"; + +export const StartTransferOrderResponse: core.serialization.ObjectSchema< + serializers.StartTransferOrderResponse.Raw, + Square.StartTransferOrderResponse +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace StartTransferOrderResponse { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/TransferOrder.ts b/src/serialization/types/TransferOrder.ts new file mode 100644 index 000000000..c7e4695ce --- /dev/null +++ b/src/serialization/types/TransferOrder.ts @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderStatus } from "./TransferOrderStatus"; +import { TransferOrderLine } from "./TransferOrderLine"; + +export const TransferOrder: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + sourceLocationId: core.serialization.property( + "source_location_id", + core.serialization.string().optionalNullable(), + ), + destinationLocationId: core.serialization.property( + "destination_location_id", + core.serialization.string().optionalNullable(), + ), + status: TransferOrderStatus.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + expectedAt: core.serialization.property("expected_at", core.serialization.string().optionalNullable()), + completedAt: core.serialization.property("completed_at", core.serialization.string().optional()), + notes: core.serialization.string().optionalNullable(), + trackingNumber: core.serialization.property("tracking_number", core.serialization.string().optionalNullable()), + createdByTeamMemberId: core.serialization.property( + "created_by_team_member_id", + core.serialization.string().optional(), + ), + lineItems: core.serialization.property( + "line_items", + core.serialization.list(TransferOrderLine).optionalNullable(), + ), + version: core.serialization.bigint().optional(), + }); + +export declare namespace TransferOrder { + export interface Raw { + id?: string | null; + source_location_id?: (string | null) | null; + destination_location_id?: (string | null) | null; + status?: TransferOrderStatus.Raw | null; + created_at?: string | null; + updated_at?: string | null; + expected_at?: (string | null) | null; + completed_at?: string | null; + notes?: (string | null) | null; + tracking_number?: (string | null) | null; + created_by_team_member_id?: string | null; + line_items?: (TransferOrderLine.Raw[] | null) | null; + version?: (bigint | number) | null; + } +} diff --git a/src/serialization/types/TransferOrderCreatedEvent.ts b/src/serialization/types/TransferOrderCreatedEvent.ts new file mode 100644 index 000000000..e37d7bc2c --- /dev/null +++ b/src/serialization/types/TransferOrderCreatedEvent.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderCreatedEventData } from "./TransferOrderCreatedEventData"; + +export const TransferOrderCreatedEvent: core.serialization.ObjectSchema< + serializers.TransferOrderCreatedEvent.Raw, + Square.TransferOrderCreatedEvent +> = 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: TransferOrderCreatedEventData.optional(), +}); + +export declare namespace TransferOrderCreatedEvent { + export interface Raw { + merchant_id?: (string | null) | null; + type?: (string | null) | null; + event_id?: (string | null) | null; + created_at?: string | null; + data?: TransferOrderCreatedEventData.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderCreatedEventData.ts b/src/serialization/types/TransferOrderCreatedEventData.ts new file mode 100644 index 000000000..78735aab8 --- /dev/null +++ b/src/serialization/types/TransferOrderCreatedEventData.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderCreatedEventObject } from "./TransferOrderCreatedEventObject"; + +export const TransferOrderCreatedEventData: core.serialization.ObjectSchema< + serializers.TransferOrderCreatedEventData.Raw, + Square.TransferOrderCreatedEventData +> = core.serialization.object({ + type: core.serialization.string().optionalNullable(), + id: core.serialization.string().optional(), + object: TransferOrderCreatedEventObject.optional(), +}); + +export declare namespace TransferOrderCreatedEventData { + export interface Raw { + type?: (string | null) | null; + id?: string | null; + object?: TransferOrderCreatedEventObject.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderCreatedEventObject.ts b/src/serialization/types/TransferOrderCreatedEventObject.ts new file mode 100644 index 000000000..d7ccd88cc --- /dev/null +++ b/src/serialization/types/TransferOrderCreatedEventObject.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; + +export const TransferOrderCreatedEventObject: core.serialization.ObjectSchema< + serializers.TransferOrderCreatedEventObject.Raw, + Square.TransferOrderCreatedEventObject +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), +}); + +export declare namespace TransferOrderCreatedEventObject { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderDeletedEvent.ts b/src/serialization/types/TransferOrderDeletedEvent.ts new file mode 100644 index 000000000..3f4e2e1fd --- /dev/null +++ b/src/serialization/types/TransferOrderDeletedEvent.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderDeletedEventData } from "./TransferOrderDeletedEventData"; + +export const TransferOrderDeletedEvent: core.serialization.ObjectSchema< + serializers.TransferOrderDeletedEvent.Raw, + Square.TransferOrderDeletedEvent +> = 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: TransferOrderDeletedEventData.optional(), +}); + +export declare namespace TransferOrderDeletedEvent { + export interface Raw { + merchant_id?: (string | null) | null; + type?: (string | null) | null; + event_id?: (string | null) | null; + created_at?: string | null; + data?: TransferOrderDeletedEventData.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderDeletedEventData.ts b/src/serialization/types/TransferOrderDeletedEventData.ts new file mode 100644 index 000000000..4038ef66a --- /dev/null +++ b/src/serialization/types/TransferOrderDeletedEventData.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TransferOrderDeletedEventData: core.serialization.ObjectSchema< + serializers.TransferOrderDeletedEventData.Raw, + Square.TransferOrderDeletedEventData +> = core.serialization.object({ + type: core.serialization.string().optionalNullable(), + id: core.serialization.string().optional(), + deleted: core.serialization.boolean().optionalNullable(), +}); + +export declare namespace TransferOrderDeletedEventData { + export interface Raw { + type?: (string | null) | null; + id?: string | null; + deleted?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/TransferOrderFilter.ts b/src/serialization/types/TransferOrderFilter.ts new file mode 100644 index 000000000..273868b1c --- /dev/null +++ b/src/serialization/types/TransferOrderFilter.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderStatus } from "./TransferOrderStatus"; + +export const TransferOrderFilter: core.serialization.ObjectSchema< + serializers.TransferOrderFilter.Raw, + Square.TransferOrderFilter +> = core.serialization.object({ + sourceLocationIds: core.serialization.property( + "source_location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + destinationLocationIds: core.serialization.property( + "destination_location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + statuses: core.serialization.list(TransferOrderStatus).optionalNullable(), +}); + +export declare namespace TransferOrderFilter { + export interface Raw { + source_location_ids?: (string[] | null) | null; + destination_location_ids?: (string[] | null) | null; + statuses?: (TransferOrderStatus.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/TransferOrderGoodsReceipt.ts b/src/serialization/types/TransferOrderGoodsReceipt.ts new file mode 100644 index 000000000..78e135007 --- /dev/null +++ b/src/serialization/types/TransferOrderGoodsReceipt.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderGoodsReceiptLineItem } from "./TransferOrderGoodsReceiptLineItem"; + +export const TransferOrderGoodsReceipt: core.serialization.ObjectSchema< + serializers.TransferOrderGoodsReceipt.Raw, + Square.TransferOrderGoodsReceipt +> = core.serialization.object({ + lineItems: core.serialization.property( + "line_items", + core.serialization.list(TransferOrderGoodsReceiptLineItem).optionalNullable(), + ), +}); + +export declare namespace TransferOrderGoodsReceipt { + export interface Raw { + line_items?: (TransferOrderGoodsReceiptLineItem.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/TransferOrderGoodsReceiptLineItem.ts b/src/serialization/types/TransferOrderGoodsReceiptLineItem.ts new file mode 100644 index 000000000..14986d4c6 --- /dev/null +++ b/src/serialization/types/TransferOrderGoodsReceiptLineItem.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TransferOrderGoodsReceiptLineItem: core.serialization.ObjectSchema< + serializers.TransferOrderGoodsReceiptLineItem.Raw, + Square.TransferOrderGoodsReceiptLineItem +> = core.serialization.object({ + transferOrderLineUid: core.serialization.property("transfer_order_line_uid", core.serialization.string()), + quantityReceived: core.serialization.property("quantity_received", core.serialization.string().optionalNullable()), + quantityDamaged: core.serialization.property("quantity_damaged", core.serialization.string().optionalNullable()), + quantityCanceled: core.serialization.property("quantity_canceled", core.serialization.string().optionalNullable()), +}); + +export declare namespace TransferOrderGoodsReceiptLineItem { + export interface Raw { + transfer_order_line_uid: string; + quantity_received?: (string | null) | null; + quantity_damaged?: (string | null) | null; + quantity_canceled?: (string | null) | null; + } +} diff --git a/src/serialization/types/TransferOrderLine.ts b/src/serialization/types/TransferOrderLine.ts new file mode 100644 index 000000000..643b5bf32 --- /dev/null +++ b/src/serialization/types/TransferOrderLine.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TransferOrderLine: core.serialization.ObjectSchema< + serializers.TransferOrderLine.Raw, + Square.TransferOrderLine +> = core.serialization.object({ + uid: core.serialization.string().optional(), + itemVariationId: core.serialization.property("item_variation_id", core.serialization.string()), + quantityOrdered: core.serialization.property("quantity_ordered", core.serialization.string()), + quantityPending: core.serialization.property("quantity_pending", core.serialization.string().optional()), + quantityReceived: core.serialization.property("quantity_received", core.serialization.string().optional()), + quantityDamaged: core.serialization.property("quantity_damaged", core.serialization.string().optional()), + quantityCanceled: core.serialization.property("quantity_canceled", core.serialization.string().optional()), +}); + +export declare namespace TransferOrderLine { + export interface Raw { + uid?: string | null; + item_variation_id: string; + quantity_ordered: string; + quantity_pending?: string | null; + quantity_received?: string | null; + quantity_damaged?: string | null; + quantity_canceled?: string | null; + } +} diff --git a/src/serialization/types/TransferOrderQuery.ts b/src/serialization/types/TransferOrderQuery.ts new file mode 100644 index 000000000..993afd79f --- /dev/null +++ b/src/serialization/types/TransferOrderQuery.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderFilter } from "./TransferOrderFilter"; +import { TransferOrderSort } from "./TransferOrderSort"; + +export const TransferOrderQuery: core.serialization.ObjectSchema< + serializers.TransferOrderQuery.Raw, + Square.TransferOrderQuery +> = core.serialization.object({ + filter: TransferOrderFilter.optional(), + sort: TransferOrderSort.optional(), +}); + +export declare namespace TransferOrderQuery { + export interface Raw { + filter?: TransferOrderFilter.Raw | null; + sort?: TransferOrderSort.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderSort.ts b/src/serialization/types/TransferOrderSort.ts new file mode 100644 index 000000000..c0363d253 --- /dev/null +++ b/src/serialization/types/TransferOrderSort.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderSortField } from "./TransferOrderSortField"; +import { SortOrder } from "./SortOrder"; + +export const TransferOrderSort: core.serialization.ObjectSchema< + serializers.TransferOrderSort.Raw, + Square.TransferOrderSort +> = core.serialization.object({ + field: TransferOrderSortField.optional(), + order: SortOrder.optional(), +}); + +export declare namespace TransferOrderSort { + export interface Raw { + field?: TransferOrderSortField.Raw | null; + order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderSortField.ts b/src/serialization/types/TransferOrderSortField.ts new file mode 100644 index 000000000..d84b34f95 --- /dev/null +++ b/src/serialization/types/TransferOrderSortField.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TransferOrderSortField: core.serialization.Schema< + serializers.TransferOrderSortField.Raw, + Square.TransferOrderSortField +> = core.serialization.enum_(["CREATED_AT", "UPDATED_AT"]); + +export declare namespace TransferOrderSortField { + export type Raw = "CREATED_AT" | "UPDATED_AT"; +} diff --git a/src/serialization/types/TransferOrderStatus.ts b/src/serialization/types/TransferOrderStatus.ts new file mode 100644 index 000000000..9efdbeb93 --- /dev/null +++ b/src/serialization/types/TransferOrderStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TransferOrderStatus: core.serialization.Schema< + serializers.TransferOrderStatus.Raw, + Square.TransferOrderStatus +> = core.serialization.enum_(["DRAFT", "STARTED", "PARTIALLY_RECEIVED", "COMPLETED", "CANCELED"]); + +export declare namespace TransferOrderStatus { + export type Raw = "DRAFT" | "STARTED" | "PARTIALLY_RECEIVED" | "COMPLETED" | "CANCELED"; +} diff --git a/src/serialization/types/TransferOrderUpdatedEvent.ts b/src/serialization/types/TransferOrderUpdatedEvent.ts new file mode 100644 index 000000000..956b7eb64 --- /dev/null +++ b/src/serialization/types/TransferOrderUpdatedEvent.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderUpdatedEventData } from "./TransferOrderUpdatedEventData"; + +export const TransferOrderUpdatedEvent: core.serialization.ObjectSchema< + serializers.TransferOrderUpdatedEvent.Raw, + Square.TransferOrderUpdatedEvent +> = 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: TransferOrderUpdatedEventData.optional(), +}); + +export declare namespace TransferOrderUpdatedEvent { + export interface Raw { + merchant_id?: (string | null) | null; + type?: (string | null) | null; + event_id?: (string | null) | null; + created_at?: string | null; + data?: TransferOrderUpdatedEventData.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderUpdatedEventData.ts b/src/serialization/types/TransferOrderUpdatedEventData.ts new file mode 100644 index 000000000..abaa4f737 --- /dev/null +++ b/src/serialization/types/TransferOrderUpdatedEventData.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrderUpdatedEventObject } from "./TransferOrderUpdatedEventObject"; + +export const TransferOrderUpdatedEventData: core.serialization.ObjectSchema< + serializers.TransferOrderUpdatedEventData.Raw, + Square.TransferOrderUpdatedEventData +> = core.serialization.object({ + type: core.serialization.string().optionalNullable(), + id: core.serialization.string().optional(), + object: TransferOrderUpdatedEventObject.optional(), +}); + +export declare namespace TransferOrderUpdatedEventData { + export interface Raw { + type?: (string | null) | null; + id?: string | null; + object?: TransferOrderUpdatedEventObject.Raw | null; + } +} diff --git a/src/serialization/types/TransferOrderUpdatedEventObject.ts b/src/serialization/types/TransferOrderUpdatedEventObject.ts new file mode 100644 index 000000000..000e7a400 --- /dev/null +++ b/src/serialization/types/TransferOrderUpdatedEventObject.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; + +export const TransferOrderUpdatedEventObject: core.serialization.ObjectSchema< + serializers.TransferOrderUpdatedEventObject.Raw, + Square.TransferOrderUpdatedEventObject +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), +}); + +export declare namespace TransferOrderUpdatedEventObject { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + } +} diff --git a/src/serialization/types/UpdateTransferOrderData.ts b/src/serialization/types/UpdateTransferOrderData.ts new file mode 100644 index 000000000..fd59ea68b --- /dev/null +++ b/src/serialization/types/UpdateTransferOrderData.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { UpdateTransferOrderLineData } from "./UpdateTransferOrderLineData"; + +export const UpdateTransferOrderData: core.serialization.ObjectSchema< + serializers.UpdateTransferOrderData.Raw, + Square.UpdateTransferOrderData +> = core.serialization.object({ + sourceLocationId: core.serialization.property("source_location_id", core.serialization.string().optionalNullable()), + destinationLocationId: core.serialization.property( + "destination_location_id", + core.serialization.string().optionalNullable(), + ), + expectedAt: core.serialization.property("expected_at", core.serialization.string().optionalNullable()), + notes: core.serialization.string().optionalNullable(), + trackingNumber: core.serialization.property("tracking_number", core.serialization.string().optionalNullable()), + lineItems: core.serialization.property( + "line_items", + core.serialization.list(UpdateTransferOrderLineData).optionalNullable(), + ), +}); + +export declare namespace UpdateTransferOrderData { + export interface Raw { + source_location_id?: (string | null) | null; + destination_location_id?: (string | null) | null; + expected_at?: (string | null) | null; + notes?: (string | null) | null; + tracking_number?: (string | null) | null; + line_items?: (UpdateTransferOrderLineData.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/UpdateTransferOrderLineData.ts b/src/serialization/types/UpdateTransferOrderLineData.ts new file mode 100644 index 000000000..8d57d4ba3 --- /dev/null +++ b/src/serialization/types/UpdateTransferOrderLineData.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const UpdateTransferOrderLineData: core.serialization.ObjectSchema< + serializers.UpdateTransferOrderLineData.Raw, + Square.UpdateTransferOrderLineData +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + itemVariationId: core.serialization.property("item_variation_id", core.serialization.string().optionalNullable()), + quantityOrdered: core.serialization.property("quantity_ordered", core.serialization.string().optionalNullable()), + remove: core.serialization.boolean().optionalNullable(), +}); + +export declare namespace UpdateTransferOrderLineData { + export interface Raw { + uid?: (string | null) | null; + item_variation_id?: (string | null) | null; + quantity_ordered?: (string | null) | null; + remove?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/UpdateTransferOrderResponse.ts b/src/serialization/types/UpdateTransferOrderResponse.ts new file mode 100644 index 000000000..271ec305a --- /dev/null +++ b/src/serialization/types/UpdateTransferOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TransferOrder } from "./TransferOrder"; +import { Error_ } from "./Error_"; + +export const UpdateTransferOrderResponse: core.serialization.ObjectSchema< + serializers.UpdateTransferOrderResponse.Raw, + Square.UpdateTransferOrderResponse +> = core.serialization.object({ + transferOrder: core.serialization.property("transfer_order", TransferOrder.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateTransferOrderResponse { + export interface Raw { + transfer_order?: TransferOrder.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 58eb9f815..a6114f07f 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -82,6 +82,8 @@ export * from "./BulkDeleteOrderCustomAttributesResponse"; export * from "./BulkPublishScheduledShiftsData"; export * from "./BulkPublishScheduledShiftsResponse"; export * from "./BulkRetrieveBookingsResponse"; +export * from "./BulkRetrieveChannelsRequestConstants"; +export * from "./BulkRetrieveChannelsResponse"; export * from "./BulkRetrieveCustomersResponse"; export * from "./BulkRetrieveTeamMemberBookingProfilesResponse"; export * from "./BatchGetVendorsResponse"; @@ -124,6 +126,7 @@ export * from "./CancelSubscriptionResponse"; export * from "./CancelTerminalActionResponse"; export * from "./CancelTerminalCheckoutResponse"; export * from "./CancelTerminalRefundResponse"; +export * from "./CancelTransferOrderResponse"; export * from "./CaptureTransactionResponse"; export * from "./Card"; export * from "./CardAutomaticallyUpdatedEvent"; @@ -234,6 +237,8 @@ export * from "./CatalogVersionUpdatedEventObject"; export * from "./CategoryPathToRootNode"; export * from "./ChangeBillingAnchorDateResponse"; export * from "./ChangeTiming"; +export * from "./Channel"; +export * from "./ChannelStatus"; export * from "./ChargeRequestAdditionalRecipient"; export * from "./Checkout"; export * from "./CheckoutLocationSettings"; @@ -302,6 +307,9 @@ export * from "./CreateTerminalActionResponse"; export * from "./CreateTerminalCheckoutResponse"; export * from "./CreateTerminalRefundResponse"; export * from "./CreateTimecardResponse"; +export * from "./CreateTransferOrderData"; +export * from "./CreateTransferOrderLineData"; +export * from "./CreateTransferOrderResponse"; export * from "./CreateVendorResponse"; export * from "./CreateWebhookSubscriptionResponse"; export * from "./Currency"; @@ -393,6 +401,7 @@ export * from "./DeleteShiftResponse"; export * from "./DeleteSnippetResponse"; export * from "./DeleteSubscriptionActionResponse"; export * from "./DeleteTimecardResponse"; +export * from "./DeleteTransferOrderResponse"; export * from "./DeleteWebhookSubscriptionResponse"; export * from "./Destination"; export * from "./DestinationDetails"; @@ -647,6 +656,8 @@ export * from "./ListCardsResponse"; export * from "./ListCashDrawerShiftEventsResponse"; export * from "./ListCashDrawerShiftsResponse"; export * from "./ListCatalogResponse"; +export * from "./ListChannelsRequestConstants"; +export * from "./ListChannelsResponse"; export * from "./ListCustomerCustomAttributeDefinitionsResponse"; export * from "./ListCustomerCustomAttributesResponse"; export * from "./ListCustomerGroupsResponse"; @@ -943,7 +954,10 @@ export * from "./QrCodeOptions"; export * from "./QuickPay"; export * from "./Range"; export * from "./ReceiptOptions"; +export * from "./ReceiveTransferOrderResponse"; export * from "./RedeemLoyaltyRewardResponse"; +export * from "./Reference"; +export * from "./ReferenceType"; export * from "./Refund"; export * from "./RefundCreatedEvent"; export * from "./RefundCreatedEventData"; @@ -964,6 +978,7 @@ export * from "./GetBusinessBookingProfileResponse"; export * from "./GetCardResponse"; export * from "./GetCashDrawerShiftResponse"; export * from "./GetCatalogObjectResponse"; +export * from "./RetrieveChannelResponse"; export * from "./GetCustomerCustomAttributeDefinitionResponse"; export * from "./GetCustomerCustomAttributeResponse"; export * from "./GetCustomerGroupResponse"; @@ -1006,6 +1021,7 @@ export * from "./GetTeamMemberResponse"; export * from "./RetrieveTimecardResponse"; export * from "./RetrieveTokenStatusResponse"; export * from "./GetTransactionResponse"; +export * from "./RetrieveTransferOrderResponse"; export * from "./GetVendorResponse"; export * from "./GetWageSettingResponse"; export * from "./GetWebhookSubscriptionResponse"; @@ -1064,6 +1080,7 @@ export * from "./SearchTerminalActionsResponse"; export * from "./SearchTerminalCheckoutsResponse"; export * from "./SearchTerminalRefundsResponse"; export * from "./SearchTimecardsResponse"; +export * from "./SearchTransferOrdersResponse"; export * from "./SearchVendorsRequestFilter"; export * from "./SearchVendorsRequestSort"; export * from "./SearchVendorsRequestSortField"; @@ -1091,6 +1108,7 @@ export * from "./SourceApplication"; export * from "./SquareAccountDetails"; export * from "./StandardUnitDescription"; export * from "./StandardUnitDescriptionGroup"; +export * from "./StartTransferOrderResponse"; export * from "./SubmitEvidenceResponse"; export * from "./Subscription"; export * from "./SubscriptionAction"; @@ -1192,6 +1210,23 @@ export * from "./TipSettings"; export * from "./Transaction"; export * from "./TransactionProduct"; export * from "./TransactionType"; +export * from "./TransferOrder"; +export * from "./TransferOrderCreatedEvent"; +export * from "./TransferOrderCreatedEventData"; +export * from "./TransferOrderCreatedEventObject"; +export * from "./TransferOrderDeletedEvent"; +export * from "./TransferOrderDeletedEventData"; +export * from "./TransferOrderFilter"; +export * from "./TransferOrderGoodsReceipt"; +export * from "./TransferOrderGoodsReceiptLineItem"; +export * from "./TransferOrderLine"; +export * from "./TransferOrderQuery"; +export * from "./TransferOrderSort"; +export * from "./TransferOrderSortField"; +export * from "./TransferOrderStatus"; +export * from "./TransferOrderUpdatedEvent"; +export * from "./TransferOrderUpdatedEventData"; +export * from "./TransferOrderUpdatedEventObject"; export * from "./UnlinkCustomerFromGiftCardResponse"; export * from "./UpdateBookingCustomAttributeDefinitionResponse"; export * from "./UpdateBookingResponse"; @@ -1220,6 +1255,9 @@ export * from "./UpdateSubscriptionResponse"; export * from "./UpdateTeamMemberRequest"; export * from "./UpdateTeamMemberResponse"; export * from "./UpdateTimecardResponse"; +export * from "./UpdateTransferOrderData"; +export * from "./UpdateTransferOrderLineData"; +export * from "./UpdateTransferOrderResponse"; export * from "./UpdateVendorRequest"; export * from "./UpdateVendorResponse"; export * from "./UpdateWageSettingResponse"; diff --git a/src/version.ts b/src/version.ts index d1ee57a59..7854a9712 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "43.1.1"; +export const SDK_VERSION = "43.1.0"; diff --git a/tests/wire/bookings/customAttributeDefinitions.test.ts b/tests/wire/bookings/customAttributeDefinitions.test.ts index 803d05ba0..97cadf0b2 100644 --- a/tests/wire/bookings/customAttributeDefinitions.test.ts +++ b/tests/wire/bookings/customAttributeDefinitions.test.ts @@ -90,6 +90,7 @@ describe("CustomAttributeDefinitions", () => { const response = await client.bookings.customAttributeDefinitions.get({ key: "key", + version: 1, }); expect(response).toEqual({ customAttributeDefinition: { diff --git a/tests/wire/bookings/customAttributes.test.ts b/tests/wire/bookings/customAttributes.test.ts index 81ef7210a..602533cfe 100644 --- a/tests/wire/bookings/customAttributes.test.ts +++ b/tests/wire/bookings/customAttributes.test.ts @@ -306,6 +306,8 @@ describe("CustomAttributes", () => { const response = await client.bookings.customAttributes.get({ bookingId: "booking_id", key: "key", + withDefinition: true, + version: 1, }); expect(response).toEqual({ customAttribute: { diff --git a/tests/wire/catalog.test.ts b/tests/wire/catalog.test.ts index 1e3a5e102..c4d3463aa 100644 --- a/tests/wire/catalog.test.ts +++ b/tests/wire/catalog.test.ts @@ -475,251 +475,6 @@ describe("Catalog", () => { }); }); - 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({ - objectTypes: ["ITEM"], - query: { - prefixQuery: { - attributeName: "name", - attributePrefix: "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", - updatedAt: "updated_at", - version: BigInt("1000000"), - isDeleted: true, - customAttributeValues: { - key: {}, - }, - catalogV1Ids: [{}], - presentAtAllLocations: true, - presentAtLocationIds: ["present_at_location_ids"], - absentAtLocationIds: ["absent_at_location_ids"], - imageId: "image_id", - }, - { - type: "ITEM", - id: "id", - updatedAt: "updated_at", - version: BigInt("1000000"), - isDeleted: true, - customAttributeValues: { - key: {}, - }, - catalogV1Ids: [{}], - presentAtAllLocations: true, - presentAtLocationIds: ["present_at_location_ids"], - absentAtLocationIds: ["absent_at_location_ids"], - imageId: "image_id", - }, - ], - relatedObjects: [ - { - type: "ITEM", - id: "id", - updatedAt: "updated_at", - version: BigInt("1000000"), - isDeleted: true, - customAttributeValues: { - key: {}, - }, - catalogV1Ids: [{}], - presentAtAllLocations: true, - presentAtLocationIds: ["present_at_location_ids"], - absentAtLocationIds: ["absent_at_location_ids"], - imageId: "image_id", - }, - ], - latestTime: "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({ - textFilter: "red", - categoryIds: ["WINE_CATEGORY_ID"], - stockLevels: ["OUT", "LOW"], - enabledLocationIds: ["ATL_LOCATION_ID"], - limit: 100, - sortOrder: "ASC", - productTypes: ["REGULAR"], - customAttributeFilters: [ - { - customAttributeDefinitionId: "VEGAN_DEFINITION_ID", - boolFilter: true, - }, - { - customAttributeDefinitionId: "BRAND_DEFINITION_ID", - stringFilter: "Dark Horse", - }, - { - key: "VINTAGE", - numberFilter: { - min: "min", - max: "max", - }, - }, - { - customAttributeDefinitionId: "VARIETAL_DEFINITION_ID", - }, - ], - }); - expect(response).toEqual({ - errors: [ - { - category: "API_ERROR", - code: "INTERNAL_SERVER_ERROR", - detail: "detail", - field: "field", - }, - ], - items: [ - { - type: "ITEM", - id: "id", - updatedAt: "updated_at", - version: BigInt("1000000"), - isDeleted: true, - customAttributeValues: { - key: {}, - }, - catalogV1Ids: [{}], - presentAtAllLocations: true, - presentAtLocationIds: ["present_at_location_ids"], - absentAtLocationIds: ["absent_at_location_ids"], - imageId: "image_id", - }, - ], - cursor: "cursor", - matchedVariationIds: ["VBJNPHCOKDFECR6VU25WRJUD"], - }); - }); - test("UpdateItemModifierLists", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); diff --git a/tests/wire/catalog/object.test.ts b/tests/wire/catalog/object.test.ts index 3b3a58854..65945541d 100644 --- a/tests/wire/catalog/object.test.ts +++ b/tests/wire/catalog/object.test.ts @@ -220,6 +220,9 @@ describe("Object_", () => { const response = await client.catalog.object.get({ objectId: "object_id", + includeRelatedObjects: true, + catalogVersion: BigInt("1000000"), + includeCategoryPathToRoot: true, }); expect(response).toEqual({ errors: [ diff --git a/tests/wire/channels.test.ts b/tests/wire/channels.test.ts new file mode 100644 index 000000000..0f46d1c35 --- /dev/null +++ b/tests/wire/channels.test.ts @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("Channels", () => { + test("bulkRetrieve", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { channel_ids: ["CH_9C03D0B59", "CH_6X139B5MN", "NOT_EXISTING"] }; + const rawResponseBody = { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + responses: { + CH_6X139B5MN: { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + channel: { + id: "CH_6X139B5MN", + merchant_id: "ML64FACEA", + name: "Contoso Fulfillment Application", + version: 1, + reference: { type: "OAUTH_APPLICATION", id: "OA_9C03D0444" }, + status: "ACTIVE", + created_at: "2022-10-25T16:27:00Z", + updated_at: "2022-10-25T16:48:00Z", + }, + }, + CH_9C03D0B59: { + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR" }], + channel: { + id: "CH_9C03D0B59", + merchant_id: "ML64FACEA", + name: "State Street Store", + version: 1, + reference: { type: "LOCATION", id: "OA_9C03D0B59" }, + status: "ACTIVE", + created_at: "2022-10-25T16:27:00Z", + updated_at: "2022-10-25T16:48:00Z", + }, + }, + NOT_EXISTING: { errors: [{ category: "API_ERROR", code: "NOT_FOUND" }] }, + }, + }; + server + .mockEndpoint() + .post("/v2/channels/bulk-retrieve") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.channels.bulkRetrieve({ + channelIds: ["CH_9C03D0B59", "CH_6X139B5MN", "NOT_EXISTING"], + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + responses: { + CH_6X139B5MN: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + channel: { + id: "CH_6X139B5MN", + merchantId: "ML64FACEA", + name: "Contoso Fulfillment Application", + version: 1, + reference: { + type: "OAUTH_APPLICATION", + id: "OA_9C03D0444", + }, + status: "ACTIVE", + createdAt: "2022-10-25T16:27:00Z", + updatedAt: "2022-10-25T16:48:00Z", + }, + }, + CH_9C03D0B59: { + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + }, + ], + channel: { + id: "CH_9C03D0B59", + merchantId: "ML64FACEA", + name: "State Street Store", + version: 1, + reference: { + type: "LOCATION", + id: "OA_9C03D0B59", + }, + status: "ACTIVE", + createdAt: "2022-10-25T16:27:00Z", + updatedAt: "2022-10-25T16:48:00Z", + }, + }, + NOT_EXISTING: { + errors: [ + { + category: "API_ERROR", + code: "NOT_FOUND", + }, + ], + }, + }, + }); + }); + + 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" }], + channel: { + id: "CH_9C03D0B59", + merchant_id: "ML64FACEA", + name: "Contoso Fulfillment Application", + version: 1, + reference: { type: "OAUTH_APPLICATION", id: "OA_9C03D0444" }, + status: "ACTIVE", + created_at: "2022-10-25T16:27:00Z", + updated_at: "2022-10-25T16:48:00Z", + }, + }; + server + .mockEndpoint() + .get("/v2/channels/channel_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.channels.get({ + channelId: "channel_id", + }); + expect(response).toEqual({ + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + channel: { + id: "CH_9C03D0B59", + merchantId: "ML64FACEA", + name: "Contoso Fulfillment Application", + version: 1, + reference: { + type: "OAUTH_APPLICATION", + id: "OA_9C03D0444", + }, + status: "ACTIVE", + createdAt: "2022-10-25T16:27:00Z", + updatedAt: "2022-10-25T16:48:00Z", + }, + }); + }); +}); diff --git a/tests/wire/customers.test.ts b/tests/wire/customers.test.ts index 21fdb5b60..8148fb430 100644 --- a/tests/wire/customers.test.ts +++ b/tests/wire/customers.test.ts @@ -685,190 +685,6 @@ describe("Customers", () => { }); }); - 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: { - creationSource: { - values: ["THIRD_PARTY"], - rule: "INCLUDE", - }, - createdAt: { - startAt: "2018-01-01T00:00:00-00:00", - endAt: "2018-02-01T00:00:00-00:00", - }, - emailAddress: { - fuzzy: "example.com", - }, - groupIds: { - all: ["545AXB44B4XXWMVQ4W8SBT3HHF"], - }, - }, - sort: { - field: "CREATED_AT", - order: "ASC", - }, - }, - }); - expect(response).toEqual({ - errors: [ - { - category: "API_ERROR", - code: "INTERNAL_SERVER_ERROR", - detail: "detail", - field: "field", - }, - ], - customers: [ - { - id: "JDKYHBWT1D4F8MFH63DBMEN8Y4", - createdAt: "2018-01-23T20:21:54.859Z", - updatedAt: "2020-04-20T10:02:43.083Z", - givenName: "James", - familyName: "Bond", - nickname: "nickname", - companyName: "company_name", - emailAddress: "james.bond@example.com", - address: { - addressLine1: "505 Electric Ave", - addressLine2: "Suite 600", - locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", - country: "US", - }, - phoneNumber: "+1-212-555-4250", - birthday: "birthday", - referenceId: "YOUR_REFERENCE_ID_2", - note: "note", - preferences: { - emailUnsubscribed: false, - }, - creationSource: "DIRECTORY", - groupIds: ["545AXB44B4XXWMVQ4W8SBT3HHF"], - segmentIds: ["1KB9JE5EGJXCW.REACHABLE"], - version: BigInt("7"), - }, - { - id: "A9641GZW2H7Z56YYSD41Q12HDW", - createdAt: "2018-01-30T14:10:54.859Z", - updatedAt: "2018-03-08T18:25:21.342Z", - givenName: "Amelia", - familyName: "Earhart", - nickname: "nickname", - companyName: "company_name", - emailAddress: "amelia.earhart@example.com", - address: { - addressLine1: "500 Electric Ave", - addressLine2: "Suite 600", - locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", - country: "US", - }, - phoneNumber: "+1-212-555-9238", - birthday: "birthday", - referenceId: "YOUR_REFERENCE_ID_1", - note: "a customer", - preferences: { - emailUnsubscribed: false, - }, - creationSource: "THIRD_PARTY", - groupIds: ["545AXB44B4XXWMVQ4W8SBT3HHF"], - segmentIds: ["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 }); @@ -1106,6 +922,7 @@ describe("Customers", () => { const response = await client.customers.delete({ customerId: "customer_id", + version: BigInt("1000000"), }); expect(response).toEqual({ errors: [ diff --git a/tests/wire/customers/customAttributeDefinitions.test.ts b/tests/wire/customers/customAttributeDefinitions.test.ts index c91893d5c..d6a45aafd 100644 --- a/tests/wire/customers/customAttributeDefinitions.test.ts +++ b/tests/wire/customers/customAttributeDefinitions.test.ts @@ -108,6 +108,7 @@ describe("CustomAttributeDefinitions", () => { const response = await client.customers.customAttributeDefinitions.get({ key: "key", + version: 1, }); expect(response).toEqual({ customAttributeDefinition: { diff --git a/tests/wire/customers/customAttributes.test.ts b/tests/wire/customers/customAttributes.test.ts index 1e17e6722..d54d1bde3 100644 --- a/tests/wire/customers/customAttributes.test.ts +++ b/tests/wire/customers/customAttributes.test.ts @@ -42,6 +42,8 @@ describe("CustomAttributes", () => { const response = await client.customers.customAttributes.get({ customerId: "customer_id", key: "key", + withDefinition: true, + version: 1, }); expect(response).toEqual({ customAttribute: { diff --git a/tests/wire/events.test.ts b/tests/wire/events.test.ts index 43a51517f..4a20f754d 100644 --- a/tests/wire/events.test.ts +++ b/tests/wire/events.test.ts @@ -170,7 +170,9 @@ describe("Events", () => { }; server.mockEndpoint().get("/v2/events/types").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); - const response = await client.events.listEventTypes(); + const response = await client.events.listEventTypes({ + apiVersion: "api_version", + }); expect(response).toEqual({ errors: [ { diff --git a/tests/wire/inventory.test.ts b/tests/wire/inventory.test.ts index cf796a8b6..48b09e8ec 100644 --- a/tests/wire/inventory.test.ts +++ b/tests/wire/inventory.test.ts @@ -284,158 +284,6 @@ describe("Inventory", () => { }); }); - 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({ - catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - locationIds: ["C6W5YS5QM06F5"], - types: ["PHYSICAL_COUNT"], - states: ["IN_STOCK"], - updatedAfter: "2016-11-01T00:00:00.000Z", - updatedBefore: "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", - physicalCount: { - id: "46YDTW253DWGGK9HMAE6XCAO", - referenceId: "22c07cf4-5626-4224-89f9-691112019399", - catalogObjectId: "W62UWFY35CWMYGVWK6TWJDNI", - catalogObjectType: "ITEM_VARIATION", - state: "IN_STOCK", - locationId: "C6W5YS5QM06F5", - quantity: "86", - source: { - product: "SQUARE_POS", - applicationId: "416ff29c-86c4-4feb-b58c-9705f21f3ea0", - name: "Square Point of Sale 4.37", - }, - teamMemberId: "LRK57NSQ5X7PUD05", - occurredAt: "2016-11-16T22:24:49.028Z", - createdAt: "2016-11-16T22:25:24.878Z", - }, - measurementUnitId: "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({ - catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], - locationIds: ["59TNP9SA8VGDA"], - updatedAfter: "2016-11-16T00:00:00.000Z", - }); - expect(response).toEqual({ - errors: [ - { - category: "API_ERROR", - code: "INTERNAL_SERVER_ERROR", - detail: "detail", - field: "field", - }, - ], - counts: [ - { - catalogObjectId: "W62UWFY35CWMYGVWK6TWJDNI", - catalogObjectType: "ITEM_VARIATION", - state: "IN_STOCK", - locationId: "59TNP9SA8VGDA", - quantity: "79", - calculatedAt: "2016-11-16T22:28:01.223Z", - isEstimated: true, - }, - ], - cursor: "cursor", - }); - }); - test("BatchCreateChanges", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); diff --git a/tests/wire/invoices.test.ts b/tests/wire/invoices.test.ts index 01fff266f..c569a88fd 100644 --- a/tests/wire/invoices.test.ts +++ b/tests/wire/invoices.test.ts @@ -257,332 +257,6 @@ describe("Invoices", () => { }); }); - 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: { - locationIds: ["ES0RJRZYEC39A"], - customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"], - }, - sort: { - field: "INVOICE_SORT_DATE", - order: "DESC", - }, - }, - limit: 100, - }); - expect(response).toEqual({ - invoices: [ - { - id: "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - version: 0, - locationId: "ES0RJRZYEC39A", - orderId: "CAISENgvlJ6jLWAzERDzjyHVybY", - primaryRecipient: { - customerId: "JDKYHBWT1D4F8MFH63DBMEN8Y4", - givenName: "Amelia", - familyName: "Earhart", - emailAddress: "Amelia.Earhart@example.com", - phoneNumber: "1-212-555-4240", - }, - paymentRequests: [ - { - uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", - requestType: "BALANCE", - dueDate: "2030-01-24", - tippingEnabled: true, - automaticPaymentSource: "NONE", - reminders: [ - { - uid: "beebd363-e47f-4075-8785-c235aaa7df11", - relativeScheduledDays: -1, - message: "Your invoice is due tomorrow", - status: "PENDING", - }, - ], - computedAmountMoney: { - amount: BigInt("10000"), - currency: "USD", - }, - totalCompletedAmountMoney: { - amount: BigInt("0"), - currency: "USD", - }, - }, - ], - deliveryMethod: "EMAIL", - invoiceNumber: "inv-100", - title: "Event Planning Services", - description: "We appreciate your business!", - scheduledAt: "2030-01-13T10:00:00Z", - publicUrl: "public_url", - status: "DRAFT", - timezone: "America/Los_Angeles", - createdAt: "2020-06-18T17:45:13Z", - updatedAt: "2020-06-18T17:45:13Z", - acceptedPaymentMethods: { - card: true, - squareGiftCard: false, - bankAccount: false, - buyNowPayLater: false, - cashAppPay: false, - }, - customFields: [ - { - label: "Event Reference Number", - value: "Ref. #1234", - placement: "ABOVE_LINE_ITEMS", - }, - { - label: "Terms of Service", - value: "The terms of service are...", - placement: "BELOW_LINE_ITEMS", - }, - ], - subscriptionId: "subscription_id", - saleOrServiceDate: "2030-01-24", - paymentConditions: "payment_conditions", - storePaymentMethodEnabled: false, - attachments: [{}], - creatorTeamMemberId: "creator_team_member_id", - }, - { - id: "inv:0-ChC366qAfskpGrBI_1bozs9mEA3", - version: 3, - locationId: "ES0RJRZYEC39A", - orderId: "a65jnS8NXbfprvGJzY9F4fQTuaB", - primaryRecipient: { - customerId: "JDKYHBWT1D4F8MFH63DBMEN8Y4", - givenName: "Amelia", - familyName: "Earhart", - emailAddress: "Amelia.Earhart@example.com", - phoneNumber: "1-212-555-4240", - }, - paymentRequests: [ - { - uid: "66c3bdfd-5090-4ff9-a8a0-c1e1a2ffa176", - requestType: "DEPOSIT", - dueDate: "2021-01-23", - percentageRequested: "25", - tippingEnabled: false, - automaticPaymentSource: "CARD_ON_FILE", - cardId: "ccof:IkWfpLj4tNHMyFii3GB", - computedAmountMoney: { - amount: BigInt("1000"), - currency: "USD", - }, - totalCompletedAmountMoney: { - amount: BigInt("1000"), - currency: "USD", - }, - }, - { - uid: "120c5e18-4f80-4f6b-b159-774cb9bf8f99", - requestType: "BALANCE", - dueDate: "2021-06-15", - tippingEnabled: false, - automaticPaymentSource: "CARD_ON_FILE", - cardId: "ccof:IkWfpLj4tNHMyFii3GB", - computedAmountMoney: { - amount: BigInt("3000"), - currency: "USD", - }, - totalCompletedAmountMoney: { - amount: BigInt("0"), - currency: "USD", - }, - }, - ], - deliveryMethod: "EMAIL", - invoiceNumber: "inv-455", - title: "title", - description: "description", - scheduledAt: "scheduled_at", - publicUrl: "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", - nextPaymentAmountMoney: { - amount: BigInt("3000"), - currency: "USD", - }, - status: "PARTIALLY_PAID", - timezone: "America/Los_Angeles", - createdAt: "2021-01-23T15:29:12Z", - updatedAt: "2021-01-23T15:29:56Z", - acceptedPaymentMethods: { - card: true, - squareGiftCard: true, - bankAccount: false, - buyNowPayLater: false, - cashAppPay: false, - }, - customFields: [{}], - subscriptionId: "subscription_id", - saleOrServiceDate: "2030-01-24", - paymentConditions: "payment_conditions", - storePaymentMethodEnabled: false, - attachments: [{}], - creatorTeamMemberId: "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 }); @@ -939,6 +613,7 @@ describe("Invoices", () => { const response = await client.invoices.delete({ invoiceId: "invoice_id", + version: 1, }); expect(response).toEqual({ errors: [ diff --git a/tests/wire/labor/shifts.test.ts b/tests/wire/labor/shifts.test.ts index e614b9e17..24206c429 100644 --- a/tests/wire/labor/shifts.test.ts +++ b/tests/wire/labor/shifts.test.ts @@ -153,220 +153,6 @@ describe("Shifts", () => { }); }); - 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: { - dateRange: { - startDate: "2019-01-20", - endDate: "2019-02-03", - }, - matchShiftsBy: "START_AT", - defaultTimezone: "America/Los_Angeles", - }, - }, - }, - limit: 100, - }); - expect(response).toEqual({ - shifts: [ - { - id: "X714F3HA6D1PT", - employeeId: "ormj0jJJZ5OZIzxrZYJI", - locationId: "PAA1RJZZKXBFG", - timezone: "America/New_York", - startAt: "2019-01-21T03:11:00-05:00", - endAt: "2019-01-21T13:11:00-05:00", - wage: { - title: "Barista", - hourlyRate: { - amount: BigInt("1100"), - currency: "USD", - }, - jobId: "FzbJAtt9qEWncK1BWgVCxQ6M", - tipEligible: true, - }, - breaks: [ - { - id: "SJW7X6AKEJQ65", - startAt: "2019-01-21T06:11:00-05:00", - endAt: "2019-01-21T06:11:00-05:00", - breakTypeId: "REGS1EQR1TPZ5", - name: "Tea Break", - expectedDuration: "PT10M", - isPaid: true, - }, - ], - status: "CLOSED", - version: 6, - createdAt: "2019-01-24T01:12:03Z", - updatedAt: "2019-02-07T22:21:08Z", - teamMemberId: "ormj0jJJZ5OZIzxrZYJI", - declaredCashTipMoney: { - amount: BigInt("500"), - currency: "USD", - }, - }, - { - id: "GDHYBZYWK0P2V", - employeeId: "33fJchumvVdJwxV0H6L9", - locationId: "PAA1RJZZKXBFG", - timezone: "America/New_York", - startAt: "2019-01-22T12:02:00-05:00", - endAt: "2019-01-22T13:02:00-05:00", - wage: { - title: "Cook", - hourlyRate: { - amount: BigInt("1600"), - currency: "USD", - }, - jobId: "gcbz15vKGnMKmaWJJ152kjim", - tipEligible: true, - }, - breaks: [ - { - id: "BKS6VR7WR748A", - startAt: "2019-01-23T14:30:00-05:00", - endAt: "2019-01-23T14:40:00-05:00", - breakTypeId: "WQX00VR99F53J", - name: "Tea Break", - expectedDuration: "PT10M", - isPaid: true, - }, - { - id: "BQFEZSHFZSC51", - startAt: "2019-01-22T12:30:00-05:00", - endAt: "2019-01-22T12:44:00-05:00", - breakTypeId: "P6Q468ZFRN1AC", - name: "Coffee Break", - expectedDuration: "PT15M", - isPaid: false, - }, - ], - status: "CLOSED", - version: 16, - createdAt: "2019-01-23T23:32:45Z", - updatedAt: "2019-01-24T00:56:25Z", - teamMemberId: "33fJchumvVdJwxV0H6L9", - declaredCashTipMoney: { - 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 }); diff --git a/tests/wire/locations/customAttributeDefinitions.test.ts b/tests/wire/locations/customAttributeDefinitions.test.ts index fd1e52bb9..9981e7c1c 100644 --- a/tests/wire/locations/customAttributeDefinitions.test.ts +++ b/tests/wire/locations/customAttributeDefinitions.test.ts @@ -108,6 +108,7 @@ describe("CustomAttributeDefinitions", () => { const response = await client.locations.customAttributeDefinitions.get({ key: "key", + version: 1, }); expect(response).toEqual({ customAttributeDefinition: { diff --git a/tests/wire/locations/customAttributes.test.ts b/tests/wire/locations/customAttributes.test.ts index af23bcc83..97be77755 100644 --- a/tests/wire/locations/customAttributes.test.ts +++ b/tests/wire/locations/customAttributes.test.ts @@ -278,6 +278,8 @@ describe("CustomAttributes", () => { const response = await client.locations.customAttributes.get({ locationId: "location_id", key: "key", + withDefinition: true, + version: 1, }); expect(response).toEqual({ customAttribute: { diff --git a/tests/wire/locations/transactions.test.ts b/tests/wire/locations/transactions.test.ts index 13055153c..1c73f947a 100644 --- a/tests/wire/locations/transactions.test.ts +++ b/tests/wire/locations/transactions.test.ts @@ -79,6 +79,10 @@ describe("Transactions", () => { const response = await client.locations.transactions.list({ locationId: "location_id", + beginTime: "begin_time", + endTime: "end_time", + sortOrder: "DESC", + cursor: "cursor", }); expect(response).toEqual({ errors: [ diff --git a/tests/wire/loyalty.test.ts b/tests/wire/loyalty.test.ts deleted file mode 100644 index 95b8cbc48..000000000 --- a/tests/wire/loyalty.test.ts +++ /dev/null @@ -1,169 +0,0 @@ -/** - * 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: { - orderFilter: { - orderId: "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", - createdAt: "2020-05-08T22:01:30Z", - accumulatePoints: { - loyaltyProgramId: "d619f755-2d17-41f3-990d-c04ecedd64dd", - points: 5, - orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY", - }, - adjustPoints: { - points: 1, - }, - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - locationId: "P034NEENMD09F", - source: "LOYALTY_API", - expirePoints: { - points: 1, - }, - otherEvent: { - points: 1, - }, - }, - { - id: "e4a5cbc3-a4d0-3779-98e9-e578885d9430", - type: "REDEEM_REWARD", - createdAt: "2020-05-08T22:01:15Z", - redeemReward: { - loyaltyProgramId: "d619f755-2d17-41f3-990d-c04ecedd64dd", - rewardId: "d03f79f4-815f-3500-b851-cc1e68a457f9", - orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY", - }, - adjustPoints: { - points: 1, - }, - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - locationId: "P034NEENMD09F", - source: "LOYALTY_API", - expirePoints: { - points: 1, - }, - otherEvent: { - points: 1, - }, - }, - { - id: "5e127479-0b03-3671-ab1e-15faea8b7188", - type: "CREATE_REWARD", - createdAt: "2020-05-08T22:00:44Z", - createReward: { - loyaltyProgramId: "d619f755-2d17-41f3-990d-c04ecedd64dd", - rewardId: "d03f79f4-815f-3500-b851-cc1e68a457f9", - points: -10, - }, - adjustPoints: { - points: 1, - }, - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - locationId: "location_id", - source: "LOYALTY_API", - expirePoints: { - points: 1, - }, - otherEvent: { - points: 1, - }, - }, - ], - cursor: "cursor", - }); - }); -}); diff --git a/tests/wire/loyalty/accounts.test.ts b/tests/wire/loyalty/accounts.test.ts index ff92ebe22..3270bd0f9 100644 --- a/tests/wire/loyalty/accounts.test.ts +++ b/tests/wire/loyalty/accounts.test.ts @@ -86,87 +86,6 @@ describe("Accounts", () => { }); }); - 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: [ - { - phoneNumber: "+14155551234", - }, - ], - }, - limit: 10, - }); - expect(response).toEqual({ - errors: [ - { - category: "API_ERROR", - code: "INTERNAL_SERVER_ERROR", - detail: "detail", - field: "field", - }, - ], - loyaltyAccounts: [ - { - id: "79b807d2-d786-46a9-933b-918028d7a8c5", - programId: "d619f755-2d17-41f3-990d-c04ecedd64dd", - balance: 10, - lifetimePoints: 20, - customerId: "Q8002FAM9V1EZ0ADB2T5609X6NET1H0", - enrolledAt: "enrolled_at", - createdAt: "2020-05-08T21:44:32Z", - updatedAt: "2020-05-08T21:44:32Z", - mapping: { - id: "66aaab3f-da99-49ed-8b19-b87f851c844f", - createdAt: "2020-05-08T21:44:32Z", - phoneNumber: "+14155551234", - }, - expiringPointDeadlines: [ - { - points: 1, - expiresAt: "expires_at", - }, - ], - }, - ], - cursor: "cursor", - }); - }); - test("get", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); diff --git a/tests/wire/loyalty/programs/promotions.test.ts b/tests/wire/loyalty/programs/promotions.test.ts index 7739e6ed6..66a5a1ede 100644 --- a/tests/wire/loyalty/programs/promotions.test.ts +++ b/tests/wire/loyalty/programs/promotions.test.ts @@ -177,8 +177,8 @@ describe("Promotions", () => { .build(); const response = await client.loyalty.programs.promotions.get({ - promotionId: "promotion_id", programId: "program_id", + promotionId: "promotion_id", }); expect(response).toEqual({ errors: [ @@ -269,8 +269,8 @@ describe("Promotions", () => { .build(); const response = await client.loyalty.programs.promotions.cancel({ - promotionId: "promotion_id", programId: "program_id", + promotionId: "promotion_id", }); expect(response).toEqual({ errors: [ diff --git a/tests/wire/loyalty/rewards.test.ts b/tests/wire/loyalty/rewards.test.ts index b67d8c73b..d1ca16818 100644 --- a/tests/wire/loyalty/rewards.test.ts +++ b/tests/wire/loyalty/rewards.test.ts @@ -71,134 +71,6 @@ describe("Rewards", () => { }); }); - 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: { - loyaltyAccountId: "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", - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - points: 10, - orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY", - createdAt: "2020-05-08T22:00:44Z", - updatedAt: "2020-05-08T22:01:17Z", - redeemedAt: "2020-05-08T22:01:17Z", - }, - { - id: "9f18ac21-233a-31c3-be77-b45840f5a810", - status: "REDEEMED", - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - points: 10, - orderId: "order_id", - createdAt: "2020-05-08T21:55:42Z", - updatedAt: "2020-05-08T21:56:00Z", - redeemedAt: "2020-05-08T21:56:00Z", - }, - { - id: "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943", - status: "DELETED", - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - points: 10, - orderId: "5NB69ZNh3FbsOs1ox43bh1xrli6YY", - createdAt: "2020-05-01T21:49:54Z", - updatedAt: "2020-05-08T21:55:10Z", - redeemedAt: "redeemed_at", - }, - { - id: "a051254c-f840-3b45-8cf1-50bcd38ff92a", - status: "ISSUED", - loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - points: 10, - orderId: "LQQ16znvi2VIUKPVhUfJefzr1eEZY", - createdAt: "2020-05-01T20:20:37Z", - updatedAt: "2020-05-01T20:20:40Z", - redeemedAt: "redeemed_at", - }, - ], - cursor: "cursor", - }); - }); - test("get", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); diff --git a/tests/wire/merchants/customAttributeDefinitions.test.ts b/tests/wire/merchants/customAttributeDefinitions.test.ts index 123d7e9fb..5123e9514 100644 --- a/tests/wire/merchants/customAttributeDefinitions.test.ts +++ b/tests/wire/merchants/customAttributeDefinitions.test.ts @@ -108,6 +108,7 @@ describe("CustomAttributeDefinitions", () => { const response = await client.merchants.customAttributeDefinitions.get({ key: "key", + version: 1, }); expect(response).toEqual({ customAttributeDefinition: { diff --git a/tests/wire/merchants/customAttributes.test.ts b/tests/wire/merchants/customAttributes.test.ts index 358de20d9..d95f40c4c 100644 --- a/tests/wire/merchants/customAttributes.test.ts +++ b/tests/wire/merchants/customAttributes.test.ts @@ -220,6 +220,8 @@ describe("CustomAttributes", () => { const response = await client.merchants.customAttributes.get({ merchantId: "merchant_id", key: "key", + withDefinition: true, + version: 1, }); expect(response).toEqual({ customAttribute: { diff --git a/tests/wire/orders.test.ts b/tests/wire/orders.test.ts index b1e897e29..ac93bdb39 100644 --- a/tests/wire/orders.test.ts +++ b/tests/wire/orders.test.ts @@ -1561,162 +1561,6 @@ describe("Orders", () => { }); }); - 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({ - locationIds: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], - query: { - filter: { - stateFilter: { - states: ["COMPLETED"], - }, - dateTimeFilter: { - closedAt: { - startAt: "2018-03-03T20:00:00+00:00", - endAt: "2019-03-04T21:54:45+00:00", - }, - }, - }, - sort: { - sortField: "CLOSED_AT", - sortOrder: "DESC", - }, - }, - limit: 3, - returnEntries: true, - }); - expect(response).toEqual({ - orderEntries: [ - { - orderId: "CAISEM82RcpmcFBM0TfOyiHV3es", - version: 1, - locationId: "057P5VYJ4A5X1", - }, - { - orderId: "CAISENgvlJ6jLWAzERDzjyHVybY", - version: 1, - locationId: "18YC4JDH91E1H", - }, - { - orderId: "CAISEM52YcpmcWAzERDOyiWS3ty", - version: 1, - locationId: "057P5VYJ4A5X1", - }, - ], - orders: [ - { - id: "id", - locationId: "location_id", - referenceId: "reference_id", - customerId: "customer_id", - lineItems: [ - { - quantity: "quantity", - }, - ], - taxes: [{}], - discounts: [{}], - serviceCharges: [{}], - fulfillments: [{}], - returns: [{}], - tenders: [ - { - type: "CARD", - }, - ], - refunds: [ - { - id: "id", - locationId: "location_id", - reason: "reason", - amountMoney: {}, - status: "PENDING", - }, - ], - createdAt: "created_at", - updatedAt: "updated_at", - closedAt: "closed_at", - state: "OPEN", - version: 1, - ticketName: "ticket_name", - rewards: [ - { - id: "id", - rewardTierId: "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 }); diff --git a/tests/wire/orders/customAttributeDefinitions.test.ts b/tests/wire/orders/customAttributeDefinitions.test.ts index b95344f51..0e45e7484 100644 --- a/tests/wire/orders/customAttributeDefinitions.test.ts +++ b/tests/wire/orders/customAttributeDefinitions.test.ts @@ -110,6 +110,7 @@ describe("CustomAttributeDefinitions", () => { const response = await client.orders.customAttributeDefinitions.get({ key: "key", + version: 1, }); expect(response).toEqual({ customAttributeDefinition: { diff --git a/tests/wire/orders/customAttributes.test.ts b/tests/wire/orders/customAttributes.test.ts index e7734114b..01c098e70 100644 --- a/tests/wire/orders/customAttributes.test.ts +++ b/tests/wire/orders/customAttributes.test.ts @@ -222,6 +222,8 @@ describe("CustomAttributes", () => { const response = await client.orders.customAttributes.get({ orderId: "order_id", customAttributeKey: "custom_attribute_key", + version: 1, + withDefinition: true, }); expect(response).toEqual({ customAttribute: { diff --git a/tests/wire/subscriptions.test.ts b/tests/wire/subscriptions.test.ts index b326af019..6f4579256 100644 --- a/tests/wire/subscriptions.test.ts +++ b/tests/wire/subscriptions.test.ts @@ -164,208 +164,6 @@ describe("Subscriptions", () => { }); }); - 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: [{}], - completed_date: "completed_date", - }, - { - 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: [{}], - completed_date: "completed_date", - }, - { - 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", - }, - ], - completed_date: "completed_date", - }, - ], - cursor: "cursor", - }; - server - .mockEndpoint() - .post("/v2/subscriptions/search") - .jsonBody(rawRequestBody) - .respondWith() - .statusCode(200) - .jsonBody(rawResponseBody) - .build(); - - const response = await client.subscriptions.search({ - query: { - filter: { - customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], - locationIds: ["S8GWD5R9QB376"], - sourceNames: ["My App"], - }, - }, - }); - expect(response).toEqual({ - errors: [ - { - category: "API_ERROR", - code: "INTERNAL_SERVER_ERROR", - detail: "detail", - field: "field", - }, - ], - subscriptions: [ - { - id: "de86fc96-8664-474b-af1a-abbe59cacf0e", - locationId: "S8GWD5R9QB376", - planVariationId: "L3TJVDHVBEQEGQDEZL2JJM7R", - customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", - startDate: "2021-10-20", - canceledDate: "2021-10-30", - chargedThroughDate: "2021-11-20", - status: "CANCELED", - taxPercentage: "tax_percentage", - invoiceIds: ["invoice_ids"], - version: BigInt("1000000"), - createdAt: "2021-10-20T21:53:10Z", - cardId: "ccof:mueUsvgajChmjEbp4GB", - timezone: "UTC", - source: { - name: "My Application", - }, - actions: [{}], - monthlyBillingAnchorDate: 1, - phases: [{}], - completedDate: "completed_date", - }, - { - id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", - locationId: "S8GWD5R9QB376", - planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", - startDate: "2022-01-19", - canceledDate: "canceled_date", - chargedThroughDate: "2022-08-19", - status: "PAUSED", - taxPercentage: "5", - invoiceIds: ["grebK0Q_l8H4fqoMMVvt-Q", "rcX_i3sNmHTGKhI4W2mceA"], - priceOverrideMoney: { - amount: BigInt("1000"), - currency: "USD", - }, - version: BigInt("2"), - createdAt: "2022-01-19T21:53:10Z", - cardId: "card_id", - timezone: "America/Los_Angeles", - source: { - name: "My Application", - }, - actions: [{}], - monthlyBillingAnchorDate: 1, - phases: [{}], - completedDate: "completed_date", - }, - { - id: "56214fb2-cc85-47a1-93bc-44f3766bb56f", - locationId: "S8GWD5R9QB376", - planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", - customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", - startDate: "2023-06-20", - canceledDate: "canceled_date", - chargedThroughDate: "charged_through_date", - status: "ACTIVE", - taxPercentage: "tax_percentage", - invoiceIds: ["invoice_ids"], - version: BigInt("1"), - createdAt: "2023-06-20T21:53:10Z", - cardId: "ccof:qy5x8hHGYsgLrp4Q4GB", - timezone: "America/Los_Angeles", - source: { - name: "My Application", - }, - actions: [{}], - monthlyBillingAnchorDate: 1, - phases: [ - { - uid: "873451e0-745b-4e87-ab0b-c574933fe616", - ordinal: BigInt("0"), - orderTemplateId: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", - planPhaseUid: "X2Q2AONPB3RB64Y27S25QCZP", - }, - ], - completedDate: "completed_date", - }, - ], - cursor: "cursor", - }); - }); - test("get", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); @@ -405,6 +203,7 @@ describe("Subscriptions", () => { const response = await client.subscriptions.get({ subscriptionId: "subscription_id", + include: "include", }); expect(response).toEqual({ errors: [ diff --git a/tests/wire/team.test.ts b/tests/wire/team.test.ts index 6d885317e..284fee613 100644 --- a/tests/wire/team.test.ts +++ b/tests/wire/team.test.ts @@ -40,7 +40,9 @@ describe("Team", () => { .jsonBody(rawResponseBody) .build(); - const response = await client.team.listJobs(); + const response = await client.team.listJobs({ + cursor: "cursor", + }); expect(response).toEqual({ jobs: [ { diff --git a/tests/wire/teamMembers.test.ts b/tests/wire/teamMembers.test.ts index 8133f3ebb..29f89fcda 100644 --- a/tests/wire/teamMembers.test.ts +++ b/tests/wire/teamMembers.test.ts @@ -526,516 +526,6 @@ describe("TeamMembers", () => { }); }); - 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: { - locationIds: ["0G5P3VGACMMQZ"], - status: "ACTIVE", - }, - }, - limit: 10, - }); - expect(response).toEqual({ - teamMembers: [ - { - id: "-3oZQKPKVk6gUXU_V5Qa", - referenceId: "12345678", - isOwner: false, - status: "ACTIVE", - givenName: "Johnny", - familyName: "Cash", - emailAddress: "johnny_cash@squareup.com", - phoneNumber: "phone_number", - createdAt: "2019-07-10T17:26:48Z", - updatedAt: "2020-04-28T21:49:28Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - wageSetting: { - teamMemberId: "-3oZQKPKVk6gUXU_V5Qa", - jobAssignments: [ - { - jobTitle: "Manager", - payType: "SALARY", - hourlyRate: { - amount: BigInt("1443"), - currency: "USD", - }, - annualRate: { - amount: BigInt("3000000"), - currency: "USD", - }, - weeklyHours: 40, - jobId: "FjS8x95cqHiMenw4f1NAUH4P", - }, - { - jobTitle: "Cashier", - payType: "HOURLY", - hourlyRate: { - amount: BigInt("2000"), - currency: "USD", - }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", - }, - ], - isOvertimeExempt: true, - version: 1, - createdAt: "2021-06-11T22:55:45Z", - updatedAt: "2021-06-11T22:55:45Z", - }, - }, - { - id: "1AVJj0DjkzbmbJw5r4KK", - referenceId: "abcded", - isOwner: false, - status: "ACTIVE", - givenName: "Lombard", - familyName: "Smith", - emailAddress: "email_address", - phoneNumber: "+14155552671", - createdAt: "2020-03-24T18:14:01Z", - updatedAt: "2020-06-09T17:38:05Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - wageSetting: { - teamMemberId: "1AVJj0DjkzbmbJw5r4KK", - jobAssignments: [ - { - jobTitle: "Cashier", - payType: "HOURLY", - hourlyRate: { - amount: BigInt("2400"), - currency: "USD", - }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", - }, - ], - isOvertimeExempt: true, - version: 2, - createdAt: "2020-03-24T18:14:01Z", - updatedAt: "2020-06-09T17:38:05Z", - }, - }, - { - id: "2JCmiJol_KKFs9z2Evim", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "Monica", - familyName: "Sway", - emailAddress: "email_address", - phoneNumber: "phone_number", - createdAt: "2020-03-24T01:09:25Z", - updatedAt: "2020-03-24T01:11:25Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - wageSetting: { - teamMemberId: "2JCmiJol_KKFs9z2Evim", - jobAssignments: [ - { - jobTitle: "Cashier", - payType: "HOURLY", - hourlyRate: { - amount: BigInt("2400"), - currency: "USD", - }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", - }, - ], - isOvertimeExempt: true, - version: 1, - createdAt: "2020-03-24T01:09:25Z", - updatedAt: "2020-03-24T01:09:25Z", - }, - }, - { - id: "4uXcJQSLtbk3F0UQHFNQ", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "Elton", - familyName: "Ipsum", - emailAddress: "email_address", - phoneNumber: "phone_number", - createdAt: "2020-03-24T01:09:23Z", - updatedAt: "2020-03-24T01:15:23Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - }, - { - id: "5CoUpyrw1YwGWcRd-eDL", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "Steven", - familyName: "Lo", - emailAddress: "email_address", - phoneNumber: "phone_number", - createdAt: "2020-03-24T01:09:23Z", - updatedAt: "2020-03-24T01:19:23Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - }, - { - id: "5MRPTTp8MMBLVSmzrGha", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "Patrick", - familyName: "Steward", - emailAddress: "email_address", - phoneNumber: "+14155552671", - createdAt: "2020-03-24T18:14:03Z", - updatedAt: "2020-03-24T18:18:03Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - wageSetting: { - teamMemberId: "5MRPTTp8MMBLVSmzrGha", - jobAssignments: [ - { - jobTitle: "Cashier", - payType: "HOURLY", - hourlyRate: { - amount: BigInt("2000"), - currency: "USD", - }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", - }, - ], - isOvertimeExempt: true, - version: 1, - createdAt: "2020-03-24T18:14:03Z", - updatedAt: "2020-03-24T18:14:03Z", - }, - }, - { - id: "7F5ZxsfRnkexhu1PTbfh", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "Ivy", - familyName: "Manny", - emailAddress: "email_address", - phoneNumber: "phone_number", - createdAt: "2020-03-24T01:09:25Z", - updatedAt: "2020-03-24T01:09:25Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - }, - { - id: "808X9HR72yKvVaigQXf4", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "John", - familyName: "Smith", - emailAddress: "john_smith@example.com", - phoneNumber: "+14155552671", - createdAt: "2020-03-24T18:14:02Z", - updatedAt: "2020-03-24T18:14:02Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - }, - { - id: "9MVDVoY4hazkWKGo_OuZ", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "Robert", - familyName: "Wen", - emailAddress: "r_wen@example.com", - phoneNumber: "+14155552671", - createdAt: "2020-03-24T18:14:00Z", - updatedAt: "2020-03-24T18:14:00Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - }, - { - id: "9UglUjOXQ13-hMFypCft", - referenceId: "reference_id", - isOwner: false, - status: "ACTIVE", - givenName: "Ashley", - familyName: "Simpson", - emailAddress: "asimpson@example.com", - phoneNumber: "+14155552671", - createdAt: "2020-03-24T18:14:00Z", - updatedAt: "2020-03-24T18:18:00Z", - assignedLocations: { - assignmentType: "ALL_CURRENT_AND_FUTURE_LOCATIONS", - }, - wageSetting: { - teamMemberId: "9UglUjOXQ13-hMFypCft", - jobAssignments: [ - { - jobTitle: "Cashier", - payType: "HOURLY", - hourlyRate: { - amount: BigInt("2000"), - currency: "USD", - }, - jobId: "VDNpRv8da51NU8qZFC5zDWpF", - }, - ], - isOvertimeExempt: true, - version: 1, - createdAt: "2020-03-24T18:14:00Z", - updatedAt: "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 }); diff --git a/tests/wire/terminal/actions.test.ts b/tests/wire/terminal/actions.test.ts index 13989967a..eb9a16fb0 100644 --- a/tests/wire/terminal/actions.test.ts +++ b/tests/wire/terminal/actions.test.ts @@ -172,211 +172,6 @@ describe("Actions", () => { }); }); - 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: { - createdAt: { - startAt: "2022-04-01T00:00:00.000Z", - }, - }, - sort: { - sortOrder: "DESC", - }, - }, - limit: 2, - }); - expect(response).toEqual({ - errors: [ - { - category: "API_ERROR", - code: "INTERNAL_SERVER_ERROR", - detail: "detail", - field: "field", - }, - ], - action: [ - { - id: "termapia:oBGWlAats8xWCiCE", - deviceId: "DEVICE_ID", - deadlineDuration: "PT5M", - status: "IN_PROGRESS", - cancelReason: "BUYER_CANCELED", - createdAt: "2022-04-08T15:14:04.895Z", - updatedAt: "2022-04-08T15:14:05.446Z", - appId: "APP_ID", - locationId: "LOCATION_ID", - type: "SAVE_CARD", - qrCodeOptions: { - title: "title", - body: "body", - barcodeContents: "barcode_contents", - }, - saveCardOptions: { - customerId: "CUSTOMER_ID", - referenceId: "user-id-1", - }, - signatureOptions: { - title: "title", - body: "body", - }, - confirmationOptions: { - title: "title", - body: "body", - agreeButtonText: "agree_button_text", - }, - receiptOptions: { - paymentId: "payment_id", - }, - dataCollectionOptions: { - title: "title", - body: "body", - inputType: "EMAIL", - }, - selectOptions: { - title: "title", - body: "body", - options: [ - { - referenceId: "reference_id", - title: "title", - }, - ], - }, - awaitNextAction: true, - awaitNextActionDuration: "await_next_action_duration", - }, - { - id: "termapia:K2NY2YSSml3lTiCE", - deviceId: "DEVICE_ID", - deadlineDuration: "PT5M", - status: "COMPLETED", - cancelReason: "BUYER_CANCELED", - createdAt: "2022-04-08T15:14:01.210Z", - updatedAt: "2022-04-08T15:14:09.861Z", - appId: "APP_ID", - locationId: "LOCATION_ID", - type: "SAVE_CARD", - qrCodeOptions: { - title: "title", - body: "body", - barcodeContents: "barcode_contents", - }, - saveCardOptions: { - customerId: "CUSTOMER_ID", - cardId: "ccof:CARD_ID", - referenceId: "user-id-1", - }, - signatureOptions: { - title: "title", - body: "body", - }, - confirmationOptions: { - title: "title", - body: "body", - agreeButtonText: "agree_button_text", - }, - receiptOptions: { - paymentId: "payment_id", - }, - dataCollectionOptions: { - title: "title", - body: "body", - inputType: "EMAIL", - }, - selectOptions: { - title: "title", - body: "body", - options: [ - { - referenceId: "reference_id", - title: "title", - }, - ], - }, - awaitNextAction: true, - awaitNextActionDuration: "await_next_action_duration", - }, - ], - cursor: "CURSOR", - }); - }); - test("get", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); diff --git a/tests/wire/terminal/checkouts.test.ts b/tests/wire/terminal/checkouts.test.ts index 39ba81c5b..240f2e98d 100644 --- a/tests/wire/terminal/checkouts.test.ts +++ b/tests/wire/terminal/checkouts.test.ts @@ -135,154 +135,6 @@ describe("Checkouts", () => { }); }); - 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", - amountMoney: { - amount: BigInt("2610"), - currency: "USD", - }, - referenceId: "id14467", - note: "A brief note", - orderId: "order_id", - deviceOptions: { - deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003", - skipReceiptScreen: false, - tipSettings: { - allowTipping: false, - }, - }, - deadlineDuration: "PT5M", - status: "COMPLETED", - cancelReason: "BUYER_CANCELED", - paymentIds: ["rXnhZzywrEk4vR6pw76fPZfgvaB"], - createdAt: "2020-03-31T18:13:15.921Z", - updatedAt: "2020-03-31T18:13:52.725Z", - appId: "APP_ID", - locationId: "location_id", - paymentType: "CARD_PRESENT", - teamMemberId: "team_member_id", - customerId: "customer_id", - statementDescriptionIdentifier: "statement_description_identifier", - }, - { - id: "XlOPTgcEhrbqO", - amountMoney: { - amount: BigInt("2610"), - currency: "USD", - }, - referenceId: "id41623", - note: "A brief note", - orderId: "order_id", - deviceOptions: { - deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003", - skipReceiptScreen: true, - tipSettings: { - allowTipping: false, - }, - }, - deadlineDuration: "PT5M", - status: "COMPLETED", - cancelReason: "BUYER_CANCELED", - paymentIds: ["VYBF861PaoKPP7Pih0TlbZiNvaB"], - createdAt: "2020-03-31T18:08:31.882Z", - updatedAt: "2020-03-31T18:08:41.635Z", - appId: "APP_ID", - locationId: "location_id", - paymentType: "CARD_PRESENT", - teamMemberId: "team_member_id", - customerId: "customer_id", - statementDescriptionIdentifier: "statement_description_identifier", - }, - ], - cursor: "RiTJqBoTuXlbLmmrPvEkX9iG7XnQ4W4RjGnH", - }); - }); - test("get", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); diff --git a/tests/wire/terminal/refunds.test.ts b/tests/wire/terminal/refunds.test.ts index c21c4f0fe..4f1692d2b 100644 --- a/tests/wire/terminal/refunds.test.ts +++ b/tests/wire/terminal/refunds.test.ts @@ -89,83 +89,6 @@ describe("Refunds", () => { }); }); - 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", - refundId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb", - paymentId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - orderId: "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", - amountMoney: { - amount: BigInt("111"), - currency: "CAD", - }, - reason: "Returning item", - deviceId: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", - deadlineDuration: "PT5M", - status: "COMPLETED", - cancelReason: "BUYER_CANCELED", - createdAt: "2020-09-29T15:21:46.771Z", - updatedAt: "2020-09-29T15:21:48.675Z", - appId: "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", - locationId: "76C9W6K8CNNQ5", - }, - ], - cursor: "cursor", - }); - }); - test("get", async () => { const server = mockServerPool.createServer(); const client = new SquareClient({ token: "test", environment: server.baseUrl }); diff --git a/tests/wire/transferOrders.test.ts b/tests/wire/transferOrders.test.ts new file mode 100644 index 000000000..c0bfc35d0 --- /dev/null +++ b/tests/wire/transferOrders.test.ts @@ -0,0 +1,744 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { mockServerPool } from "../mock-server/MockServerPool"; +import { SquareClient } from "../../src/Client"; + +describe("TransferOrders", () => { + test("create", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "65cc0586-3e82-384s-b524-3885cffd52", + transfer_order: { + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_123", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_456", + expected_at: "2025-11-09T05:00:00Z", + notes: "Example transfer order for inventory redistribution between locations", + tracking_number: "TRACK123456789", + created_by_team_member_id: "EXAMPLE_TEAM_MEMBER_ID_789", + line_items: [ + { item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_001", quantity_ordered: "5" }, + { item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_002", quantity_ordered: "3" }, + ], + }, + }; + const rawResponseBody = { + transfer_order: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_123", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_456", + status: "DRAFT", + created_at: "2025-01-15T10:30:00Z", + updated_at: "2025-01-15T10:30:00Z", + expected_at: "2025-11-09T05:00:00Z", + completed_at: "completed_at", + notes: "Example transfer order for inventory redistribution between locations", + tracking_number: "TRACK123456789", + created_by_team_member_id: "EXAMPLE_TEAM_MEMBER_ID_789", + line_items: [ + { + uid: "1", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_001", + quantity_ordered: "5", + quantity_pending: "5", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + { + uid: "2", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_002", + quantity_ordered: "3", + quantity_pending: "3", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + ], + version: BigInt(1753109537351), + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/transfer-orders") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transferOrders.create({ + idempotencyKey: "65cc0586-3e82-384s-b524-3885cffd52", + transferOrder: { + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + expectedAt: "2025-11-09T05:00:00Z", + notes: "Example transfer order for inventory redistribution between locations", + trackingNumber: "TRACK123456789", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "5", + }, + { + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + quantityOrdered: "3", + }, + ], + }, + }); + expect(response).toEqual({ + transferOrder: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + status: "DRAFT", + createdAt: "2025-01-15T10:30:00Z", + updatedAt: "2025-01-15T10:30:00Z", + expectedAt: "2025-11-09T05:00:00Z", + completedAt: "completed_at", + notes: "Example transfer order for inventory redistribution between locations", + trackingNumber: "TRACK123456789", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + uid: "1", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "5", + quantityPending: "5", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + { + uid: "2", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + quantityOrdered: "3", + quantityPending: "3", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + ], + version: BigInt("1753109537351"), + }, + 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 = { + transfer_order: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_123", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_456", + status: "STARTED", + created_at: "2025-01-15T10:30:00Z", + updated_at: "2025-01-15T10:35:00Z", + expected_at: "2025-11-09T05:00:00Z", + completed_at: "completed_at", + notes: "Example transfer order for inventory redistribution between locations", + tracking_number: "TRACK123456789", + created_by_team_member_id: "EXAMPLE_TEAM_MEMBER_ID_789", + line_items: [ + { + uid: "1", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_001", + quantity_ordered: "5", + quantity_pending: "5", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + { + uid: "2", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_002", + quantity_ordered: "3", + quantity_pending: "3", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + ], + version: BigInt(1753117449752), + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .get("/v2/transfer-orders/transfer_order_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transferOrders.get({ + transferOrderId: "transfer_order_id", + }); + expect(response).toEqual({ + transferOrder: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + status: "STARTED", + createdAt: "2025-01-15T10:30:00Z", + updatedAt: "2025-01-15T10:35:00Z", + expectedAt: "2025-11-09T05:00:00Z", + completedAt: "completed_at", + notes: "Example transfer order for inventory redistribution between locations", + trackingNumber: "TRACK123456789", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + uid: "1", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "5", + quantityPending: "5", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + { + uid: "2", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + quantityOrdered: "3", + quantityPending: "3", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + ], + version: BigInt("1753117449752"), + }, + 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 = { + idempotency_key: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + transfer_order: { + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_789", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_101", + expected_at: "2025-11-10T08:00:00Z", + notes: "Updated: Priority transfer due to low stock at destination", + tracking_number: "TRACK987654321", + line_items: [ + { uid: "1", quantity_ordered: "7" }, + { item_variation_id: "EXAMPLE_NEW_ITEM_VARIATION_ID_003", quantity_ordered: "2" }, + { uid: "2", remove: true }, + ], + }, + version: BigInt(1753109537351), + }; + const rawResponseBody = { + transfer_order: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_789", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_101", + status: "DRAFT", + created_at: "2025-01-15T10:30:00Z", + updated_at: "2025-01-15T11:15:00Z", + expected_at: "2025-11-10T08:00:00Z", + completed_at: "completed_at", + notes: "Updated: Priority transfer due to low stock at destination", + tracking_number: "TRACK987654321", + created_by_team_member_id: "EXAMPLE_TEAM_MEMBER_ID_789", + line_items: [ + { + uid: "1", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_001", + quantity_ordered: "7", + quantity_pending: "7", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + { + uid: "3", + item_variation_id: "EXAMPLE_NEW_ITEM_VARIATION_ID_003", + quantity_ordered: "2", + quantity_pending: "2", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + ], + version: BigInt(1753122900456), + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .put("/v2/transfer-orders/transfer_order_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transferOrders.update({ + transferOrderId: "transfer_order_id", + idempotencyKey: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + transferOrder: { + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_789", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_101", + expectedAt: "2025-11-10T08:00:00Z", + notes: "Updated: Priority transfer due to low stock at destination", + trackingNumber: "TRACK987654321", + lineItems: [ + { + uid: "1", + quantityOrdered: "7", + }, + { + itemVariationId: "EXAMPLE_NEW_ITEM_VARIATION_ID_003", + quantityOrdered: "2", + }, + { + uid: "2", + remove: true, + }, + ], + }, + version: BigInt("1753109537351"), + }); + expect(response).toEqual({ + transferOrder: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_789", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_101", + status: "DRAFT", + createdAt: "2025-01-15T10:30:00Z", + updatedAt: "2025-01-15T11:15:00Z", + expectedAt: "2025-11-10T08:00:00Z", + completedAt: "completed_at", + notes: "Updated: Priority transfer due to low stock at destination", + trackingNumber: "TRACK987654321", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + uid: "1", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "7", + quantityPending: "7", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + { + uid: "3", + itemVariationId: "EXAMPLE_NEW_ITEM_VARIATION_ID_003", + quantityOrdered: "2", + quantityPending: "2", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + ], + version: BigInt("1753122900456"), + }, + 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/transfer-orders/transfer_order_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transferOrders.delete({ + transferOrderId: "transfer_order_id", + version: BigInt("1000000"), + }); + 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 = { + idempotency_key: "65cc0586-3e82-4d08-b524-3885cffd52", + version: BigInt(1753117449752), + }; + const rawResponseBody = { + transfer_order: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_123", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_456", + status: "CANCELED", + created_at: "2025-01-15T10:30:00Z", + updated_at: "2025-01-15T10:45:00Z", + expected_at: "2025-11-09T05:00:00Z", + completed_at: "2025-01-15T10:45:00Z", + notes: "Example transfer order for inventory redistribution between locations", + tracking_number: "TRACK123456789", + created_by_team_member_id: "EXAMPLE_TEAM_MEMBER_ID_789", + line_items: [ + { + uid: "1", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_001", + quantity_ordered: "5", + quantity_pending: "0", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "5", + }, + { + uid: "2", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_002", + quantity_ordered: "3", + quantity_pending: "0", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "3", + }, + ], + version: BigInt(1753117461842), + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/transfer-orders/transfer_order_id/cancel") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transferOrders.cancel({ + transferOrderId: "transfer_order_id", + idempotencyKey: "65cc0586-3e82-4d08-b524-3885cffd52", + version: BigInt("1753117449752"), + }); + expect(response).toEqual({ + transferOrder: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + status: "CANCELED", + createdAt: "2025-01-15T10:30:00Z", + updatedAt: "2025-01-15T10:45:00Z", + expectedAt: "2025-11-09T05:00:00Z", + completedAt: "2025-01-15T10:45:00Z", + notes: "Example transfer order for inventory redistribution between locations", + trackingNumber: "TRACK123456789", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + uid: "1", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "5", + quantityPending: "0", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "5", + }, + { + uid: "2", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + quantityOrdered: "3", + quantityPending: "0", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "3", + }, + ], + version: BigInt("1753117461842"), + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("receive", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { + idempotency_key: "EXAMPLE_IDEMPOTENCY_KEY_101", + receipt: { + line_items: [ + { + transfer_order_line_uid: "transfer_order_line_uid", + quantity_received: "3", + quantity_damaged: "1", + quantity_canceled: "1", + }, + { + transfer_order_line_uid: "transfer_order_line_uid", + quantity_received: "2", + quantity_canceled: "1", + }, + ], + }, + version: BigInt(1753118664873), + }; + const rawResponseBody = { + transfer_order: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_123", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_456", + status: "COMPLETED", + created_at: "2025-01-15T10:30:00Z", + updated_at: "2025-01-15T10:55:00Z", + expected_at: "2025-11-09T05:00:00Z", + completed_at: "2025-01-15T10:55:00Z", + notes: "Example transfer order for inventory redistribution between locations", + tracking_number: "TRACK123456789", + created_by_team_member_id: "EXAMPLE_TEAM_MEMBER_ID_789", + line_items: [ + { + uid: "1", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_001", + quantity_ordered: "5", + quantity_pending: "0", + quantity_received: "3", + quantity_damaged: "1", + quantity_canceled: "1", + }, + { + uid: "2", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_002", + quantity_ordered: "3", + quantity_pending: "0", + quantity_received: "2", + quantity_damaged: "0", + quantity_canceled: "1", + }, + ], + version: BigInt(1753118667248), + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/transfer-orders/transfer_order_id/receive") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transferOrders.receive({ + transferOrderId: "transfer_order_id", + idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_101", + receipt: { + lineItems: [ + { + transferOrderLineUid: "transfer_order_line_uid", + quantityReceived: "3", + quantityDamaged: "1", + quantityCanceled: "1", + }, + { + transferOrderLineUid: "transfer_order_line_uid", + quantityReceived: "2", + quantityCanceled: "1", + }, + ], + }, + version: BigInt("1753118664873"), + }); + expect(response).toEqual({ + transferOrder: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + status: "COMPLETED", + createdAt: "2025-01-15T10:30:00Z", + updatedAt: "2025-01-15T10:55:00Z", + expectedAt: "2025-11-09T05:00:00Z", + completedAt: "2025-01-15T10:55:00Z", + notes: "Example transfer order for inventory redistribution between locations", + trackingNumber: "TRACK123456789", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + uid: "1", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "5", + quantityPending: "0", + quantityReceived: "3", + quantityDamaged: "1", + quantityCanceled: "1", + }, + { + uid: "2", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + quantityOrdered: "3", + quantityPending: "0", + quantityReceived: "2", + quantityDamaged: "0", + quantityCanceled: "1", + }, + ], + version: BigInt("1753118667248"), + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); + + test("start", async () => { + const server = mockServerPool.createServer(); + const client = new SquareClient({ token: "test", environment: server.baseUrl }); + const rawRequestBody = { idempotency_key: "EXAMPLE_IDEMPOTENCY_KEY_789", version: BigInt(1753109537351) }; + const rawResponseBody = { + transfer_order: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + source_location_id: "EXAMPLE_SOURCE_LOCATION_ID_123", + destination_location_id: "EXAMPLE_DEST_LOCATION_ID_456", + status: "STARTED", + created_at: "2025-01-15T10:30:00Z", + updated_at: "2025-01-15T10:32:00Z", + expected_at: "2025-11-09T05:00:00Z", + completed_at: "completed_at", + notes: "Example transfer order for inventory redistribution between locations", + tracking_number: "TRACK123456789", + created_by_team_member_id: "EXAMPLE_TEAM_MEMBER_ID_789", + line_items: [ + { + uid: "1", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_001", + quantity_ordered: "5", + quantity_pending: "5", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + { + uid: "2", + item_variation_id: "EXAMPLE_ITEM_VARIATION_ID_002", + quantity_ordered: "3", + quantity_pending: "3", + quantity_received: "0", + quantity_damaged: "0", + quantity_canceled: "0", + }, + ], + version: BigInt(1753118664873), + }, + errors: [{ category: "API_ERROR", code: "INTERNAL_SERVER_ERROR", detail: "detail", field: "field" }], + }; + server + .mockEndpoint() + .post("/v2/transfer-orders/transfer_order_id/start") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transferOrders.start({ + transferOrderId: "transfer_order_id", + idempotencyKey: "EXAMPLE_IDEMPOTENCY_KEY_789", + version: BigInt("1753109537351"), + }); + expect(response).toEqual({ + transferOrder: { + id: "EXAMPLE_TRANSFER_ORDER_ID_123", + sourceLocationId: "EXAMPLE_SOURCE_LOCATION_ID_123", + destinationLocationId: "EXAMPLE_DEST_LOCATION_ID_456", + status: "STARTED", + createdAt: "2025-01-15T10:30:00Z", + updatedAt: "2025-01-15T10:32:00Z", + expectedAt: "2025-11-09T05:00:00Z", + completedAt: "completed_at", + notes: "Example transfer order for inventory redistribution between locations", + trackingNumber: "TRACK123456789", + createdByTeamMemberId: "EXAMPLE_TEAM_MEMBER_ID_789", + lineItems: [ + { + uid: "1", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_001", + quantityOrdered: "5", + quantityPending: "5", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + { + uid: "2", + itemVariationId: "EXAMPLE_ITEM_VARIATION_ID_002", + quantityOrdered: "3", + quantityPending: "3", + quantityReceived: "0", + quantityDamaged: "0", + quantityCanceled: "0", + }, + ], + version: BigInt("1753118664873"), + }, + errors: [ + { + category: "API_ERROR", + code: "INTERNAL_SERVER_ERROR", + detail: "detail", + field: "field", + }, + ], + }); + }); +}); diff --git a/tests/wire/v1Transactions.test.ts b/tests/wire/v1Transactions.test.ts index 5690f9569..0c9a2b361 100644 --- a/tests/wire/v1Transactions.test.ts +++ b/tests/wire/v1Transactions.test.ts @@ -77,6 +77,9 @@ describe("V1Transactions", () => { const response = await client.v1Transactions.v1ListOrders({ locationId: "location_id", + order: "DESC", + limit: 1, + batchToken: "batch_token", }); expect(response).toEqual([ { diff --git a/tests/wire/vendors.test.ts b/tests/wire/vendors.test.ts index 13f6fcd36..3f6c15c2f 100644 --- a/tests/wire/vendors.test.ts +++ b/tests/wire/vendors.test.ts @@ -565,95 +565,6 @@ describe("Vendors", () => { }); }); - 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", - createdAt: "2022-03-16T10:21:54.859Z", - updatedAt: "2022-03-16T10:21:54.859Z", - name: "Joe's Fresh Seafood", - address: { - addressLine1: "505 Electric Ave", - addressLine2: "Suite 600", - locality: "New York", - administrativeDistrictLevel1: "NY", - postalCode: "10003", - country: "US", - }, - contacts: [ - { - id: "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", - name: "Joe Burrow", - emailAddress: "joe@joesfreshseafood.com", - phoneNumber: "1-212-555-4250", - ordinal: 1, - }, - ], - accountNumber: "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 }); diff --git a/tests/wire/webhooks/eventTypes.test.ts b/tests/wire/webhooks/eventTypes.test.ts index 6d2b9b8d9..440ec0805 100644 --- a/tests/wire/webhooks/eventTypes.test.ts +++ b/tests/wire/webhooks/eventTypes.test.ts @@ -29,7 +29,9 @@ describe("EventTypes", () => { .jsonBody(rawResponseBody) .build(); - const response = await client.webhooks.eventTypes.list(); + const response = await client.webhooks.eventTypes.list({ + apiVersion: "api_version", + }); expect(response).toEqual({ errors: [ {