|
| 1 | +# Events |
| 2 | + |
| 3 | +```python |
| 4 | +events_api = client.events |
| 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 | +```python |
| 24 | +def search_events(self, |
| 25 | + body) |
| 26 | +``` |
| 27 | + |
| 28 | +## Parameters |
| 29 | + |
| 30 | +| Parameter | Type | Tags | Description | |
| 31 | +| --- | --- | --- | --- | |
| 32 | +| `body` | [`Search Events Request`](../../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. | |
| 33 | + |
| 34 | +## Response Type |
| 35 | + |
| 36 | +This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Search Events Response`](../../doc/models/search-events-response.md). |
| 37 | + |
| 38 | +## Example Usage |
| 39 | + |
| 40 | +```python |
| 41 | +body = {} |
| 42 | + |
| 43 | +result = events_api.search_events(body) |
| 44 | +print(result) |
| 45 | + |
| 46 | +if result.is_success(): |
| 47 | + print(result.body) |
| 48 | +elif result.is_error(): |
| 49 | + print(result.errors) |
| 50 | +``` |
| 51 | + |
| 52 | + |
| 53 | +# Disable Events |
| 54 | + |
| 55 | +Disables events to prevent them from being searchable. |
| 56 | +All events are disabled by default. You must enable events to make them searchable. |
| 57 | +Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later. |
| 58 | + |
| 59 | +```python |
| 60 | +def disable_events(self) |
| 61 | +``` |
| 62 | + |
| 63 | +## Response Type |
| 64 | + |
| 65 | +This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Disable Events Response`](../../doc/models/disable-events-response.md). |
| 66 | + |
| 67 | +## Example Usage |
| 68 | + |
| 69 | +```python |
| 70 | +result = events_api.disable_events() |
| 71 | +print(result) |
| 72 | + |
| 73 | +if result.is_success(): |
| 74 | + print(result.body) |
| 75 | +elif result.is_error(): |
| 76 | + print(result.errors) |
| 77 | +``` |
| 78 | + |
| 79 | + |
| 80 | +# Enable Events |
| 81 | + |
| 82 | +Enables events to make them searchable. Only events that occur while in the enabled state are searchable. |
| 83 | + |
| 84 | +```python |
| 85 | +def enable_events(self) |
| 86 | +``` |
| 87 | + |
| 88 | +## Response Type |
| 89 | + |
| 90 | +This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Enable Events Response`](../../doc/models/enable-events-response.md). |
| 91 | + |
| 92 | +## Example Usage |
| 93 | + |
| 94 | +```python |
| 95 | +result = events_api.enable_events() |
| 96 | +print(result) |
| 97 | + |
| 98 | +if result.is_success(): |
| 99 | + print(result.body) |
| 100 | +elif result.is_error(): |
| 101 | + print(result.errors) |
| 102 | +``` |
| 103 | + |
| 104 | + |
| 105 | +# List Event Types |
| 106 | + |
| 107 | +Lists all event types that you can subscribe to as webhooks or query using the Events API. |
| 108 | + |
| 109 | +```python |
| 110 | +def list_event_types(self, |
| 111 | + api_version=None) |
| 112 | +``` |
| 113 | + |
| 114 | +## Parameters |
| 115 | + |
| 116 | +| Parameter | Type | Tags | Description | |
| 117 | +| --- | --- | --- | --- | |
| 118 | +| `api_version` | `str` | Query, Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | |
| 119 | + |
| 120 | +## Response Type |
| 121 | + |
| 122 | +This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`List Event Types Response`](../../doc/models/list-event-types-response.md). |
| 123 | + |
| 124 | +## Example Usage |
| 125 | + |
| 126 | +```python |
| 127 | +result = events_api.list_event_types() |
| 128 | +print(result) |
| 129 | + |
| 130 | +if result.is_success(): |
| 131 | + print(result.body) |
| 132 | +elif result.is_error(): |
| 133 | + print(result.errors) |
| 134 | +``` |
| 135 | + |
0 commit comments