|
| 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 | + |
0 commit comments