-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from square/release/35.0.0.20240222
Generated PR for Release: 35.0.0.20240222
- Loading branch information
Showing
106 changed files
with
1,417 additions
and
1,858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ customers_api = client.customers | |
|
||
* [List Customers](../../doc/api/customers.md#list-customers) | ||
* [Create Customer](../../doc/api/customers.md#create-customer) | ||
* [Bulk Create Customers](../../doc/api/customers.md#bulk-create-customers) | ||
* [Bulk Delete Customers](../../doc/api/customers.md#bulk-delete-customers) | ||
* [Bulk Retrieve Customers](../../doc/api/customers.md#bulk-retrieve-customers) | ||
* [Bulk Update Customers](../../doc/api/customers.md#bulk-update-customers) | ||
* [Search Customers](../../doc/api/customers.md#search-customers) | ||
* [Delete Customer](../../doc/api/customers.md#delete-customer) | ||
* [Retrieve Customer](../../doc/api/customers.md#retrieve-customer) | ||
|
@@ -128,6 +132,221 @@ elif result.is_error(): | |
``` | ||
|
||
|
||
# Bulk Create Customers | ||
|
||
Creates multiple [customer profiles](../../doc/models/customer.md) for a business. | ||
|
||
This endpoint takes a map of individual create requests and returns a map of responses. | ||
|
||
You must provide at least one of the following values in each create request: | ||
|
||
- `given_name` | ||
- `family_name` | ||
- `company_name` | ||
- `email_address` | ||
- `phone_number` | ||
|
||
```python | ||
def bulk_create_customers(self, | ||
body) | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Tags | Description | | ||
| --- | --- | --- | --- | | ||
| `body` | [`Bulk Create Customers Request`](../../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. | | ||
|
||
## Response Type | ||
|
||
This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Bulk Create Customers Response`](../../doc/models/bulk-create-customers-response.md). | ||
|
||
## Example Usage | ||
|
||
```python | ||
body = { | ||
'customers': { | ||
'8bb76c4f-e35d-4c5b-90de-1194cd9179f0': { | ||
'given_name': 'Amelia', | ||
'family_name': 'Earhart', | ||
'email_address': '[email protected]', | ||
'address': { | ||
'address_line_1': '500 Electric Ave', | ||
'address_line_2': 'Suite 600', | ||
'locality': 'New York', | ||
'administrative_district_level_1': 'NY', | ||
'postal_code': '10003', | ||
'country': 'US' | ||
}, | ||
'phone_number': '+1-212-555-4240', | ||
'reference_id': 'YOUR_REFERENCE_ID', | ||
'note': 'a customer' | ||
}, | ||
'd1689f23-b25d-4932-b2f0-aed00f5e2029': { | ||
'given_name': 'Marie', | ||
'family_name': 'Curie', | ||
'email_address': '[email protected]', | ||
'address': { | ||
'address_line_1': '500 Electric Ave', | ||
'address_line_2': 'Suite 601', | ||
'locality': 'New York', | ||
'administrative_district_level_1': 'NY', | ||
'postal_code': '10003', | ||
'country': 'US' | ||
}, | ||
'phone_number': '+1-212-444-4240', | ||
'reference_id': 'YOUR_REFERENCE_ID', | ||
'note': 'another customer' | ||
} | ||
} | ||
} | ||
|
||
result = customers_api.bulk_create_customers(body) | ||
print(result) | ||
|
||
if result.is_success(): | ||
print(result.body) | ||
elif result.is_error(): | ||
print(result.errors) | ||
``` | ||
|
||
|
||
# Bulk Delete Customers | ||
|
||
Deletes multiple customer profiles. | ||
|
||
The endpoint takes a list of customer IDs and returns a map of responses. | ||
|
||
```python | ||
def bulk_delete_customers(self, | ||
body) | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Tags | Description | | ||
| --- | --- | --- | --- | | ||
| `body` | [`Bulk Delete Customers Request`](../../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. | | ||
|
||
## Response Type | ||
|
||
This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Bulk Delete Customers Response`](../../doc/models/bulk-delete-customers-response.md). | ||
|
||
## Example Usage | ||
|
||
```python | ||
body = { | ||
'customer_ids': [ | ||
'8DDA5NZVBZFGAX0V3HPF81HHE0', | ||
'N18CPRVXR5214XPBBA6BZQWF3C', | ||
'2GYD7WNXF7BJZW1PMGNXZ3Y8M8' | ||
] | ||
} | ||
|
||
result = customers_api.bulk_delete_customers(body) | ||
print(result) | ||
|
||
if result.is_success(): | ||
print(result.body) | ||
elif result.is_error(): | ||
print(result.errors) | ||
``` | ||
|
||
|
||
# Bulk Retrieve Customers | ||
|
||
Retrieves multiple customer profiles. | ||
|
||
This endpoint takes a list of customer IDs and returns a map of responses. | ||
|
||
```python | ||
def bulk_retrieve_customers(self, | ||
body) | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Tags | Description | | ||
| --- | --- | --- | --- | | ||
| `body` | [`Bulk Retrieve Customers Request`](../../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. | | ||
|
||
## Response Type | ||
|
||
This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Bulk Retrieve Customers Response`](../../doc/models/bulk-retrieve-customers-response.md). | ||
|
||
## Example Usage | ||
|
||
```python | ||
body = { | ||
'customer_ids': [ | ||
'8DDA5NZVBZFGAX0V3HPF81HHE0', | ||
'N18CPRVXR5214XPBBA6BZQWF3C', | ||
'2GYD7WNXF7BJZW1PMGNXZ3Y8M8' | ||
] | ||
} | ||
|
||
result = customers_api.bulk_retrieve_customers(body) | ||
print(result) | ||
|
||
if result.is_success(): | ||
print(result.body) | ||
elif result.is_error(): | ||
print(result.errors) | ||
``` | ||
|
||
|
||
# Bulk Update Customers | ||
|
||
Updates multiple customer profiles. | ||
|
||
This endpoint takes a map of individual update requests and returns a map of responses. | ||
|
||
You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](../../doc/api/cards.md) or [Gift Cards API](../../doc/api/gift-cards.md). | ||
|
||
```python | ||
def bulk_update_customers(self, | ||
body) | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Tags | Description | | ||
| --- | --- | --- | --- | | ||
| `body` | [`Bulk Update Customers Request`](../../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. | | ||
|
||
## Response Type | ||
|
||
This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Bulk Update Customers Response`](../../doc/models/bulk-update-customers-response.md). | ||
|
||
## Example Usage | ||
|
||
```python | ||
body = { | ||
'customers': { | ||
'8DDA5NZVBZFGAX0V3HPF81HHE0': { | ||
'email_address': '[email protected]', | ||
'phone_number': 'phone_number2', | ||
'note': 'updated customer note', | ||
'version': 2 | ||
}, | ||
'N18CPRVXR5214XPBBA6BZQWF3C': { | ||
'given_name': 'Marie', | ||
'family_name': 'Curie', | ||
'version': 0 | ||
} | ||
} | ||
} | ||
|
||
result = customers_api.bulk_update_customers(body) | ||
print(result) | ||
|
||
if result.is_success(): | ||
print(result.body) | ||
elif result.is_error(): | ||
print(result.errors) | ||
``` | ||
|
||
|
||
# Search Customers | ||
|
||
Searches the customer profiles associated with a Square account using one or more supported query filters. | ||
|
@@ -202,9 +421,6 @@ elif result.is_error(): | |
|
||
Deletes a customer profile from a business. This operation also unlinks any associated cards on file. | ||
|
||
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. | ||
If included, the value must be set to the current version of the customer profile. | ||
|
||
To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. | ||
|
||
```python | ||
|
@@ -276,11 +492,7 @@ elif result.is_error(): | |
# Update Customer | ||
|
||
Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. | ||
To add or update a field, specify the new value. To remove a field, specify `null` | ||
(recommended) or specify an empty string (string fields only). | ||
|
||
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. | ||
If included, the value must be set to the current version of the customer profile. | ||
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. | ||
|
||
|
@@ -310,7 +522,7 @@ customer_id = 'customer_id8' | |
|
||
body = { | ||
'email_address': '[email protected]', | ||
'phone_number': '', | ||
'phone_number': 'phone_number2', | ||
'note': 'updated customer note', | ||
'version': 2 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.