|
| 1 | +# Events |
| 2 | + |
| 3 | +```java |
| 4 | +EventsApi eventsApi = client.getEventsApi(); |
| 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 | +```java |
| 24 | +CompletableFuture<SearchEventsResponse> searchEventsAsync( |
| 25 | + final SearchEventsRequest body) |
| 26 | +``` |
| 27 | + |
| 28 | +## Parameters |
| 29 | + |
| 30 | +| Parameter | Type | Tags | Description | |
| 31 | +| --- | --- | --- | --- | |
| 32 | +| `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. | |
| 33 | + |
| 34 | +## Response Type |
| 35 | + |
| 36 | +[`SearchEventsResponse`](../../doc/models/search-events-response.md) |
| 37 | + |
| 38 | +## Example Usage |
| 39 | + |
| 40 | +```java |
| 41 | +SearchEventsRequest body = new SearchEventsRequest.Builder() |
| 42 | + .build(); |
| 43 | + |
| 44 | +eventsApi.searchEventsAsync(body).thenAccept(result -> { |
| 45 | + // TODO success callback handler |
| 46 | + System.out.println(result); |
| 47 | +}).exceptionally(exception -> { |
| 48 | + // TODO failure callback handler |
| 49 | + exception.printStackTrace(); |
| 50 | + return null; |
| 51 | +}); |
| 52 | +``` |
| 53 | + |
| 54 | + |
| 55 | +# Disable Events |
| 56 | + |
| 57 | +Disables events to prevent them from being searchable. |
| 58 | +All events are disabled by default. You must enable events to make them searchable. |
| 59 | +Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later. |
| 60 | + |
| 61 | +```java |
| 62 | +CompletableFuture<DisableEventsResponse> disableEventsAsync() |
| 63 | +``` |
| 64 | + |
| 65 | +## Response Type |
| 66 | + |
| 67 | +[`DisableEventsResponse`](../../doc/models/disable-events-response.md) |
| 68 | + |
| 69 | +## Example Usage |
| 70 | + |
| 71 | +```java |
| 72 | +eventsApi.disableEventsAsync().thenAccept(result -> { |
| 73 | + // TODO success callback handler |
| 74 | + System.out.println(result); |
| 75 | +}).exceptionally(exception -> { |
| 76 | + // TODO failure callback handler |
| 77 | + exception.printStackTrace(); |
| 78 | + return null; |
| 79 | +}); |
| 80 | +``` |
| 81 | + |
| 82 | + |
| 83 | +# Enable Events |
| 84 | + |
| 85 | +Enables events to make them searchable. Only events that occur while in the enabled state are searchable. |
| 86 | + |
| 87 | +```java |
| 88 | +CompletableFuture<EnableEventsResponse> enableEventsAsync() |
| 89 | +``` |
| 90 | + |
| 91 | +## Response Type |
| 92 | + |
| 93 | +[`EnableEventsResponse`](../../doc/models/enable-events-response.md) |
| 94 | + |
| 95 | +## Example Usage |
| 96 | + |
| 97 | +```java |
| 98 | +eventsApi.enableEventsAsync().thenAccept(result -> { |
| 99 | + // TODO success callback handler |
| 100 | + System.out.println(result); |
| 101 | +}).exceptionally(exception -> { |
| 102 | + // TODO failure callback handler |
| 103 | + exception.printStackTrace(); |
| 104 | + return null; |
| 105 | +}); |
| 106 | +``` |
| 107 | + |
| 108 | + |
| 109 | +# List Event Types |
| 110 | + |
| 111 | +Lists all event types that you can subscribe to as webhooks or query using the Events API. |
| 112 | + |
| 113 | +```java |
| 114 | +CompletableFuture<ListEventTypesResponse> listEventTypesAsync( |
| 115 | + final String apiVersion) |
| 116 | +``` |
| 117 | + |
| 118 | +## Parameters |
| 119 | + |
| 120 | +| Parameter | Type | Tags | Description | |
| 121 | +| --- | --- | --- | --- | |
| 122 | +| `apiVersion` | `String` | Query, Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | |
| 123 | + |
| 124 | +## Response Type |
| 125 | + |
| 126 | +[`ListEventTypesResponse`](../../doc/models/list-event-types-response.md) |
| 127 | + |
| 128 | +## Example Usage |
| 129 | + |
| 130 | +```java |
| 131 | +eventsApi.listEventTypesAsync(null).thenAccept(result -> { |
| 132 | + // TODO success callback handler |
| 133 | + System.out.println(result); |
| 134 | +}).exceptionally(exception -> { |
| 135 | + // TODO failure callback handler |
| 136 | + exception.printStackTrace(); |
| 137 | + return null; |
| 138 | +}); |
| 139 | +``` |
| 140 | + |
0 commit comments