Skip to content

Commit

Permalink
Merge pull request #20 from square/release/9.0.0
Browse files Browse the repository at this point in the history
Generated PR for Release: 9.0.0
  • Loading branch information
deanpapastrat authored Feb 26, 2021
2 parents 40ec3ef + 682dc25 commit 6276ce6
Show file tree
Hide file tree
Showing 344 changed files with 925 additions and 7,764 deletions.
196 changes: 161 additions & 35 deletions CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,18 @@ const client = new Client({
accessToken: process.env.SQUARE_ACCESS_TOKEN,
})
```

To set a custom environment provide a `customUrl`, and set the environment to `Environment.Custom`:

```javascript
import { Client, Environment } from 'square'

const client = new Client({
environment: Environment.Custom,
customUrl: "https://your.customdomain.com",
accessToken: process.env.SQUARE_ACCESS_TOKEN,
})
```

### Get an instance of an API object and call its methods

Expand Down
18 changes: 18 additions & 0 deletions doc/api-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# ApiError

Thrown when the HTTP status code is not okay.

The ApiError extends the ApiResponse interface, so all ApiResponse properties are available.

## Properties

| Name | Type | Description |
| --- | --- | --- |
| request | HttpRequest | Original request that resulted in this response. |
| statusCode | number | Response status codee. |
| headers | Record<string, string> | Response headers. |
| result | T | Response data. |
| body | string | Blob | NodeJS.ReadableStream | Original body from the response. |
| errors? | Error[] | Represents an error encountered during a request to the Connect API |

15 changes: 15 additions & 0 deletions doc/api-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# ApiResponse

An interface for the result of an API call.

## Properties

| Name | Type | Description |
| --- | --- | --- |
| request | HttpRequest | Original request that resulted in this response. |
| statusCode | number | Response status codee. |
| headers | Record<string, string> | Response headers. |
| result | T | Response data. |
| body | string | Blob | NodeJS.ReadableStream | Original body from the response. |

8 changes: 4 additions & 4 deletions doc/api/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ and set the `include_deleted_objects` attribute value to `true`.
async listCatalog(
cursor?: string,
types?: string,
catalogVersion?: number,
catalogVersion?: bigint,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListCatalogResponse>>
```
Expand All @@ -586,7 +586,7 @@ async listCatalog(
| --- | --- | --- | --- |
| `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. |
| `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`. |
| `catalogVersion` | `number` | Query, Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical<br>versions of objects. The specified version value is matched against<br>the [CatalogObject](#type-catalogobject)s' `version` attribute. |
| `catalogVersion` | `bigint` | Query, Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical<br>versions of objects. The specified version value is matched against<br>the [CatalogObject](#type-catalogobject)s' `version` attribute. |
| `requestOptions` | `RequestOptions` | Optional | Pass additional request options. |

## Response Type
Expand Down Expand Up @@ -752,7 +752,7 @@ any [CatalogTax](#type-catalogtax) objects that apply to it.
async retrieveCatalogObject(
objectId: string,
includeRelatedObjects?: boolean,
catalogVersion?: number,
catalogVersion?: bigint,
requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveCatalogObjectResponse>>
```
Expand All @@ -763,7 +763,7 @@ async retrieveCatalogObject(
| --- | --- | --- | --- |
| `objectId` | `string` | Template, Required | The object ID of any type of catalog objects to be retrieved. |
| `includeRelatedObjects` | `boolean` | 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`, its associated<br>`CatalogCategory`, `CatalogTax`, `CatalogImage` and `CatalogModifierList` objects will<br>be returned in the `related_objects` field of the response. If the `object` field of<br>the response contains a `CatalogItemVariation`, its parent `CatalogItem` will be returned<br>in the `related_objects` field of the response.<br><br>Default value: `false`<br>**Default**: `false` |
| `catalogVersion` | `number` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical<br>versions of objects. The value to retrieve a specific version of an object can be found<br>in the version field of [CatalogObject](#type-catalogobject)s. |
| `catalogVersion` | `bigint` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical<br>versions of objects. The value to retrieve a specific version of an object can be found<br>in the version field of [CatalogObject](#type-catalogobject)s. |
| `requestOptions` | `RequestOptions` | Optional | Pass additional request options. |

## Response Type
Expand Down
1 change: 0 additions & 1 deletion doc/api/checkout.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ bodyOrderOrder.discounts = bodyOrderOrderDiscounts;

const bodyOrder: CreateOrderRequest = {};
bodyOrder.order = bodyOrderOrder;
bodyOrder.locationId = 'location_id4';
bodyOrder.idempotencyKey = '12ae1696-z1e3-4328-af6d-f1e04d947gd4';

const bodyPrePopulateShippingAddress: Address = {};
Expand Down
1 change: 0 additions & 1 deletion doc/api/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ bodyOrder.discounts = bodyOrderDiscounts;

const body: CreateOrderRequest = {};
body.order = bodyOrder;
body.locationId = 'location_id0';
body.idempotencyKey = '8193148c-9586-11e6-99f9-28cfe92138cf';

try {
Expand Down
4 changes: 2 additions & 2 deletions doc/api/payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async listPayments(
sortOrder?: string,
cursor?: string,
locationId?: string,
total?: number,
total?: bigint,
last4?: string,
cardBrand?: string,
limit?: number,
Expand All @@ -48,7 +48,7 @@ async listPayments(
| `sortOrder` | `string` | Query, Optional | The order in which results are listed:<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). |
| `cursor` | `string` | 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><br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
| `locationId` | `string` | Query, Optional | Limit results to the location supplied. By default, results are returned<br>for the default (main) location associated with the seller. |
| `total` | `number` | Query, Optional | The exact amount in the `total_money` for a payment. |
| `total` | `bigint` | Query, Optional | The exact amount in the `total_money` for a payment. |
| `last4` | `string` | Query, Optional | The last four digits of a payment card. |
| `cardBrand` | `string` | Query, Optional | The brand of the payment card (for example, VISA). |
| `limit` | `number` | Query, Optional | The maximum number of results to be returned in a single page.<br>It is possible to receive fewer results than the specified limit on a given page.<br><br>The default value of 100 is also the maximum allowed value. If the provided value is<br>greater than 100, it is ignored and the default value is used instead.<br><br>Default: `100` |
Expand Down
Loading

0 comments on commit 6276ce6

Please sign in to comment.