Skip to content

Commit

Permalink
Merge pull request #119 from square/release/40.1.0.20240604
Browse files Browse the repository at this point in the history
Generated PR for Release: 40.1.0.20240604
  • Loading branch information
jessdelacruzsantos authored Jun 3, 2024
2 parents 3c30fae + ed3939b commit ce5be46
Show file tree
Hide file tree
Showing 34 changed files with 2,602 additions and 33 deletions.
140 changes: 140 additions & 0 deletions doc/api/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Events

```java
EventsApi eventsApi = client.getEventsApi();
```

## 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.

```java
CompletableFuture<SearchEventsResponse> searchEventsAsync(
final SearchEventsRequest body)
```

## 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. |

## Response Type

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

## Example Usage

```java
SearchEventsRequest body = new SearchEventsRequest.Builder()
.build();

eventsApi.searchEventsAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
```


# 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.

```java
CompletableFuture<DisableEventsResponse> disableEventsAsync()
```

## Response Type

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

## Example Usage

```java
eventsApi.disableEventsAsync().thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
```


# Enable Events

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

```java
CompletableFuture<EnableEventsResponse> enableEventsAsync()
```

## Response Type

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

## Example Usage

```java
eventsApi.enableEventsAsync().thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
```


# List Event Types

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

```java
CompletableFuture<ListEventTypesResponse> listEventTypesAsync(
final String apiVersion)
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `apiVersion` | `String` | Query, Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. |

## Response Type

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

## Example Usage

```java
eventsApi.listEventTypesAsync(null).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
```

9 changes: 5 additions & 4 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ 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`** |
| `httpClientConfig` | [`ReadonlyHttpClientConfiguration`](http-client-configuration.md) | Http Client Configuration instance. |
| `httpClientConfig` | [`Consumer<HttpClientConfiguration.Builder>`](http-client-configuration-builder.md) | Set up Http Client Configuration instance. |
| `additionalHeaders` | [`Headers`](headers.md) | Additional headers to add to each API request.<br>*Default*: `new Headers()` |
| `userAgentDetail` | `String` | Additional detail which can be appended with User-Agent header.<br>*Default*: `"null"` |
| `bearerAuthCredentials` | [`BearerAuthCredentials`](auth/oauth-2-bearer-token.md) | The Credentials Setter for OAuth 2 Bearer token |
Expand All @@ -19,7 +19,7 @@ The API client can be initialized as follows:
SquareClient client = new SquareClient.Builder()
.httpClientConfig(configBuilder -> configBuilder
.timeout(0))
.squareVersion("2024-05-15")
.squareVersion("2024-06-04")
.bearerAuthCredentials(new BearerAuthModel.Builder(
"AccessToken"
)
Expand All @@ -44,7 +44,7 @@ public class Program {
SquareClient client = new SquareClient.Builder()
.httpClientConfig(configBuilder -> configBuilder
.timeout(0))
.squareVersion("2024-05-15")
.squareVersion("2024-06-04")
.bearerAuthCredentials(new BearerAuthModel.Builder(
"AccessToken"
)
Expand Down Expand Up @@ -90,6 +90,7 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold
| `getDevicesApi()` | Provides access to Devices controller. | `DevicesApi` |
| `getDisputesApi()` | Provides access to Disputes controller. | `DisputesApi` |
| `getEmployeesApi()` | Provides access to Employees controller. | `EmployeesApi` |
| `getEventsApi()` | Provides access to Events controller. | `EventsApi` |
| `getGiftCardsApi()` | Provides access to GiftCards controller. | `GiftCardsApi` |
| `getGiftCardActivitiesApi()` | Provides access to GiftCardActivities controller. | `GiftCardActivitiesApi` |
| `getInventoryApi()` | Provides access to Inventory controller. | `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 | Getter |
| --- | --- | --- | --- | --- |
| `Errors` | [`List<Error>`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | List<Error> getErrors() |

## 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 | Getter |
| --- | --- | --- | --- | --- |
| `Errors` | [`List<Error>`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | List<Error> getErrors() |

## 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 | Getter |
| --- | --- | --- | --- | --- |
| `Type` | `String` | Optional | Name of the affected object’s type. | String getType() |
| `Id` | `String` | Optional | ID of the affected object. | String getId() |
| `Deleted` | `Boolean` | Optional | Is true if the affected object was deleted. Otherwise absent. | Boolean getDeleted() |
| `Object` | `JsonObject` | Optional | An object containing fields and values relevant to the event. Is absent if affected object was deleted. | JsonObject getObject() |
| `Type` | `String` | Optional | The name of the affected object’s type. | String getType() |
| `Id` | `String` | Optional | The ID of the affected object. | String getId() |
| `Deleted` | `Boolean` | Optional | This is true if the affected object has been deleted; otherwise, it's absent. | Boolean getDeleted() |
| `Object` | `JsonObject` | Optional | An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. | JsonObject getObject() |

## 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 | Getter |
| --- | --- | --- | --- | --- |
| `EventId` | `String` | Optional | A unique ID for the event. | String getEventId() |
| `ApiVersion` | `String` | 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. | String getApiVersion() |

## 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 | Getter |
| --- | --- | --- | --- | --- |
| `MerchantId` | `String` | Optional | The ID of the target merchant associated with the event. | String getMerchantId() |
| `LocationId` | `String` | Optional | The ID of the location associated with the event. | String getLocationId() |
| `LocationId` | `String` | Optional | The ID of the target location associated with the event. | String getLocationId() |
| `Type` | `String` | Optional | The type of event this represents. | String getType() |
| `EventId` | `String` | Optional | A unique ID for the event. | String getEventId() |
| `CreatedAt` | `String` | Optional | Timestamp of when the event was created, in RFC 3339 format. | String getCreatedAt() |
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 | Getter |
| --- | --- | --- | --- | --- |
| `ApiVersion` | `String` | Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | String getApiVersion() |

## Example (as JSON)

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

52 changes: 52 additions & 0 deletions doc/models/list-event-types-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

# List Event Types Response

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

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

## Structure

`ListEventTypesResponse`

## Fields

| Name | Type | Tags | Description | Getter |
| --- | --- | --- | --- | --- |
| `Errors` | [`List<Error>`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | List<Error> getErrors() |
| `EventTypes` | `List<String>` | Optional | The list of event types. | List<String> getEventTypes() |
| `Metadata` | [`List<EventTypeMetadata>`](../../doc/models/event-type-metadata.md) | Optional | Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). | List<EventTypeMetadata> getMetadata() |

## Example (as JSON)

```json
{
"event_types": [
"inventory.count.updated"
],
"metadata": [
{
"api_version_introduced": "2018-07-12",
"event_type": "inventory.count.updated",
"release_status": "PUBLIC"
}
],
"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"
}
]
}
```

2 changes: 1 addition & 1 deletion doc/models/quantity-ratio.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A whole number or unreduced fractional ratio.
| Name | Type | Tags | Description | Getter |
| --- | --- | --- | --- | --- |
| `Quantity` | `Integer` | Optional | The whole or fractional quantity as the numerator. | Integer getQuantity() |
| `QuantityDenominator` | `Integer` | Optional | The whole or fractional quantity as the denominator.<br>In the case of fractional quantity this field is the denominator and quantity is the numerator.<br>When unspecified, the value is `1`. For example, when `quantity=3` and `quantity_donominator` is unspecified,<br>the quantity ratio is `3` or `3/1`. | Integer getQuantityDenominator() |
| `QuantityDenominator` | `Integer` | Optional | The whole or fractional quantity as the denominator.<br>With fractional quantity this field is the denominator and quantity is the numerator.<br>The default value is `1`. For example, when `quantity=3` and `quantity_denominator` is unspecified,<br>the quantity ratio is `3` or `3/1`. | Integer getQuantityDenominator() |

## Example (as JSON)

Expand Down
Loading

0 comments on commit ce5be46

Please sign in to comment.