Skip to content

Commit 41ee4ba

Browse files
Merge pull request #12 from square/release/3.20191120.0
Release 3.20191120.0
2 parents 2de0061 + 2fe1884 commit 41ee4ba

211 files changed

Lines changed: 2167 additions & 781 deletions

File tree

Some content is hidden

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323
notifications:
2424
slack:
2525
secure: Gh641zg9Ch+sFZCWwxdi6ZPQk1csUGcwenfL9cgs3op+BfQOJbBgw3LWGqYVBBgTowO8ibg/q/kapzg9lGjLxQOVNPQZci7dFB5WHmdVwUoSoLxQCZcCa0IQkk0XfI7UYKBnuoqpBsEe6eXKyvdFEUrx51Z4XwFtjLpINYZ4DY2NmsA9QihFJBSqhB4si7l0yON2Q8JR4Dc6PXCLn+LrzNliHCgzWveF/FtRQocT4uj3e3frySdOHmb6fV2yGb8Z/jR01s/97cyX6Y37BWyGrZFTfyDb+V5lcAzJdgkYhLaeLo8coKwZwgWOu6Eo6EeQ4/Y/XKr9BjdKmyWY0Z2gc4FPWrHvfrGdUsSfr2ECdApMsNcNPeTtvAc2xe8wDVbASLdrg5pcZCba5PZBgZ4KvQ7Rg7olo9dbHRbUddy0VFM1Td9heBKXV9gL1bkv1eLMa400uGKoA6A7lim8AkjEBTiLQ3pZOalZGDUop5iDD8pmnwZ9rd51LI03hSIrC75j1ePlqxwQ6z6R2xjwCHznNveiI/CQGtLr4vMuexGG//afK8/WGlnVch+CpEkC/aEok/0L3ik3l6OgfXuHItgY3SrUny18uYNQK4NXPo+PT+m82qzSONpHxhdkYXsz8GP5/Rn5v2wUShLUKwU/EKi20fjcI1jO/JAW8gcJAwfBChA=
26-
on_success: change
26+
on_success: change
2727
template:
2828
- "@oncall"
2929
- "Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>) of %{repository_slug}@%{branch} in PR <%{pull_request_url}|#%{pull_request_number}> by %{author} %{result} in %{duration}"

doc/apple-pay.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This endpoint provides an easy way for platform developers to bulk activate
1818
Web Apple Pay with Square for merchants using their platform.
1919

2020
To learn more about Apple Pay on Web see the Apple Pay section in the
21-
[Embedding the Square Payment Form](https://developer.squareup.com/docs/payment-form/add-digital-wallets/apple-pay) guide.
21+
[Square Payment Form Walkthrough](https://developer.squareup.com/docs/docs/payment-form/payment-form-walkthrough).
2222

2323
```python
2424
def register_domain(self,

doc/catalog.md

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ catalog_api = client.catalog
1313
* [Batch Delete Catalog Objects](/doc/catalog.md#batch-delete-catalog-objects)
1414
* [Batch Retrieve Catalog Objects](/doc/catalog.md#batch-retrieve-catalog-objects)
1515
* [Batch Upsert Catalog Objects](/doc/catalog.md#batch-upsert-catalog-objects)
16+
* [Create Catalog Image](/doc/catalog.md#create-catalog-image)
1617
* [Catalog Info](/doc/catalog.md#catalog-info)
1718
* [List Catalog](/doc/catalog.md#list-catalog)
1819
* [Upsert Catalog Object](/doc/catalog.md#upsert-catalog-object)
@@ -199,6 +200,82 @@ elif result.is_error():
199200
print(result.errors)
200201
```
201202

203+
## Create Catalog Image
204+
205+
Upload an image file to create a new [CatalogImage](#type-catalogimage) for an existing
206+
[CatalogObject](#type-catalogobject). Images can be uploaded and linked in this request or created independently
207+
(without an object assignment) and linked to a [CatalogObject](#type-catalogobject) at a later time.
208+
209+
CreateCatalogImage accepts HTTP multipart/form-data requests with a JSON part and an image file part in
210+
JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. The following is an example of such an HTTP request:
211+
212+
```
213+
POST /v2/catalog/images
214+
Accept: application/json
215+
Content-Type: multipart/form-data;boundary="boundary"
216+
Square-Version: XXXX-XX-XX
217+
Authorization: Bearer {ACCESS_TOKEN}
218+
219+
--boundary
220+
Content-Disposition: form-data; name="request"
221+
Content-Type: application/json
222+
223+
{
224+
"idempotency_key":"528dea59-7bfb-43c1-bd48-4a6bba7dd61f86",
225+
"object_id": "ND6EA5AAJEO5WL3JNNIAQA32",
226+
"image":{
227+
"id":"#TEMP_ID",
228+
"type":"IMAGE",
229+
"image_data":{
230+
"caption":"A picture of a cup of coffee"
231+
}
232+
}
233+
}
234+
--boundary
235+
Content-Disposition: form-data; name="image"; filename="Coffee.jpg"
236+
Content-Type: image/jpeg
237+
238+
{ACTUAL_IMAGE_BYTES}
239+
--boundary
240+
```
241+
242+
Additional information and an example cURL request can be found in the [Create a Catalog Image recipe](https://developer.squareup.com/docs/more-apis/catalog/cookbook/create-catalog-images).
243+
244+
```python
245+
def create_catalog_image(self,
246+
request=None,
247+
image_file=None)
248+
```
249+
250+
### Parameters
251+
252+
| Parameter | Type | Tags | Description |
253+
| --- | --- | --- | --- |
254+
| `request` | [`Create Catalog Image Request`](/doc/models/create-catalog-image-request.md) | Form, Optional | - |
255+
| `image_file` | `string` | Form, Optional | - |
256+
257+
### Response Type
258+
259+
[`Create Catalog Image Response`](/doc/models/create-catalog-image-response.md)
260+
261+
### Example Usage
262+
263+
```python
264+
request = {}
265+
request['idempotency_key'] = '528dea59-7bfb-43c1-bd48-4a6bba7dd61f86'
266+
request['object_id'] = 'ND6EA5AAJEO5WL3JNNIAQA32'
267+
request['image'] = {}
268+
request['image']['type'] = 'IMAGE'
269+
request['image']['id'] = '#TEMP_ID'
270+
271+
result = catalog_api.create_catalog_image(request)
272+
273+
if result.is_success():
274+
print(result.body)
275+
elif result.is_error():
276+
print(result.errors)
277+
```
278+
202279
## Catalog Info
203280

204281
Returns information about the Square Catalog API, such as batch size
@@ -246,7 +323,7 @@ def list_catalog(self,
246323
| Parameter | Type | Tags | Description |
247324
| --- | --- | --- | --- |
248325
| `cursor` | `string` | Query, Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.<br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
249-
| `types` | `string` | Query, Optional | An optional case-insensitive, comma-separated list of object types to retrieve, for example<br>`ITEM,ITEM_VARIATION,CATEGORY,IMAGE`.<br><br>The legal values are taken from the [CatalogObjectType](#type-catalogobjecttype)<br>enumeration, namely `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,<br>`MODIFIER`, `MODIFIER_LIST`, or `IMAGE`. |
326+
| `types` | `string` | Query, Optional | An optional case-insensitive, comma-separated list of object types to retrieve, for example<br>`ITEM,ITEM_VARIATION,CATEGORY,IMAGE`.<br><br>The legal values are taken from the CatalogObjectType enum:<br>`ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,<br>`MODIFIER`, `MODIFIER_LIST`, or `IMAGE`. |
250327

251328
### Response Type
252329

@@ -321,7 +398,7 @@ def delete_catalog_object(self,
321398

322399
| Parameter | Type | Tags | Description |
323400
| --- | --- | --- | --- |
324-
| `object_id` | `string` | Template, Required | The ID of the [CatalogObject](#type-catalogobject) to be deleted. When an object is deleted, other<br>objects in the graph that depend on that object will be deleted as well (for example, deleting a<br>[CatalogItem](#type-catalogitem) will delete its [CatalogItemVariation](#type-catalogitemvariation)s). |
401+
| `object_id` | `string` | Template, Required | The ID of the catalog object to be deleted. When an object is deleted, other<br>objects in the graph that depend on that object will be deleted as well (for example, deleting a<br>catalog item will delete its catalog item variations). |
325402

326403
### Response Type
327404

@@ -360,8 +437,8 @@ def retrieve_catalog_object(self,
360437

361438
| Parameter | Type | Tags | Description |
362439
| --- | --- | --- | --- |
363-
| `object_id` | `string` | Template, Required | The object ID of any type of [CatalogObject](#type-catalogobject)s to be retrieved. |
364-
| `include_related_objects` | `bool` | Query, Optional | If `true`, the response will include additional objects that are related to the<br>requested object, as follows:<br><br>If the `object` field of the response contains a [CatalogItem](#type-catalogitem),<br>its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es,<br>[CatalogImage](#type-catalogimage)s and [CatalogModifierList](#type-catalogmodifierlist)s<br>will be returned in the `related_objects` field of the response. If the `object`<br>field of the response contains a [CatalogItemVariation](#type-catalogitemvariation),<br>its parent [CatalogItem](#type-catalogitem) will be returned in the `related_objects` field of <br>the response.<br><br>Default value: `false` |
440+
| `object_id` | `string` | Template, Required | The object ID of any type of catalog objects to be retrieved. |
441+
| `include_related_objects` | `bool` | Query, Optional | If `true`, the response will include additional objects that are related to the<br>requested object, as follows:<br><br>If the `object` field of the response contains a CatalogItem,<br>its associated CatalogCategory, CatalogTax objects,<br>CatalogImages and CatalogModifierLists<br>will be returned in the `related_objects` field of the response. If the `object`<br>field of the response contains a CatalogItemVariation,<br>its parent CatalogItem will be returned in the `related_objects` field of<br>the response.<br><br>Default value: `false` |
365442

366443
### Response Type
367444

@@ -389,6 +466,13 @@ Queries the targeted catalog using a variety of query types:
389466
[CatalogQueryText](#type-catalogquerytext),
390467
[CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), and
391468
[CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist).
469+
--
470+
--
471+
Future end of the above comment:
472+
[CatalogQueryItemsForTax](#type-catalogqueryitemsfortax),
473+
[CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist),
474+
[CatalogQueryItemsForItemOptions](#type-catalogqueryitemsforitemoptions), and
475+
[CatalogQueryItemVariationsForItemOptionValues](#type-catalogqueryitemvariationsforitemoptionvalues).
392476

393477
```python
394478
def search_catalog_objects(self,

doc/client.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

doc/customers.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def list_customers(self,
3434

3535
| Parameter | Type | Tags | Description |
3636
| --- | --- | --- | --- |
37-
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
38-
| `sort_field` | [`str (Customer Sort Field)`](/doc/models/customer-sort-field.md) | Query, Optional | Indicates how Customers should be sorted. Default: `DEFAULT`. |
39-
| `sort_order` | [`str (Sort Order)`](/doc/models/sort-order.md) | Query, Optional | Indicates whether Customers should be sorted in ascending (`ASC`) or<br>descending (`DESC`) order. Default: `ASC`. |
37+
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See the [Pagination guide](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. |
38+
| `sort_field` | [`str (Customer Sort Field)`](/doc/models/customer-sort-field.md) | Query, Optional | Indicates how Customers should be sorted.<br><br>Default: `DEFAULT`. |
39+
| `sort_order` | [`str (Sort Order)`](/doc/models/sort-order.md) | Query, Optional | Indicates whether Customers should be sorted in ascending (`ASC`) or<br>descending (`DESC`) order.<br><br>Default: `ASC`. |
4040

4141
### Response Type
4242

@@ -228,9 +228,8 @@ the new `customer_id` to update merged profiles.
228228

229229
You cannot edit a customer's cards on file with this endpoint. To make changes
230230
to a card on file, you must delete the existing card on file with the
231-
[DeleteCustomerCard](#endpoint-customers-deletecustomercard) endpoint, then
232-
create a new one with the
233-
[CreateCustomerCard](#endpoint-customers-createcustomercard) endpoint.
231+
[DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the
232+
[CreateCustomerCard](#endpoint-createcustomercard) endpoint.
234233

235234
```python
236235
def update_customer(self,
@@ -274,9 +273,6 @@ As with charges, calls to `CreateCustomerCard` are idempotent. Multiple
274273
calls with the same card nonce return the same card record that was created
275274
with the provided nonce during the _first_ call.
276275

277-
Cards on file are automatically updated on a monthly basis to confirm they
278-
are still valid and can be charged.
279-
280276
```python
281277
def create_customer_card(self,
282278
customer_id,

doc/employees.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ employees_api = client.employees
1515

1616
## List Employees
1717

18-
Gets a list of `Employee` objects for a business.
18+
ListEmployees
1919

2020
```python
2121
def list_employees(self,
@@ -29,7 +29,7 @@ def list_employees(self,
2929

3030
| Parameter | Type | Tags | Description |
3131
| --- | --- | --- | --- |
32-
| `location_id` | `string` | Query, Optional | Filter employees returned to only those that are associated with the<br>specified location. |
32+
| `location_id` | `string` | Query, Optional | Filter employees returned to only those that are associated with the specified location. |
3333
| `status` | [`str (Employee Status)`](/doc/models/employee-status.md) | Query, Optional | Specifies the EmployeeStatus to filter the employee by. |
3434
| `limit` | `int` | Query, Optional | The number of employees to be returned on each page. |
3535
| `cursor` | `string` | Query, Optional | The token required to retrieve the specified page of results. |
@@ -51,7 +51,7 @@ elif result.is_error():
5151

5252
## Retrieve Employee
5353

54-
Gets an `Employee` by Square-assigned employee `ID` (UUID)
54+
RetrieveEmployee
5555

5656
```python
5757
def retrieve_employee(self,

doc/inventory.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def retrieve_inventory_count(self,
245245
| --- | --- | --- | --- |
246246
| `catalog_object_id` | `string` | Template, Required | ID of the [CatalogObject](#type-catalogobject) to retrieve. |
247247
| `location_ids` | `string` | Query, Optional | The [Location](#type-location) IDs to look up as a comma-separated<br>list. An empty list queries all locations. |
248-
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
248+
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information. |
249249

250250
### Response Type
251251

@@ -290,7 +290,7 @@ def retrieve_inventory_changes(self,
290290
| --- | --- | --- | --- |
291291
| `catalog_object_id` | `string` | Template, Required | ID of the [CatalogObject](#type-catalogobject) to retrieve. |
292292
| `location_ids` | `string` | Query, Optional | The [Location](#type-location) IDs to look up as a comma-separated<br>list. An empty list queries all locations. |
293-
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
293+
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information. |
294294

295295
### Response Type
296296

doc/locations.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ locations_api = client.locations
1111
## Methods
1212

1313
* [List Locations](/doc/locations.md#list-locations)
14+
* [Create Location](/doc/locations.md#create-location)
1415
* [Retrieve Location](/doc/locations.md#retrieve-location)
1516
* [Update Location](/doc/locations.md#update-location)
1617

1718
## List Locations
1819

19-
Provides the details for all of a business's locations.
20+
Provides information of all locations of a business.
2021

2122
Most other Connect API endpoints have a required `location_id` path parameter.
2223
The `id` field of the [`Location`](#type-location) objects returned by this
@@ -41,6 +42,47 @@ elif result.is_error():
4142
print(result.errors)
4243
```
4344

45+
## Create Location
46+
47+
Creates a location.
48+
For more information about locations, see [Locations API Overview](https://developer.squareup.com/docs/locations-api).
49+
50+
```python
51+
def create_location(self,
52+
body)
53+
```
54+
55+
### Parameters
56+
57+
| Parameter | Type | Tags | Description |
58+
| --- | --- | --- | --- |
59+
| `body` | [`Create Location Request`](/doc/models/create-location-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
60+
61+
### Response Type
62+
63+
[`Create Location Response`](/doc/models/create-location-response.md)
64+
65+
### Example Usage
66+
67+
```python
68+
body = {}
69+
body['location'] = {}
70+
body['location']['name'] = 'New location name'
71+
body['location']['address'] = {}
72+
body['location']['address']['address_line_1'] = '1234 Peachtree St. NE'
73+
body['location']['address']['locality'] = 'Atlanta'
74+
body['location']['address']['administrative_district_level_1'] = 'GA'
75+
body['location']['address']['postal_code'] = '30309'
76+
body['location']['description'] = 'My new location.'
77+
78+
result = locations_api.create_location(body)
79+
80+
if result.is_success():
81+
print(result.body)
82+
elif result.is_error():
83+
print(result.errors)
84+
```
85+
4486
## Retrieve Location
4587

4688
Retrieves details of a location.
@@ -75,7 +117,7 @@ elif result.is_error():
75117

76118
## Update Location
77119

78-
Updates the `Location` specified by the given ID.
120+
Updates a location.
79121

80122
```python
81123
def update_location(self,
@@ -99,6 +141,24 @@ def update_location(self,
99141
```python
100142
location_id = 'location_id4'
101143
body = {}
144+
body['location'] = {}
145+
body['location']['name'] = 'Updated nickname'
146+
body['location']['address'] = {}
147+
body['location']['address']['address_line_1'] = '1234 Peachtree St. NE'
148+
body['location']['address']['locality'] = 'Atlanta'
149+
body['location']['address']['administrative_district_level_1'] = 'GA'
150+
body['location']['address']['postal_code'] = '30309'
151+
body['location']['business_hours'] = {}
152+
body['location']['business_hours']['periods'] = []
153+
154+
body['location']['business_hours']['periods'].append({})
155+
body['location']['business_hours']['periods'][0]['day_of_week'] = 'MON'
156+
body['location']['business_hours']['periods'][0]['start_local_time'] = '09:00'
157+
body['location']['business_hours']['periods'][0]['end_local_time'] = '17:00'
158+
159+
body['location']['description'] = 'Updated description'
160+
body['location']['twitter_username'] = 'twitter'
161+
body['location']['instagram_username'] = 'instagram'
102162

103163
result = locations_api.update_location(location_id, body)
104164

0 commit comments

Comments
 (0)