Skip to content

Commit 8afb6fe

Browse files
authored
Merge pull request #144 from square/release/35.0.0
Generated PR for Release: 35.0.0
2 parents 5dbb827 + 7df771f commit 8afb6fe

File tree

144 files changed

+2089
-2316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2089
-2316
lines changed

doc/api/checkout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ async listPaymentLinks(
368368

369369
| Parameter | Type | Tags | Description |
370370
| --- | --- | --- | --- |
371-
| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>If a cursor is not provided, the endpoint returns the first page of the results.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
371+
| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>If a cursor is not provided, the endpoint returns the first page of the results.<br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
372372
| `limit` | `number \| undefined` | Query, Optional | A limit on the number of results to return per page. The limit is advisory and<br>the implementation might return more or less results. If the supplied limit is negative, zero, or<br>greater than the maximum limit of 1000, it is ignored.<br><br>Default value: `100` |
373373
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
374374

doc/api/customers.md

Lines changed: 261 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ const customersApi = client.customersApi;
1212

1313
* [List Customers](../../doc/api/customers.md#list-customers)
1414
* [Create Customer](../../doc/api/customers.md#create-customer)
15+
* [Bulk Create Customers](../../doc/api/customers.md#bulk-create-customers)
16+
* [Bulk Delete Customers](../../doc/api/customers.md#bulk-delete-customers)
17+
* [Bulk Retrieve Customers](../../doc/api/customers.md#bulk-retrieve-customers)
18+
* [Bulk Update Customers](../../doc/api/customers.md#bulk-update-customers)
1519
* [Search Customers](../../doc/api/customers.md#search-customers)
1620
* [Delete Customer](../../doc/api/customers.md#delete-customer)
1721
* [Retrieve Customer](../../doc/api/customers.md#retrieve-customer)
@@ -152,6 +156,261 @@ try {
152156
```
153157

154158

159+
# Bulk Create Customers
160+
161+
Creates multiple [customer profiles](../../doc/models/customer.md) for a business.
162+
163+
This endpoint takes a map of individual create requests and returns a map of responses.
164+
165+
You must provide at least one of the following values in each create request:
166+
167+
- `given_name`
168+
- `family_name`
169+
- `company_name`
170+
- `email_address`
171+
- `phone_number`
172+
173+
```ts
174+
async bulkCreateCustomers(
175+
body: BulkCreateCustomersRequest,
176+
requestOptions?: RequestOptions
177+
): Promise<ApiResponse<BulkCreateCustomersResponse>>
178+
```
179+
180+
## Parameters
181+
182+
| Parameter | Type | Tags | Description |
183+
| --- | --- | --- | --- |
184+
| `body` | [`BulkCreateCustomersRequest`](../../doc/models/bulk-create-customers-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
185+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
186+
187+
## Response Type
188+
189+
[`BulkCreateCustomersResponse`](../../doc/models/bulk-create-customers-response.md)
190+
191+
## Example Usage
192+
193+
```ts
194+
const body: BulkCreateCustomersRequest = {
195+
customers: {
196+
'8bb76c4f-e35d-4c5b-90de-1194cd9179f0': {
197+
givenName: 'Amelia',
198+
familyName: 'Earhart',
199+
emailAddress: '[email protected]',
200+
address: {
201+
addressLine1: '500 Electric Ave',
202+
addressLine2: 'Suite 600',
203+
locality: 'New York',
204+
administrativeDistrictLevel1: 'NY',
205+
postalCode: '10003',
206+
country: 'US',
207+
},
208+
phoneNumber: '+1-212-555-4240',
209+
referenceId: 'YOUR_REFERENCE_ID',
210+
note: 'a customer',
211+
},
212+
'd1689f23-b25d-4932-b2f0-aed00f5e2029': {
213+
givenName: 'Marie',
214+
familyName: 'Curie',
215+
emailAddress: '[email protected]',
216+
address: {
217+
addressLine1: '500 Electric Ave',
218+
addressLine2: 'Suite 601',
219+
locality: 'New York',
220+
administrativeDistrictLevel1: 'NY',
221+
postalCode: '10003',
222+
country: 'US',
223+
},
224+
phoneNumber: '+1-212-444-4240',
225+
referenceId: 'YOUR_REFERENCE_ID',
226+
note: 'another customer',
227+
}
228+
},
229+
};
230+
231+
try {
232+
// @ts-expect-error: unused variables
233+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
234+
const { result, ...httpResponse } = await customersApi.bulkCreateCustomers(body);
235+
// Get more response info...
236+
// const { statusCode, headers } = httpResponse;
237+
} catch (error) {
238+
if (error instanceof ApiError) {
239+
// @ts-expect-error: unused variables
240+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
241+
const errors = error.result;
242+
// const { statusCode, headers } = error;
243+
}
244+
}
245+
```
246+
247+
248+
# Bulk Delete Customers
249+
250+
Deletes multiple customer profiles.
251+
252+
The endpoint takes a list of customer IDs and returns a map of responses.
253+
254+
```ts
255+
async bulkDeleteCustomers(
256+
body: BulkDeleteCustomersRequest,
257+
requestOptions?: RequestOptions
258+
): Promise<ApiResponse<BulkDeleteCustomersResponse>>
259+
```
260+
261+
## Parameters
262+
263+
| Parameter | Type | Tags | Description |
264+
| --- | --- | --- | --- |
265+
| `body` | [`BulkDeleteCustomersRequest`](../../doc/models/bulk-delete-customers-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
266+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
267+
268+
## Response Type
269+
270+
[`BulkDeleteCustomersResponse`](../../doc/models/bulk-delete-customers-response.md)
271+
272+
## Example Usage
273+
274+
```ts
275+
const body: BulkDeleteCustomersRequest = {
276+
customerIds: [
277+
'8DDA5NZVBZFGAX0V3HPF81HHE0',
278+
'N18CPRVXR5214XPBBA6BZQWF3C',
279+
'2GYD7WNXF7BJZW1PMGNXZ3Y8M8'
280+
],
281+
};
282+
283+
try {
284+
// @ts-expect-error: unused variables
285+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
286+
const { result, ...httpResponse } = await customersApi.bulkDeleteCustomers(body);
287+
// Get more response info...
288+
// const { statusCode, headers } = httpResponse;
289+
} catch (error) {
290+
if (error instanceof ApiError) {
291+
// @ts-expect-error: unused variables
292+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
293+
const errors = error.result;
294+
// const { statusCode, headers } = error;
295+
}
296+
}
297+
```
298+
299+
300+
# Bulk Retrieve Customers
301+
302+
Retrieves multiple customer profiles.
303+
304+
This endpoint takes a list of customer IDs and returns a map of responses.
305+
306+
```ts
307+
async bulkRetrieveCustomers(
308+
body: BulkRetrieveCustomersRequest,
309+
requestOptions?: RequestOptions
310+
): Promise<ApiResponse<BulkRetrieveCustomersResponse>>
311+
```
312+
313+
## Parameters
314+
315+
| Parameter | Type | Tags | Description |
316+
| --- | --- | --- | --- |
317+
| `body` | [`BulkRetrieveCustomersRequest`](../../doc/models/bulk-retrieve-customers-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
318+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
319+
320+
## Response Type
321+
322+
[`BulkRetrieveCustomersResponse`](../../doc/models/bulk-retrieve-customers-response.md)
323+
324+
## Example Usage
325+
326+
```ts
327+
const body: BulkRetrieveCustomersRequest = {
328+
customerIds: [
329+
'8DDA5NZVBZFGAX0V3HPF81HHE0',
330+
'N18CPRVXR5214XPBBA6BZQWF3C',
331+
'2GYD7WNXF7BJZW1PMGNXZ3Y8M8'
332+
],
333+
};
334+
335+
try {
336+
// @ts-expect-error: unused variables
337+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
338+
const { result, ...httpResponse } = await customersApi.bulkRetrieveCustomers(body);
339+
// Get more response info...
340+
// const { statusCode, headers } = httpResponse;
341+
} catch (error) {
342+
if (error instanceof ApiError) {
343+
// @ts-expect-error: unused variables
344+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
345+
const errors = error.result;
346+
// const { statusCode, headers } = error;
347+
}
348+
}
349+
```
350+
351+
352+
# Bulk Update Customers
353+
354+
Updates multiple customer profiles.
355+
356+
This endpoint takes a map of individual update requests and returns a map of responses.
357+
358+
You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](../../doc/api/cards.md) or [Gift Cards API](../../doc/api/gift-cards.md).
359+
360+
```ts
361+
async bulkUpdateCustomers(
362+
body: BulkUpdateCustomersRequest,
363+
requestOptions?: RequestOptions
364+
): Promise<ApiResponse<BulkUpdateCustomersResponse>>
365+
```
366+
367+
## Parameters
368+
369+
| Parameter | Type | Tags | Description |
370+
| --- | --- | --- | --- |
371+
| `body` | [`BulkUpdateCustomersRequest`](../../doc/models/bulk-update-customers-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
372+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
373+
374+
## Response Type
375+
376+
[`BulkUpdateCustomersResponse`](../../doc/models/bulk-update-customers-response.md)
377+
378+
## Example Usage
379+
380+
```ts
381+
const body: BulkUpdateCustomersRequest = {
382+
customers: {
383+
'8DDA5NZVBZFGAX0V3HPF81HHE0': {
384+
emailAddress: '[email protected]',
385+
phoneNumber: 'phone_number2',
386+
note: 'updated customer note',
387+
version: BigInt(2),
388+
},
389+
'N18CPRVXR5214XPBBA6BZQWF3C': {
390+
givenName: 'Marie',
391+
familyName: 'Curie',
392+
version: BigInt(0),
393+
}
394+
},
395+
};
396+
397+
try {
398+
// @ts-expect-error: unused variables
399+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
400+
const { result, ...httpResponse } = await customersApi.bulkUpdateCustomers(body);
401+
// Get more response info...
402+
// const { statusCode, headers } = httpResponse;
403+
} catch (error) {
404+
if (error instanceof ApiError) {
405+
// @ts-expect-error: unused variables
406+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
407+
const errors = error.result;
408+
// const { statusCode, headers } = error;
409+
}
410+
}
411+
```
412+
413+
155414
# Search Customers
156415

157416
Searches the customer profiles associated with a Square account using one or more supported query filters.
@@ -236,9 +495,6 @@ try {
236495

237496
Deletes a customer profile from a business. This operation also unlinks any associated cards on file.
238497

239-
As a best practice, include the `version` field in the request to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control.
240-
If included, the value must be set to the current version of the customer profile.
241-
242498
To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
243499

244500
```ts
@@ -330,11 +586,7 @@ try {
330586
# Update Customer
331587

332588
Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request.
333-
To add or update a field, specify the new value. To remove a field, specify `null`
334-
(recommended) or specify an empty string (string fields only).
335-
336-
As a best practice, include the `version` field in the request to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control.
337-
If included, the value must be set to the current version of the customer profile.
589+
To add or update a field, specify the new value. To remove a field, specify `null`.
338590

339591
To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
340592

@@ -367,7 +619,7 @@ const customerId = 'customer_id8';
367619

368620
const body: UpdateCustomerRequest = {
369621
emailAddress: '[email protected]',
370-
phoneNumber: '',
622+
phoneNumber: 'phone_number2',
371623
note: 'updated customer note',
372624
version: BigInt(2),
373625
};

doc/api/invoices.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,12 @@ nothing. Square also makes the invoice available on a Square-hosted invoice page
574574

575575
The invoice `status` also changes from `DRAFT` to a status
576576
based on the invoice configuration. For example, the status changes to `UNPAID` if
577-
Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on file for a portion of the
577+
Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the
578578
invoice amount.
579579

580+
In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ`
581+
and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments.
582+
580583
```ts
581584
async publishInvoice(
582585
invoiceId: string,

doc/api/locations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const locationsApi = client.locationsApi;
1919
# List Locations
2020

2121
Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
22-
including those with an inactive status.
22+
including those with an inactive status. Locations are listed alphabetically by `name`.
2323

2424
```ts
2525
async listLocations(

0 commit comments

Comments
 (0)