Skip to content

Commit 5a9c46d

Browse files
Merge pull request #148 from square/release/37.1.0
Generated PR for Release: 37.1.0
2 parents f00152c + 8292eef commit 5a9c46d

34 files changed

+945
-20
lines changed

doc/api/events.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Events
2+
3+
```ts
4+
const eventsApi = client.eventsApi;
5+
```
6+
7+
## Class Name
8+
9+
`EventsApi`
10+
11+
## Methods
12+
13+
* [Search Events](../../doc/api/events.md#search-events)
14+
* [Disable Events](../../doc/api/events.md#disable-events)
15+
* [Enable Events](../../doc/api/events.md#enable-events)
16+
* [List Event Types](../../doc/api/events.md#list-event-types)
17+
18+
19+
# Search Events
20+
21+
Search for Square API events that occur within a 28-day timeframe.
22+
23+
```ts
24+
async searchEvents(
25+
body: SearchEventsRequest,
26+
requestOptions?: RequestOptions
27+
): Promise<ApiResponse<SearchEventsResponse>>
28+
```
29+
30+
## Parameters
31+
32+
| Parameter | Type | Tags | Description |
33+
| --- | --- | --- | --- |
34+
| `body` | [`SearchEventsRequest`](../../doc/models/search-events-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
35+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
36+
37+
## Response Type
38+
39+
[`SearchEventsResponse`](../../doc/models/search-events-response.md)
40+
41+
## Example Usage
42+
43+
```ts
44+
const body: SearchEventsRequest = {};
45+
46+
try {
47+
const { result, ...httpResponse } = await eventsApi.searchEvents(body);
48+
// Get more response info...
49+
// const { statusCode, headers } = httpResponse;
50+
} catch (error) {
51+
if (error instanceof ApiError) {
52+
const errors = error.result;
53+
// const { statusCode, headers } = error;
54+
}
55+
}
56+
```
57+
58+
59+
# Disable Events
60+
61+
Disables events to prevent them from being searchable.
62+
All events are disabled by default. You must enable events to make them searchable.
63+
Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
64+
65+
```ts
66+
async disableEvents(
67+
requestOptions?: RequestOptions
68+
): Promise<ApiResponse<DisableEventsResponse>>
69+
```
70+
71+
## Parameters
72+
73+
| Parameter | Type | Tags | Description |
74+
| --- | --- | --- | --- |
75+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
76+
77+
## Response Type
78+
79+
[`DisableEventsResponse`](../../doc/models/disable-events-response.md)
80+
81+
## Example Usage
82+
83+
```ts
84+
try {
85+
const { result, ...httpResponse } = await eventsApi.disableEvents();
86+
// Get more response info...
87+
// const { statusCode, headers } = httpResponse;
88+
} catch (error) {
89+
if (error instanceof ApiError) {
90+
const errors = error.result;
91+
// const { statusCode, headers } = error;
92+
}
93+
}
94+
```
95+
96+
97+
# Enable Events
98+
99+
Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
100+
101+
```ts
102+
async enableEvents(
103+
requestOptions?: RequestOptions
104+
): Promise<ApiResponse<EnableEventsResponse>>
105+
```
106+
107+
## Parameters
108+
109+
| Parameter | Type | Tags | Description |
110+
| --- | --- | --- | --- |
111+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
112+
113+
## Response Type
114+
115+
[`EnableEventsResponse`](../../doc/models/enable-events-response.md)
116+
117+
## Example Usage
118+
119+
```ts
120+
try {
121+
const { result, ...httpResponse } = await eventsApi.enableEvents();
122+
// Get more response info...
123+
// const { statusCode, headers } = httpResponse;
124+
} catch (error) {
125+
if (error instanceof ApiError) {
126+
const errors = error.result;
127+
// const { statusCode, headers } = error;
128+
}
129+
}
130+
```
131+
132+
133+
# List Event Types
134+
135+
Lists all event types that you can subscribe to as webhooks or query using the Events API.
136+
137+
```ts
138+
async listEventTypes(
139+
apiVersion?: string,
140+
requestOptions?: RequestOptions
141+
): Promise<ApiResponse<ListEventTypesResponse>>
142+
```
143+
144+
## Parameters
145+
146+
| Parameter | Type | Tags | Description |
147+
| --- | --- | --- | --- |
148+
| `apiVersion` | `string \| undefined` | Query, Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. |
149+
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
150+
151+
## Response Type
152+
153+
[`ListEventTypesResponse`](../../doc/models/list-event-types-response.md)
154+
155+
## Example Usage
156+
157+
```ts
158+
try {
159+
const { result, ...httpResponse } = await eventsApi.listEventTypes();
160+
// Get more response info...
161+
// const { statusCode, headers } = httpResponse;
162+
} catch (error) {
163+
if (error instanceof ApiError) {
164+
const errors = error.result;
165+
// const { statusCode, headers } = error;
166+
}
167+
}
168+
```
169+

doc/client.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:
55

66
| Parameter | Type | Description |
77
| --- | --- | --- |
8-
| `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2024-05-15'` |
8+
| `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2024-06-04'` |
99
| `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `'https://connect.squareup.com'` |
1010
| `environment` | `string` | The API environment. <br> **Default: `production`** |
1111
| `additionalHeaders` | `Readonly<Record<string, string>>` | Additional headers to add to each API call<br>*Default*: `{}` |
@@ -43,7 +43,7 @@ const client = new Client({
4343
bearerAuthCredentials: {
4444
accessToken: 'AccessToken'
4545
},
46-
squareVersion: '2024-05-15',
46+
squareVersion: '2024-06-04',
4747
timeout: 60000,
4848
additionalHeaders: {},
4949
userAgentDetail: '',
@@ -60,7 +60,7 @@ const client = new Client({
6060
bearerAuthCredentials: {
6161
accessToken: 'AccessToken'
6262
},
63-
squareVersion: '2024-05-15',
63+
squareVersion: '2024-06-04',
6464
timeout: 60000,
6565
additionalHeaders: {},
6666
userAgentDetail: '',
@@ -105,6 +105,7 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold
105105
| devices | Gets DevicesApi |
106106
| disputes | Gets DisputesApi |
107107
| employees | Gets EmployeesApi |
108+
| events | Gets EventsApi |
108109
| giftCards | Gets GiftCardsApi |
109110
| giftCardActivities | Gets GiftCardActivitiesApi |
110111
| inventory | Gets InventoryApi |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
# Disable Events Response
3+
4+
Defines the fields that are included in the response body of
5+
a request to the [DisableEvents](../../doc/api/events.md#disable-events) endpoint.
6+
7+
Note: if there are errors processing the request, the events field will not be
8+
present.
9+
10+
## Structure
11+
12+
`DisableEventsResponse`
13+
14+
## Fields
15+
16+
| Name | Type | Tags | Description |
17+
| --- | --- | --- | --- |
18+
| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. |
19+
20+
## Example (as JSON)
21+
22+
```json
23+
{
24+
"errors": [
25+
{
26+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
27+
"code": "MAP_KEY_LENGTH_TOO_LONG",
28+
"detail": "detail6",
29+
"field": "field4"
30+
},
31+
{
32+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
33+
"code": "MAP_KEY_LENGTH_TOO_LONG",
34+
"detail": "detail6",
35+
"field": "field4"
36+
}
37+
]
38+
}
39+
```
40+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# Enable Events Response
3+
4+
Defines the fields that are included in the response body of
5+
a request to the [EnableEvents](../../doc/api/events.md#enable-events) endpoint.
6+
7+
Note: if there are errors processing the request, the events field will not be
8+
present.
9+
10+
## Structure
11+
12+
`EnableEventsResponse`
13+
14+
## Fields
15+
16+
| Name | Type | Tags | Description |
17+
| --- | --- | --- | --- |
18+
| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. |
19+
20+
## Example (as JSON)
21+
22+
```json
23+
{
24+
"errors": [
25+
{
26+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
27+
"code": "MAP_KEY_LENGTH_TOO_LONG",
28+
"detail": "detail6",
29+
"field": "field4"
30+
}
31+
]
32+
}
33+
```
34+

doc/models/event-data.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
| Name | Type | Tags | Description |
1111
| --- | --- | --- | --- |
12-
| `type` | `string \| null \| undefined` | Optional | Name of the affected object’s type. |
13-
| `id` | `string \| undefined` | Optional | ID of the affected object. |
14-
| `deleted` | `boolean \| null \| undefined` | Optional | Is true if the affected object was deleted. Otherwise absent. |
15-
| `object` | `Record<string, unknown> \| null \| undefined` | Optional | An object containing fields and values relevant to the event. Is absent if affected object was deleted. |
12+
| `type` | `string \| null \| undefined` | Optional | The name of the affected object’s type. |
13+
| `id` | `string \| undefined` | Optional | The ID of the affected object. |
14+
| `deleted` | `boolean \| null \| undefined` | Optional | This is true if the affected object has been deleted; otherwise, it's absent. |
15+
| `object` | `Record<string, unknown> \| null \| undefined` | Optional | An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. |
1616

1717
## Example (as JSON)
1818

doc/models/event-metadata.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
# Event Metadata
3+
4+
Contains metadata about a particular [Event](../../doc/models/event.md).
5+
6+
## Structure
7+
8+
`EventMetadata`
9+
10+
## Fields
11+
12+
| Name | Type | Tags | Description |
13+
| --- | --- | --- | --- |
14+
| `eventId` | `string \| null \| undefined` | Optional | A unique ID for the event. |
15+
| `apiVersion` | `string \| null \| undefined` | Optional | The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created. |
16+
17+
## Example (as JSON)
18+
19+
```json
20+
{
21+
"event_id": "event_id0",
22+
"api_version": "api_version6"
23+
}
24+
```
25+

doc/models/event.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
| Name | Type | Tags | Description |
1111
| --- | --- | --- | --- |
1212
| `merchantId` | `string \| null \| undefined` | Optional | The ID of the target merchant associated with the event. |
13-
| `locationId` | `string \| null \| undefined` | Optional | The ID of the location associated with the event. |
13+
| `locationId` | `string \| null \| undefined` | Optional | The ID of the target location associated with the event. |
1414
| `type` | `string \| null \| undefined` | Optional | The type of event this represents. |
1515
| `eventId` | `string \| null \| undefined` | Optional | A unique ID for the event. |
1616
| `createdAt` | `string \| undefined` | Optional | Timestamp of when the event was created, in RFC 3339 format. |
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# List Event Types Request
3+
4+
Lists all event types that can be subscribed to.
5+
6+
## Structure
7+
8+
`ListEventTypesRequest`
9+
10+
## Fields
11+
12+
| Name | Type | Tags | Description |
13+
| --- | --- | --- | --- |
14+
| `apiVersion` | `string \| null \| undefined` | Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. |
15+
16+
## Example (as JSON)
17+
18+
```json
19+
{
20+
"api_version": "api_version0"
21+
}
22+
```
23+

0 commit comments

Comments
 (0)