Skip to content

Commit

Permalink
Merge pull request #148 from square/release/37.1.0
Browse files Browse the repository at this point in the history
Generated PR for Release: 37.1.0
  • Loading branch information
jessdelacruzsantos committed Jun 3, 2024
2 parents f00152c + 8292eef commit 5a9c46d
Show file tree
Hide file tree
Showing 34 changed files with 945 additions and 20 deletions.
169 changes: 169 additions & 0 deletions doc/api/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# Events

```ts
const eventsApi = client.eventsApi;
```

## Class Name

`EventsApi`

## Methods

* [Search Events](../../doc/api/events.md#search-events)
* [Disable Events](../../doc/api/events.md#disable-events)
* [Enable Events](../../doc/api/events.md#enable-events)
* [List Event Types](../../doc/api/events.md#list-event-types)


# Search Events

Search for Square API events that occur within a 28-day timeframe.

```ts
async searchEvents(
body: SearchEventsRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<SearchEventsResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `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. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`SearchEventsResponse`](../../doc/models/search-events-response.md)

## Example Usage

```ts
const body: SearchEventsRequest = {};

try {
const { result, ...httpResponse } = await eventsApi.searchEvents(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```


# Disable Events

Disables events to prevent them from being searchable.
All events are disabled by default. You must enable events to make them searchable.
Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.

```ts
async disableEvents(
requestOptions?: RequestOptions
): Promise<ApiResponse<DisableEventsResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`DisableEventsResponse`](../../doc/models/disable-events-response.md)

## Example Usage

```ts
try {
const { result, ...httpResponse } = await eventsApi.disableEvents();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```


# Enable Events

Enables events to make them searchable. Only events that occur while in the enabled state are searchable.

```ts
async enableEvents(
requestOptions?: RequestOptions
): Promise<ApiResponse<EnableEventsResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`EnableEventsResponse`](../../doc/models/enable-events-response.md)

## Example Usage

```ts
try {
const { result, ...httpResponse } = await eventsApi.enableEvents();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```


# List Event Types

Lists all event types that you can subscribe to as webhooks or query using the Events API.

```ts
async listEventTypes(
apiVersion?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListEventTypesResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `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. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`ListEventTypesResponse`](../../doc/models/list-event-types-response.md)

## Example Usage

```ts
try {
const { result, ...httpResponse } = await eventsApi.listEventTypes();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```

7 changes: 4 additions & 3 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:

| Parameter | Type | Description |
| --- | --- | --- |
| `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2024-05-15'` |
| `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2024-06-04'` |
| `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `'https://connect.squareup.com'` |
| `environment` | `string` | The API environment. <br> **Default: `production`** |
| `additionalHeaders` | `Readonly<Record<string, string>>` | Additional headers to add to each API call<br>*Default*: `{}` |
Expand Down Expand Up @@ -43,7 +43,7 @@ const client = new Client({
bearerAuthCredentials: {
accessToken: 'AccessToken'
},
squareVersion: '2024-05-15',
squareVersion: '2024-06-04',
timeout: 60000,
additionalHeaders: {},
userAgentDetail: '',
Expand All @@ -60,7 +60,7 @@ const client = new Client({
bearerAuthCredentials: {
accessToken: 'AccessToken'
},
squareVersion: '2024-05-15',
squareVersion: '2024-06-04',
timeout: 60000,
additionalHeaders: {},
userAgentDetail: '',
Expand Down Expand Up @@ -105,6 +105,7 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold
| devices | Gets DevicesApi |
| disputes | Gets DisputesApi |
| employees | Gets EmployeesApi |
| events | Gets EventsApi |
| giftCards | Gets GiftCardsApi |
| giftCardActivities | Gets GiftCardActivitiesApi |
| inventory | Gets InventoryApi |
Expand Down
40 changes: 40 additions & 0 deletions doc/models/disable-events-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# Disable Events Response

Defines the fields that are included in the response body of
a request to the [DisableEvents](../../doc/api/events.md#disable-events) endpoint.

Note: if there are errors processing the request, the events field will not be
present.

## Structure

`DisableEventsResponse`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. |

## Example (as JSON)

```json
{
"errors": [
{
"category": "MERCHANT_SUBSCRIPTION_ERROR",
"code": "MAP_KEY_LENGTH_TOO_LONG",
"detail": "detail6",
"field": "field4"
},
{
"category": "MERCHANT_SUBSCRIPTION_ERROR",
"code": "MAP_KEY_LENGTH_TOO_LONG",
"detail": "detail6",
"field": "field4"
}
]
}
```

34 changes: 34 additions & 0 deletions doc/models/enable-events-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

# Enable Events Response

Defines the fields that are included in the response body of
a request to the [EnableEvents](../../doc/api/events.md#enable-events) endpoint.

Note: if there are errors processing the request, the events field will not be
present.

## Structure

`EnableEventsResponse`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. |

## Example (as JSON)

```json
{
"errors": [
{
"category": "MERCHANT_SUBSCRIPTION_ERROR",
"code": "MAP_KEY_LENGTH_TOO_LONG",
"detail": "detail6",
"field": "field4"
}
]
}
```

8 changes: 4 additions & 4 deletions doc/models/event-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

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

## Example (as JSON)

Expand Down
25 changes: 25 additions & 0 deletions doc/models/event-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# Event Metadata

Contains metadata about a particular [Event](../../doc/models/event.md).

## Structure

`EventMetadata`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `eventId` | `string \| null \| undefined` | Optional | A unique ID for the event. |
| `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. |

## Example (as JSON)

```json
{
"event_id": "event_id0",
"api_version": "api_version6"
}
```

2 changes: 1 addition & 1 deletion doc/models/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `merchantId` | `string \| null \| undefined` | Optional | The ID of the target merchant associated with the event. |
| `locationId` | `string \| null \| undefined` | Optional | The ID of the location associated with the event. |
| `locationId` | `string \| null \| undefined` | Optional | The ID of the target location associated with the event. |
| `type` | `string \| null \| undefined` | Optional | The type of event this represents. |
| `eventId` | `string \| null \| undefined` | Optional | A unique ID for the event. |
| `createdAt` | `string \| undefined` | Optional | Timestamp of when the event was created, in RFC 3339 format. |
Expand Down
23 changes: 23 additions & 0 deletions doc/models/list-event-types-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# List Event Types Request

Lists all event types that can be subscribed to.

## Structure

`ListEventTypesRequest`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `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. |

## Example (as JSON)

```json
{
"api_version": "api_version0"
}
```

Loading

0 comments on commit 5a9c46d

Please sign in to comment.