From bee998d046ffce1f49e0a693477dc70aecb66d59 Mon Sep 17 00:00:00 2001 From: autobot Date: Thu, 19 Jan 2023 00:39:18 +0000 Subject: [PATCH] Generated PR for Release: 25.1.0.20230119 --- LICENSE | 2 +- composer.json | 2 +- doc/apis/location-custom-attributes.md | 561 ++++++++++++++++++ doc/client.md | 7 +- doc/models/break-type.md | 2 +- ...ocation-custom-attribute-delete-request.md | 23 + ...lete-location-custom-attributes-request.md | 36 ++ ...cation-custom-attribute-delete-response.md | 26 + ...ete-location-custom-attributes-response.md | 38 ++ ...ocation-custom-attribute-upsert-request.md | 35 ++ ...sert-location-custom-attributes-request.md | 57 ++ ...cation-custom-attribute-upsert-response.md | 27 + ...ert-location-custom-attributes-response.md | 26 + ...ion-custom-attribute-definition-request.md | 30 + ...on-custom-attribute-definition-response.md | 34 ++ ...on-custom-attribute-definition-response.md | 21 + ...lete-location-custom-attribute-response.md | 22 + ...ift-card-activity-transfer-balance-from.md | 28 + .../gift-card-activity-transfer-balance-to.md | 28 + doc/models/gift-card-activity-type.md | 2 + doc/models/gift-card-activity.md | 6 +- ...on-custom-attribute-definitions-request.md | 27 + ...n-custom-attribute-definitions-response.md | 49 ++ ...list-location-custom-attributes-request.md | 29 + ...ist-location-custom-attributes-response.md | 29 + ...ion-custom-attribute-definition-request.md | 23 + ...on-custom-attribute-definition-response.md | 34 ++ ...rieve-location-custom-attribute-request.md | 25 + ...ieve-location-custom-attribute-response.md | 26 + ...ion-custom-attribute-definition-request.md | 27 + ...on-custom-attribute-definition-response.md | 34 ++ ...psert-location-custom-attribute-request.md | 31 + ...sert-location-custom-attribute-response.md | 26 + src/Apis/LocationCustomAttributesApi.php | 469 +++++++++++++++ src/ConfigurationDefaults.php | 2 +- src/Models/BreakType.php | 4 + ...kDeleteLocationCustomAttributesRequest.php | 75 +++ ...stLocationCustomAttributeDeleteRequest.php | 66 +++ ...DeleteLocationCustomAttributesResponse.php | 108 ++++ ...eLocationCustomAttributeDeleteResponse.php | 94 +++ ...kUpsertLocationCustomAttributesRequest.php | 77 +++ ...stLocationCustomAttributeUpsertRequest.php | 147 +++++ ...UpsertLocationCustomAttributesResponse.php | 103 ++++ ...eLocationCustomAttributeUpsertResponse.php | 124 ++++ ...cationCustomAttributeDefinitionRequest.php | 101 ++++ ...ationCustomAttributeDefinitionResponse.php | 97 +++ ...ationCustomAttributeDefinitionResponse.php | 64 ++ .../DeleteLocationCustomAttributeResponse.php | 66 +++ src/Models/GiftCardActivity.php | 60 ++ .../GiftCardActivityTransferBalanceFrom.php | 109 ++++ .../GiftCardActivityTransferBalanceTo.php | 108 ++++ src/Models/GiftCardActivityType.php | 14 + ...ationCustomAttributeDefinitionsRequest.php | 165 ++++++ ...tionCustomAttributeDefinitionsResponse.php | 137 +++++ .../ListLocationCustomAttributesRequest.php | 216 +++++++ .../ListLocationCustomAttributesResponse.php | 137 +++++ ...cationCustomAttributeDefinitionRequest.php | 68 +++ ...ationCustomAttributeDefinitionResponse.php | 97 +++ ...RetrieveLocationCustomAttributeRequest.php | 120 ++++ ...etrieveLocationCustomAttributeResponse.php | 97 +++ ...cationCustomAttributeDefinitionRequest.php | 114 ++++ ...ationCustomAttributeDefinitionResponse.php | 97 +++ .../UpsertLocationCustomAttributeRequest.php | 113 ++++ .../UpsertLocationCustomAttributeResponse.php | 96 +++ src/SquareClient.php | 18 +- 65 files changed, 4726 insertions(+), 10 deletions(-) create mode 100644 doc/apis/location-custom-attributes.md create mode 100644 doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md create mode 100644 doc/models/bulk-delete-location-custom-attributes-request.md create mode 100644 doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md create mode 100644 doc/models/bulk-delete-location-custom-attributes-response.md create mode 100644 doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md create mode 100644 doc/models/bulk-upsert-location-custom-attributes-request.md create mode 100644 doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md create mode 100644 doc/models/bulk-upsert-location-custom-attributes-response.md create mode 100644 doc/models/create-location-custom-attribute-definition-request.md create mode 100644 doc/models/create-location-custom-attribute-definition-response.md create mode 100644 doc/models/delete-location-custom-attribute-definition-response.md create mode 100644 doc/models/delete-location-custom-attribute-response.md create mode 100644 doc/models/gift-card-activity-transfer-balance-from.md create mode 100644 doc/models/gift-card-activity-transfer-balance-to.md create mode 100644 doc/models/list-location-custom-attribute-definitions-request.md create mode 100644 doc/models/list-location-custom-attribute-definitions-response.md create mode 100644 doc/models/list-location-custom-attributes-request.md create mode 100644 doc/models/list-location-custom-attributes-response.md create mode 100644 doc/models/retrieve-location-custom-attribute-definition-request.md create mode 100644 doc/models/retrieve-location-custom-attribute-definition-response.md create mode 100644 doc/models/retrieve-location-custom-attribute-request.md create mode 100644 doc/models/retrieve-location-custom-attribute-response.md create mode 100644 doc/models/update-location-custom-attribute-definition-request.md create mode 100644 doc/models/update-location-custom-attribute-definition-response.md create mode 100644 doc/models/upsert-location-custom-attribute-request.md create mode 100644 doc/models/upsert-location-custom-attribute-response.md create mode 100644 src/Apis/LocationCustomAttributesApi.php create mode 100644 src/Models/BulkDeleteLocationCustomAttributesRequest.php create mode 100644 src/Models/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.php create mode 100644 src/Models/BulkDeleteLocationCustomAttributesResponse.php create mode 100644 src/Models/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.php create mode 100644 src/Models/BulkUpsertLocationCustomAttributesRequest.php create mode 100644 src/Models/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.php create mode 100644 src/Models/BulkUpsertLocationCustomAttributesResponse.php create mode 100644 src/Models/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.php create mode 100644 src/Models/CreateLocationCustomAttributeDefinitionRequest.php create mode 100644 src/Models/CreateLocationCustomAttributeDefinitionResponse.php create mode 100644 src/Models/DeleteLocationCustomAttributeDefinitionResponse.php create mode 100644 src/Models/DeleteLocationCustomAttributeResponse.php create mode 100644 src/Models/GiftCardActivityTransferBalanceFrom.php create mode 100644 src/Models/GiftCardActivityTransferBalanceTo.php create mode 100644 src/Models/ListLocationCustomAttributeDefinitionsRequest.php create mode 100644 src/Models/ListLocationCustomAttributeDefinitionsResponse.php create mode 100644 src/Models/ListLocationCustomAttributesRequest.php create mode 100644 src/Models/ListLocationCustomAttributesResponse.php create mode 100644 src/Models/RetrieveLocationCustomAttributeDefinitionRequest.php create mode 100644 src/Models/RetrieveLocationCustomAttributeDefinitionResponse.php create mode 100644 src/Models/RetrieveLocationCustomAttributeRequest.php create mode 100644 src/Models/RetrieveLocationCustomAttributeResponse.php create mode 100644 src/Models/UpdateLocationCustomAttributeDefinitionRequest.php create mode 100644 src/Models/UpdateLocationCustomAttributeDefinitionResponse.php create mode 100644 src/Models/UpsertLocationCustomAttributeRequest.php create mode 100644 src/Models/UpsertLocationCustomAttributeResponse.php diff --git a/LICENSE b/LICENSE index 6863d491..ae39372e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2022 Square, Inc. +Copyright 2023 Square, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/composer.json b/composer.json index 5cd016d9..1ac9aadb 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "square/square", "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", - "version": "25.0.0.20221214", + "version": "25.1.0.20230119", "type": "library", "keywords": [ "Square", diff --git a/doc/apis/location-custom-attributes.md b/doc/apis/location-custom-attributes.md new file mode 100644 index 00000000..a08e38cd --- /dev/null +++ b/doc/apis/location-custom-attributes.md @@ -0,0 +1,561 @@ +# Location Custom Attributes + +```php +$locationCustomAttributesApi = $client->getLocationCustomAttributesApi(); +``` + +## Class Name + +`LocationCustomAttributesApi` + +## Methods + +* [List Location Custom Attribute Definitions](../../doc/apis/location-custom-attributes.md#list-location-custom-attribute-definitions) +* [Create Location Custom Attribute Definition](../../doc/apis/location-custom-attributes.md#create-location-custom-attribute-definition) +* [Delete Location Custom Attribute Definition](../../doc/apis/location-custom-attributes.md#delete-location-custom-attribute-definition) +* [Retrieve Location Custom Attribute Definition](../../doc/apis/location-custom-attributes.md#retrieve-location-custom-attribute-definition) +* [Update Location Custom Attribute Definition](../../doc/apis/location-custom-attributes.md#update-location-custom-attribute-definition) +* [Bulk Delete Location Custom Attributes](../../doc/apis/location-custom-attributes.md#bulk-delete-location-custom-attributes) +* [Bulk Upsert Location Custom Attributes](../../doc/apis/location-custom-attributes.md#bulk-upsert-location-custom-attributes) +* [List Location Custom Attributes](../../doc/apis/location-custom-attributes.md#list-location-custom-attributes) +* [Delete Location Custom Attribute](../../doc/apis/location-custom-attributes.md#delete-location-custom-attribute) +* [Retrieve Location Custom Attribute](../../doc/apis/location-custom-attributes.md#retrieve-location-custom-attribute) +* [Upsert Location Custom Attribute](../../doc/apis/location-custom-attributes.md#upsert-location-custom-attribute) + + +# List Location Custom Attribute Definitions + +Lists the location-related [custom attribute definitions](../../doc/models/custom-attribute-definition.md) that belong to a Square seller account. +When all response pages are retrieved, the results include all custom attribute definitions +that are visible to the requesting application, including those that are created by other +applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +```php +function listLocationCustomAttributeDefinitions( + ?string $visibilityFilter = null, + ?int $limit = null, + ?string $cursor = null +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `visibilityFilter` | [`?string (VisibilityFilter)`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | +| `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | +| `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | + +## Response Type + +[`ListLocationCustomAttributeDefinitionsResponse`](../../doc/models/list-location-custom-attribute-definitions-response.md) + +## Example Usage + +```php +$apiResponse = $locationCustomAttributesApi->listLocationCustomAttributeDefinitions(); + +if ($apiResponse->isSuccess()) { + $listLocationCustomAttributeDefinitionsResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Create Location Custom Attribute Definition + +Creates a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. +Use this endpoint to define a custom attribute that can be associated with locations. +A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties +for a custom attribute. After the definition is created, you can call +[UpsertLocationCustomAttribute](../../doc/apis/location-custom-attributes.md#upsert-location-custom-attribute) or +[BulkUpsertLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-upsert-location-custom-attributes) +to set the custom attribute for locations. + +```php +function createLocationCustomAttributeDefinition( + CreateLocationCustomAttributeDefinitionRequest $body +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`CreateLocationCustomAttributeDefinitionRequest`](../../doc/models/create-location-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +[`CreateLocationCustomAttributeDefinitionResponse`](../../doc/models/create-location-custom-attribute-definition-response.md) + +## Example Usage + +```php +$body_customAttributeDefinition = new Models\CustomAttributeDefinition(); +$body_customAttributeDefinition->setKey('bestseller'); +$body_customAttributeDefinition->setName('Bestseller'); +$body_customAttributeDefinition->setDescription('Bestselling item at location'); +$body_customAttributeDefinition->setVisibility(Models\CustomAttributeDefinitionVisibility::VISIBILITY_READ_WRITE_VALUES); +$body = new Models\CreateLocationCustomAttributeDefinitionRequest( + $body_customAttributeDefinition +); + +$apiResponse = $locationCustomAttributesApi->createLocationCustomAttributeDefinition($body); + +if ($apiResponse->isSuccess()) { + $createLocationCustomAttributeDefinitionResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Delete Location Custom Attribute Definition + +Deletes a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. +Deleting a custom attribute definition also deletes the corresponding custom attribute from +all locations. +Only the definition owner can delete a custom attribute definition. + +```php +function deleteLocationCustomAttributeDefinition(string $key): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `key` | `string` | Template, Required | The key of the custom attribute definition to delete. | + +## Response Type + +[`DeleteLocationCustomAttributeDefinitionResponse`](../../doc/models/delete-location-custom-attribute-definition-response.md) + +## Example Usage + +```php +$key = 'key0'; + +$apiResponse = $locationCustomAttributesApi->deleteLocationCustomAttributeDefinition($key); + +if ($apiResponse->isSuccess()) { + $deleteLocationCustomAttributeDefinitionResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Retrieve Location Custom Attribute Definition + +Retrieves a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. +To retrieve a custom attribute definition created by another application, the `visibility` +setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +```php +function retrieveLocationCustomAttributeDefinition(string $key, ?int $version = null): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `key` | `string` | Template, Required | The key of the custom attribute definition to retrieve. If the requesting application
is not the definition owner, you must use the qualified key. | +| `version` | `?int` | Query, Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | + +## Response Type + +[`RetrieveLocationCustomAttributeDefinitionResponse`](../../doc/models/retrieve-location-custom-attribute-definition-response.md) + +## Example Usage + +```php +$key = 'key0'; + +$apiResponse = $locationCustomAttributesApi->retrieveLocationCustomAttributeDefinition($key); + +if ($apiResponse->isSuccess()) { + $retrieveLocationCustomAttributeDefinitionResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Update Location Custom Attribute Definition + +Updates a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. +Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the +`schema` for a `Selection` data type. +Only the definition owner can update a custom attribute definition. + +```php +function updateLocationCustomAttributeDefinition( + string $key, + UpdateLocationCustomAttributeDefinitionRequest $body +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `key` | `string` | Template, Required | The key of the custom attribute definition to update. | +| `body` | [`UpdateLocationCustomAttributeDefinitionRequest`](../../doc/models/update-location-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +[`UpdateLocationCustomAttributeDefinitionResponse`](../../doc/models/update-location-custom-attribute-definition-response.md) + +## Example Usage + +```php +$key = 'key0'; +$body_customAttributeDefinition = new Models\CustomAttributeDefinition(); +$body_customAttributeDefinition->setDescription('Update the description as desired.'); +$body_customAttributeDefinition->setVisibility(Models\CustomAttributeDefinitionVisibility::VISIBILITY_READ_ONLY); +$body = new Models\UpdateLocationCustomAttributeDefinitionRequest( + $body_customAttributeDefinition +); + +$apiResponse = $locationCustomAttributesApi->updateLocationCustomAttributeDefinition($key, $body); + +if ($apiResponse->isSuccess()) { + $updateLocationCustomAttributeDefinitionResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Bulk Delete Location Custom Attributes + +Deletes [custom attributes](../../doc/models/custom-attribute.md) for locations as a bulk operation. +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. + +```php +function bulkDeleteLocationCustomAttributes(BulkDeleteLocationCustomAttributesRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`BulkDeleteLocationCustomAttributesRequest`](../../doc/models/bulk-delete-location-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +[`BulkDeleteLocationCustomAttributesResponse`](../../doc/models/bulk-delete-location-custom-attributes-response.md) + +## Example Usage + +```php +$body_values = []; + +$body_values[''] = new Models\BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest(); + +$body_values[''] = new Models\BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest(); + +$body_values[''] = new Models\BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest(); + +$body = new Models\BulkDeleteLocationCustomAttributesRequest( + $body_values +); + +$apiResponse = $locationCustomAttributesApi->bulkDeleteLocationCustomAttributes($body); + +if ($apiResponse->isSuccess()) { + $bulkDeleteLocationCustomAttributesResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Bulk Upsert Location Custom Attributes + +Creates or updates [custom attributes](../../doc/models/custom-attribute.md) for locations as a bulk operation. +Use this endpoint to set the value of one or more custom attributes for one or more locations. +A custom attribute is based on a custom attribute definition in a Square seller account, which is +created using the [CreateLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#create-location-custom-attribute-definition) endpoint. +This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert +requests and returns a map of individual upsert responses. Each upsert request has a unique ID +and provides a location ID and custom attribute. Each upsert response is returned with the ID +of the corresponding request. +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. + +```php +function bulkUpsertLocationCustomAttributes(BulkUpsertLocationCustomAttributesRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`BulkUpsertLocationCustomAttributesRequest`](../../doc/models/bulk-upsert-location-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +[`BulkUpsertLocationCustomAttributesResponse`](../../doc/models/bulk-upsert-location-custom-attributes-response.md) + +## Example Usage + +```php +$body_values = []; + +$body_values__locationId = null; +$body_values__customAttribute = new Models\CustomAttribute(); +$body_values[''] = new Models\BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest( + $body_values__locationId, + $body_values__customAttribute +); + +$body_values__locationId = null; +$body_values__customAttribute = new Models\CustomAttribute(); +$body_values[''] = new Models\BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest( + $body_values__locationId, + $body_values__customAttribute +); + +$body = new Models\BulkUpsertLocationCustomAttributesRequest( + $body_values +); + +$apiResponse = $locationCustomAttributesApi->bulkUpsertLocationCustomAttributes($body); + +if ($apiResponse->isSuccess()) { + $bulkUpsertLocationCustomAttributesResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# List Location Custom Attributes + +Lists the [custom attributes](../../doc/models/custom-attribute.md) associated with a location. +You can use the `with_definitions` query parameter to also retrieve custom attribute definitions +in the same call. +When all response pages are retrieved, the results include all custom attributes that are +visible to the requesting application, including those that are owned by other applications +and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +```php +function listLocationCustomAttributes( + string $locationId, + ?string $visibilityFilter = null, + ?int $limit = null, + ?string $cursor = null, + ?bool $withDefinitions = false +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `locationId` | `string` | Template, Required | The ID of the target [location](../../doc/models/location.md). | +| `visibilityFilter` | [`?string (VisibilityFilter)`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | +| `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | +| `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | +| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](../../doc/models/custom-attribute-definition.md) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | + +## Response Type + +[`ListLocationCustomAttributesResponse`](../../doc/models/list-location-custom-attributes-response.md) + +## Example Usage + +```php +$locationId = 'location_id4'; +$withDefinitions = false; + +$apiResponse = $locationCustomAttributesApi->listLocationCustomAttributes($locationId, null, null, null, $withDefinitions); + +if ($apiResponse->isSuccess()) { + $listLocationCustomAttributesResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Delete Location Custom Attribute + +Deletes a [custom attribute](../../doc/models/custom-attribute.md) associated with a location. +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. + +```php +function deleteLocationCustomAttribute(string $locationId, string $key): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `locationId` | `string` | Template, Required | The ID of the target [location](../../doc/models/location.md). | +| `key` | `string` | Template, Required | The key of the custom attribute to delete. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | + +## Response Type + +[`DeleteLocationCustomAttributeResponse`](../../doc/models/delete-location-custom-attribute-response.md) + +## Example Usage + +```php +$locationId = 'location_id4'; +$key = 'key0'; + +$apiResponse = $locationCustomAttributesApi->deleteLocationCustomAttribute($locationId, $key); + +if ($apiResponse->isSuccess()) { + $deleteLocationCustomAttributeResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Retrieve Location Custom Attribute + +Retrieves a [custom attribute](../../doc/models/custom-attribute.md) associated with a location. +You can use the `with_definition` query parameter to also retrieve the custom attribute definition +in the same call. +To retrieve a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +```php +function retrieveLocationCustomAttribute( + string $locationId, + string $key, + ?bool $withDefinition = false, + ?int $version = null +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `locationId` | `string` | Template, Required | The ID of the target [location](../../doc/models/location.md). | +| `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | +| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](../../doc/models/custom-attribute-definition.md) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `version` | `?int` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | + +## Response Type + +[`RetrieveLocationCustomAttributeResponse`](../../doc/models/retrieve-location-custom-attribute-response.md) + +## Example Usage + +```php +$locationId = 'location_id4'; +$key = 'key0'; +$withDefinition = false; + +$apiResponse = $locationCustomAttributesApi->retrieveLocationCustomAttribute($locationId, $key, $withDefinition); + +if ($apiResponse->isSuccess()) { + $retrieveLocationCustomAttributeResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Upsert Location Custom Attribute + +Creates or updates a [custom attribute](../../doc/models/custom-attribute.md) for a location. +Use this endpoint to set the value of a custom attribute for a specified location. +A custom attribute is based on a custom attribute definition in a Square seller account, which +is created using the [CreateLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#create-location-custom-attribute-definition) endpoint. +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. + +```php +function upsertLocationCustomAttribute( + string $locationId, + string $key, + UpsertLocationCustomAttributeRequest $body +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `locationId` | `string` | Template, Required | The ID of the target [location](../../doc/models/location.md). | +| `key` | `string` | Template, Required | The key of the custom attribute to create or update. This key must match the `key` of a
custom attribute definition in the Square seller account. If the requesting application is not
the definition owner, you must use the qualified key. | +| `body` | [`UpsertLocationCustomAttributeRequest`](../../doc/models/upsert-location-custom-attribute-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +[`UpsertLocationCustomAttributeResponse`](../../doc/models/upsert-location-custom-attribute-response.md) + +## Example Usage + +```php +$locationId = 'location_id4'; +$key = 'key0'; +$body_customAttribute = new Models\CustomAttribute(); +$body = new Models\UpsertLocationCustomAttributeRequest( + $body_customAttribute +); + +$apiResponse = $locationCustomAttributesApi->upsertLocationCustomAttribute($locationId, $key, $body); + +if ($apiResponse->isSuccess()) { + $upsertLocationCustomAttributeResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + diff --git a/doc/client.md b/doc/client.md index 59aa04c7..d025a8f7 100644 --- a/doc/client.md +++ b/doc/client.md @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | -| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2022-12-14'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2023-01-19'` | | `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`
*Default*: `'https://connect.squareup.com'` | | `environment` | `string` | The API environment.
**Default: `production`** | | `timeout` | `int` | Timeout for API calls in seconds.
*Default*: `60` | @@ -26,7 +26,7 @@ The API client can be initialized as follows: ```php $client = Square\SquareClientBuilder::init() ->accessToken('AccessToken') - ->squareVersion('2022-12-14') + ->squareVersion('2023-01-19') ->environment('production') ->customUrl('https://connect.squareup.com') ->build(); @@ -49,7 +49,7 @@ require_once "vendor/autoload.php"; $client = Square\SquareClientBuilder::init() ->accessToken('AccessToken') - ->squareVersion('2022-12-14') + ->squareVersion('2023-01-19') ->build(); $locationsApi = $client->getLocationsApi(); @@ -98,6 +98,7 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold | getInvoicesApi() | Gets InvoicesApi | | getLaborApi() | Gets LaborApi | | getLocationsApi() | Gets LocationsApi | +| getLocationCustomAttributesApi() | Gets LocationCustomAttributesApi | | getCheckoutApi() | Gets CheckoutApi | | getTransactionsApi() | Gets TransactionsApi | | getLoyaltyApi() | Gets LoyaltyApi | diff --git a/doc/models/break-type.md b/doc/models/break-type.md index e9bbea18..bebb0d8c 100644 --- a/doc/models/break-type.md +++ b/doc/models/break-type.md @@ -15,7 +15,7 @@ instances on a `Shift`. | `id` | `?string` | Optional | The UUID for this object.
**Constraints**: *Maximum Length*: `255` | getId(): ?string | setId(?string id): void | | `locationId` | `string` | Required | The ID of the business location this type of break applies to.
**Constraints**: *Minimum Length*: `1` | getLocationId(): string | setLocationId(string locationId): void | | `breakName` | `string` | Required | A human-readable name for this type of break. The name is displayed to
employees in Square products.
**Constraints**: *Minimum Length*: `1` | getBreakName(): string | setBreakName(string breakName): void | -| `expectedDuration` | `string` | Required | Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
this break. Precision less than minutes is truncated.
**Constraints**: *Minimum Length*: `1` | getExpectedDuration(): string | setExpectedDuration(string expectedDuration): void | +| `expectedDuration` | `string` | Required | Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
this break. Precision less than minutes is truncated.

Example for break expected duration of 15 minutes: T15M
**Constraints**: *Minimum Length*: `1` | getExpectedDuration(): string | setExpectedDuration(string expectedDuration): void | | `isPaid` | `bool` | Required | Whether this break counts towards time worked for compensation
purposes. | getIsPaid(): bool | setIsPaid(bool isPaid): void | | `version` | `?int` | Optional | Used for resolving concurrency issues. The request fails if the version
provided does not match the server version at the time of the request. If a value is not
provided, Square's servers execute a "blind" write; potentially
overwriting another writer's data. | getVersion(): ?int | setVersion(?int version): void | | `createdAt` | `?string` | Optional | A read-only timestamp in RFC 3339 format. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | diff --git a/doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md b/doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md new file mode 100644 index 00000000..31305477 --- /dev/null +++ b/doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md @@ -0,0 +1,23 @@ + +# Bulk Delete Location Custom Attributes Request Location Custom Attribute Delete Request + +Represents an individual delete request in a [BulkDeleteLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-delete-location-custom-attributes) +request. An individual request contains an optional ID of the associated custom attribute definition +and optional key of the associated custom attribute definition. + +## Structure + +`BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `key` | `?string` | Optional | The key of the associated custom attribute definition.
Represented as a qualified key if the requesting app is not the definition owner.
**Constraints**: *Pattern*: `^([a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]{1,60}$` | getKey(): ?string | setKey(?string key): void | + +## Example (as JSON) + +```json +{} +``` + diff --git a/doc/models/bulk-delete-location-custom-attributes-request.md b/doc/models/bulk-delete-location-custom-attributes-request.md new file mode 100644 index 00000000..c193cfeb --- /dev/null +++ b/doc/models/bulk-delete-location-custom-attributes-request.md @@ -0,0 +1,36 @@ + +# Bulk Delete Location Custom Attributes Request + +Represents a [BulkDeleteLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-delete-location-custom-attributes) request. + +## Structure + +`BulkDeleteLocationCustomAttributesRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `values` | [`array`](../../doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md) | Required | The data used to update the `CustomAttribute` objects.
The keys must be unique and are used to map to the corresponding response. | getValues(): array | setValues(array values): void | + +## Example (as JSON) + +```json +{ + "values": { + "id1": { + "key": "bestseller", + "location_id": "L0TBCBTB7P8RQ" + }, + "id2": { + "key": "bestseller", + "location_id": "L9XMD04V3STJX" + }, + "id3": { + "key": "phone-number", + "location_id": "L0TBCBTB7P8RQ" + } + } +} +``` + diff --git a/doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md b/doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md new file mode 100644 index 00000000..f99de917 --- /dev/null +++ b/doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md @@ -0,0 +1,26 @@ + +# Bulk Delete Location Custom Attributes Response Location Custom Attribute Delete Response + +Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-delete-location-custom-attributes) +request. + +## Structure + +`BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `locationId` | `?string` | Optional | The ID of the location associated with the custom attribute. | getLocationId(): ?string | setLocationId(?string locationId): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "errors": [], + "location_id": "L0TBCBTB7P8RQ" +} +``` + diff --git a/doc/models/bulk-delete-location-custom-attributes-response.md b/doc/models/bulk-delete-location-custom-attributes-response.md new file mode 100644 index 00000000..2396954e --- /dev/null +++ b/doc/models/bulk-delete-location-custom-attributes-response.md @@ -0,0 +1,38 @@ + +# Bulk Delete Location Custom Attributes Response + +Represents a [BulkDeleteLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-delete-location-custom-attributes) response, +which contains a map of responses that each corresponds to an individual delete request. + +## Structure + +`BulkDeleteLocationCustomAttributesResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `values` | [`array`](../../doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md) | Required | A map of responses that correspond to individual delete requests. Each response has the
same key as the corresponding request. | getValues(): array | setValues(array values): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "values": { + "id1": { + "errors": [], + "location_id": "L0TBCBTB7P8RQ" + }, + "id2": { + "errors": [], + "location_id": "L9XMD04V3STJX" + }, + "id3": { + "errors": [], + "location_id": "L0TBCBTB7P8RQ" + } + } +} +``` + diff --git a/doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md b/doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md new file mode 100644 index 00000000..67d4e656 --- /dev/null +++ b/doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md @@ -0,0 +1,35 @@ + +# Bulk Upsert Location Custom Attributes Request Location Custom Attribute Upsert Request + +Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-upsert-location-custom-attributes) +request. An individual request contains a location ID, the custom attribute to create or update, +and an optional idempotency key. + +## Structure + +`BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `locationId` | `string` | Required | The ID of the target [location](../../doc/models/location.md).
**Constraints**: *Minimum Length*: `1` | getLocationId(): string | setLocationId(string locationId): void | +| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | getCustomAttribute(): CustomAttribute | setCustomAttribute(CustomAttribute customAttribute): void | +| `idempotencyKey` | `?string` | Optional | A unique identifier for this individual upsert request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | getIdempotencyKey(): ?string | setIdempotencyKey(?string idempotencyKey): void | + +## Example (as JSON) + +```json +{ + "location_id": "location_id4", + "custom_attribute": { + "key": null, + "value": null, + "version": null, + "visibility": null, + "definition": null + }, + "idempotency_key": null +} +``` + diff --git a/doc/models/bulk-upsert-location-custom-attributes-request.md b/doc/models/bulk-upsert-location-custom-attributes-request.md new file mode 100644 index 00000000..0eee8785 --- /dev/null +++ b/doc/models/bulk-upsert-location-custom-attributes-request.md @@ -0,0 +1,57 @@ + +# Bulk Upsert Location Custom Attributes Request + +Represents a [BulkUpsertLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-upsert-location-custom-attributes) request. + +## Structure + +`BulkUpsertLocationCustomAttributesRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `values` | [`array`](../../doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md) | Required | A map containing 1 to 25 individual upsert requests. For each request, provide an
arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the
information needed to create or update a custom attribute. | getValues(): array | setValues(array values): void | + +## Example (as JSON) + +```json +{ + "values": { + "key0": { + "location_id": "location_id4", + "custom_attribute": { + "key": null, + "value": null, + "version": null, + "visibility": null, + "definition": null + }, + "idempotency_key": null + }, + "key1": { + "location_id": "location_id5", + "custom_attribute": { + "key": null, + "value": null, + "version": null, + "visibility": null, + "definition": null + }, + "idempotency_key": null + }, + "key2": { + "location_id": "location_id6", + "custom_attribute": { + "key": null, + "value": null, + "version": null, + "visibility": null, + "definition": null + }, + "idempotency_key": null + } + } +} +``` + diff --git a/doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md b/doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md new file mode 100644 index 00000000..df9aecd7 --- /dev/null +++ b/doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md @@ -0,0 +1,27 @@ + +# Bulk Upsert Location Custom Attributes Response Location Custom Attribute Upsert Response + +Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-upsert-location-custom-attributes) operation. + +## Structure + +`BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `locationId` | `?string` | Optional | The ID of the location associated with the custom attribute. | getLocationId(): ?string | setLocationId(?string locationId): void | +| `customAttribute` | [`?CustomAttribute`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | getCustomAttribute(): ?CustomAttribute | setCustomAttribute(?CustomAttribute customAttribute): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred while processing the individual request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "location_id": null, + "custom_attribute": null, + "errors": null +} +``` + diff --git a/doc/models/bulk-upsert-location-custom-attributes-response.md b/doc/models/bulk-upsert-location-custom-attributes-response.md new file mode 100644 index 00000000..ba73ff6f --- /dev/null +++ b/doc/models/bulk-upsert-location-custom-attributes-response.md @@ -0,0 +1,26 @@ + +# Bulk Upsert Location Custom Attributes Response + +Represents a [BulkUpsertLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#bulk-upsert-location-custom-attributes) response, +which contains a map of responses that each corresponds to an individual upsert request. + +## Structure + +`BulkUpsertLocationCustomAttributesResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `values` | [`?array`](../../doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md) | Optional | A map of responses that correspond to individual upsert requests. Each response has the
same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or an `errors` field. | getValues(): ?array | setValues(?array values): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "values": null, + "errors": null +} +``` + diff --git a/doc/models/create-location-custom-attribute-definition-request.md b/doc/models/create-location-custom-attribute-definition-request.md new file mode 100644 index 00000000..b443a2e5 --- /dev/null +++ b/doc/models/create-location-custom-attribute-definition-request.md @@ -0,0 +1,30 @@ + +# Create Location Custom Attribute Definition Request + +Represents a [CreateLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#create-location-custom-attribute-definition) request. + +## Structure + +`CreateLocationCustomAttributeDefinitionRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | getCustomAttributeDefinition(): CustomAttributeDefinition | setCustomAttributeDefinition(CustomAttributeDefinition customAttributeDefinition): void | +| `idempotencyKey` | `?string` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | getIdempotencyKey(): ?string | setIdempotencyKey(?string idempotencyKey): void | + +## Example (as JSON) + +```json +{ + "custom_attribute_definition": { + "description": "Bestselling item at location", + "key": "bestseller", + "name": "Bestseller", + "schema": null, + "visibility": "VISIBILITY_READ_WRITE_VALUES" + } +} +``` + diff --git a/doc/models/create-location-custom-attribute-definition-response.md b/doc/models/create-location-custom-attribute-definition-response.md new file mode 100644 index 00000000..85fa32de --- /dev/null +++ b/doc/models/create-location-custom-attribute-definition-response.md @@ -0,0 +1,34 @@ + +# Create Location Custom Attribute Definition Response + +Represents a [CreateLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#create-location-custom-attribute-definition) response. +Either `custom_attribute_definition` or `errors` is present in the response. + +## Structure + +`CreateLocationCustomAttributeDefinitionResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttributeDefinition` | [`?CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | getCustomAttributeDefinition(): ?CustomAttributeDefinition | setCustomAttributeDefinition(?CustomAttributeDefinition customAttributeDefinition): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "custom_attribute_definition": { + "created_at": "2022-12-02T19:06:36.559Z", + "description": "Bestselling item at location", + "key": "bestseller", + "name": "Bestseller", + "schema": null, + "updated_at": "2022-12-02T19:06:36.559Z", + "version": 1, + "visibility": "VISIBILITY_READ_WRITE_VALUES" + } +} +``` + diff --git a/doc/models/delete-location-custom-attribute-definition-response.md b/doc/models/delete-location-custom-attribute-definition-response.md new file mode 100644 index 00000000..6f2f1e76 --- /dev/null +++ b/doc/models/delete-location-custom-attribute-definition-response.md @@ -0,0 +1,21 @@ + +# Delete Location Custom Attribute Definition Response + +Represents a response from a delete request containing error messages if there are any. + +## Structure + +`DeleteLocationCustomAttributeDefinitionResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{} +``` + diff --git a/doc/models/delete-location-custom-attribute-response.md b/doc/models/delete-location-custom-attribute-response.md new file mode 100644 index 00000000..fb899d95 --- /dev/null +++ b/doc/models/delete-location-custom-attribute-response.md @@ -0,0 +1,22 @@ + +# Delete Location Custom Attribute Response + +Represents a [DeleteLocationCustomAttribute](../../doc/apis/location-custom-attributes.md#delete-location-custom-attribute) response. +Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + +## Structure + +`DeleteLocationCustomAttributeResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{} +``` + diff --git a/doc/models/gift-card-activity-transfer-balance-from.md b/doc/models/gift-card-activity-transfer-balance-from.md new file mode 100644 index 00000000..b511bf45 --- /dev/null +++ b/doc/models/gift-card-activity-transfer-balance-from.md @@ -0,0 +1,28 @@ + +# Gift Card Activity Transfer Balance From + +Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](../../doc/models/gift-card-activity-type.md). + +## Structure + +`GiftCardActivityTransferBalanceFrom` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `transferToGiftCardId` | `string` | Required | The ID of the gift card to which the specified amount was transferred. | getTransferToGiftCardId(): string | setTransferToGiftCardId(string transferToGiftCardId): void | +| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | getAmountMoney(): Money | setAmountMoney(Money amountMoney): void | + +## Example (as JSON) + +```json +{ + "transfer_to_gift_card_id": "transfer_to_gift_card_id6", + "amount_money": { + "amount": null, + "currency": null + } +} +``` + diff --git a/doc/models/gift-card-activity-transfer-balance-to.md b/doc/models/gift-card-activity-transfer-balance-to.md new file mode 100644 index 00000000..974de2df --- /dev/null +++ b/doc/models/gift-card-activity-transfer-balance-to.md @@ -0,0 +1,28 @@ + +# Gift Card Activity Transfer Balance To + +Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](../../doc/models/gift-card-activity-type.md). + +## Structure + +`GiftCardActivityTransferBalanceTo` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `transferFromGiftCardId` | `string` | Required | The ID of the gift card from which the specified amount was transferred. | getTransferFromGiftCardId(): string | setTransferFromGiftCardId(string transferFromGiftCardId): void | +| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | getAmountMoney(): Money | setAmountMoney(Money amountMoney): void | + +## Example (as JSON) + +```json +{ + "transfer_from_gift_card_id": "transfer_from_gift_card_id0", + "amount_money": { + "amount": null, + "currency": null + } +} +``` + diff --git a/doc/models/gift-card-activity-type.md b/doc/models/gift-card-activity-type.md index a5185b3f..637f73d2 100644 --- a/doc/models/gift-card-activity-type.md +++ b/doc/models/gift-card-activity-type.md @@ -24,4 +24,6 @@ Indicates the type of [gift card activity](../../doc/models/gift-card-activity.m | `BLOCK` | Temporarily blocked a gift card from balance-changing activities. `BLOCK` activities
are managed by Square and cannot be created using the Gift Card Activities API. | | `UNBLOCK` | Unblocked a gift card, which enables it to resume balance-changing activities. `UNBLOCK`
activities are managed by Square and cannot be created using the Gift Card Activities API. | | `IMPORT_REVERSAL` | Reversed the import of a third-party gift card, which sets the gift card state to
`PENDING` and clears the balance. `IMPORT_REVERSAL` activities are managed by Square and
cannot be created using the Gift Card Activities API. | +| `TRANSFER_BALANCE_FROM` | Deducted money from a gift card as the result of a transfer to the balance of another gift card.
`TRANSFER_BALANCE_FROM` activities are managed by Square and cannot be created using the Gift Card Activities API. | +| `TRANSFER_BALANCE_TO` | Added money to a gift card as the result of a transfer from the balance of another gift card.
`TRANSFER_BALANCE_TO` activities are managed by Square and cannot be created using the Gift Card Activities API. | diff --git a/doc/models/gift-card-activity.md b/doc/models/gift-card-activity.md index 8e9f7e0c..2fde4f70 100644 --- a/doc/models/gift-card-activity.md +++ b/doc/models/gift-card-activity.md @@ -33,6 +33,8 @@ includes a `redeem_activity_details` field that contains information about the r | `blockActivityDetails` | [`?GiftCardActivityBlock`](../../doc/models/gift-card-activity-block.md) | Optional | Represents details about a `BLOCK` [gift card activity type](../../doc/models/gift-card-activity-type.md). | getBlockActivityDetails(): ?GiftCardActivityBlock | setBlockActivityDetails(?GiftCardActivityBlock blockActivityDetails): void | | `unblockActivityDetails` | [`?GiftCardActivityUnblock`](../../doc/models/gift-card-activity-unblock.md) | Optional | Represents details about an `UNBLOCK` [gift card activity type](../../doc/models/gift-card-activity-type.md). | getUnblockActivityDetails(): ?GiftCardActivityUnblock | setUnblockActivityDetails(?GiftCardActivityUnblock unblockActivityDetails): void | | `importReversalActivityDetails` | [`?GiftCardActivityImportReversal`](../../doc/models/gift-card-activity-import-reversal.md) | Optional | Represents details about an `IMPORT_REVERSAL` [gift card activity type](../../doc/models/gift-card-activity-type.md). | getImportReversalActivityDetails(): ?GiftCardActivityImportReversal | setImportReversalActivityDetails(?GiftCardActivityImportReversal importReversalActivityDetails): void | +| `transferBalanceToActivityDetails` | [`?GiftCardActivityTransferBalanceTo`](../../doc/models/gift-card-activity-transfer-balance-to.md) | Optional | Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](../../doc/models/gift-card-activity-type.md). | getTransferBalanceToActivityDetails(): ?GiftCardActivityTransferBalanceTo | setTransferBalanceToActivityDetails(?GiftCardActivityTransferBalanceTo transferBalanceToActivityDetails): void | +| `transferBalanceFromActivityDetails` | [`?GiftCardActivityTransferBalanceFrom`](../../doc/models/gift-card-activity-transfer-balance-from.md) | Optional | Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](../../doc/models/gift-card-activity-type.md). | getTransferBalanceFromActivityDetails(): ?GiftCardActivityTransferBalanceFrom | setTransferBalanceFromActivityDetails(?GiftCardActivityTransferBalanceFrom transferBalanceFromActivityDetails): void | ## Example (as JSON) @@ -55,7 +57,9 @@ includes a `redeem_activity_details` field that contains information about the r "import_activity_details": null, "block_activity_details": null, "unblock_activity_details": null, - "import_reversal_activity_details": null + "import_reversal_activity_details": null, + "transfer_balance_to_activity_details": null, + "transfer_balance_from_activity_details": null } ``` diff --git a/doc/models/list-location-custom-attribute-definitions-request.md b/doc/models/list-location-custom-attribute-definitions-request.md new file mode 100644 index 00000000..72655a51 --- /dev/null +++ b/doc/models/list-location-custom-attribute-definitions-request.md @@ -0,0 +1,27 @@ + +# List Location Custom Attribute Definitions Request + +Represents a [ListLocationCustomAttributeDefinitions](../../doc/apis/location-custom-attributes.md#list-location-custom-attribute-definitions) request. + +## Structure + +`ListLocationCustomAttributeDefinitionsRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `visibilityFilter` | [`?string (VisibilityFilter)`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | getVisibilityFilter(): ?string | setVisibilityFilter(?string visibilityFilter): void | +| `limit` | `?int` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | getLimit(): ?int | setLimit(?int limit): void | +| `cursor` | `?string` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | + +## Example (as JSON) + +```json +{ + "visibility_filter": null, + "limit": null, + "cursor": null +} +``` + diff --git a/doc/models/list-location-custom-attribute-definitions-response.md b/doc/models/list-location-custom-attribute-definitions-response.md new file mode 100644 index 00000000..3982ef01 --- /dev/null +++ b/doc/models/list-location-custom-attribute-definitions-response.md @@ -0,0 +1,49 @@ + +# List Location Custom Attribute Definitions Response + +Represents a [ListLocationCustomAttributeDefinitions](../../doc/apis/location-custom-attributes.md#list-location-custom-attribute-definitions) response. +Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. +If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + +## Structure + +`ListLocationCustomAttributeDefinitionsResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttributeDefinitions` | [`?(CustomAttributeDefinition[])`](../../doc/models/custom-attribute-definition.md) | Optional | The retrieved custom attribute definitions. If no custom attribute definitions are found,
Square returns an empty object (`{}`). | getCustomAttributeDefinitions(): ?array | setCustomAttributeDefinitions(?array customAttributeDefinitions): void | +| `cursor` | `?string` | Optional | The cursor to provide in your next call to this endpoint to retrieve the next page of
results for your original request. This field is present only if the request succeeded and
additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "cursor": "ImfNzWVSiAYyiAR4gEcxDJ75KZAOSjX8H2BVHUTR0ofCtp4SdYvrUKbwYY2aCH2WqZ2FsfAuylEVUlTfaINg3ecIlFpP9Y5Ie66w9NSg9nqdI5fCJ6qdH2s0za5m2plFonsjIuFaoN89j78ROUwuSOzD6mFZPcJHhJ0CxEKc0SBH", + "custom_attribute_definitions": [ + { + "created_at": "2022-12-02T19:50:21.832Z", + "description": "Location's phone number", + "key": "phone-number", + "name": "phone number", + "schema": null, + "updated_at": "2022-12-02T19:50:21.832Z", + "version": 1, + "visibility": "VISIBILITY_READ_ONLY" + }, + { + "created_at": "2022-12-02T19:06:36.559Z", + "description": "Bestselling item at location", + "key": "bestseller", + "name": "Bestseller", + "schema": null, + "updated_at": "2022-12-03T10:17:52.341Z", + "version": 4, + "visibility": "VISIBILITY_READ_WRITE_VALUES" + } + ] +} +``` + diff --git a/doc/models/list-location-custom-attributes-request.md b/doc/models/list-location-custom-attributes-request.md new file mode 100644 index 00000000..c9c09903 --- /dev/null +++ b/doc/models/list-location-custom-attributes-request.md @@ -0,0 +1,29 @@ + +# List Location Custom Attributes Request + +Represents a [ListLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#list-location-custom-attributes) request. + +## Structure + +`ListLocationCustomAttributesRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `visibilityFilter` | [`?string (VisibilityFilter)`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | getVisibilityFilter(): ?string | setVisibilityFilter(?string visibilityFilter): void | +| `limit` | `?int` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | getLimit(): ?int | setLimit(?int limit): void | +| `cursor` | `?string` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `withDefinitions` | `?bool` | Optional | Indicates whether to return the [custom attribute definition](../../doc/models/custom-attribute-definition.md) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | getWithDefinitions(): ?bool | setWithDefinitions(?bool withDefinitions): void | + +## Example (as JSON) + +```json +{ + "visibility_filter": null, + "limit": null, + "cursor": null, + "with_definitions": null +} +``` + diff --git a/doc/models/list-location-custom-attributes-response.md b/doc/models/list-location-custom-attributes-response.md new file mode 100644 index 00000000..c74dfd90 --- /dev/null +++ b/doc/models/list-location-custom-attributes-response.md @@ -0,0 +1,29 @@ + +# List Location Custom Attributes Response + +Represents a [ListLocationCustomAttributes](../../doc/apis/location-custom-attributes.md#list-location-custom-attributes) response. +Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional +results are available, the `cursor` field is also present along with `custom_attributes`. + +## Structure + +`ListLocationCustomAttributesResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttributes` | [`?(CustomAttribute[])`](../../doc/models/custom-attribute.md) | Optional | The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
the custom attribute definition is returned in the `definition` field of each custom attribute.
If no custom attributes are found, Square returns an empty object (`{}`). | getCustomAttributes(): ?array | setCustomAttributes(?array customAttributes): void | +| `cursor` | `?string` | Optional | The cursor to use in your next call to this endpoint to retrieve the next page of results
for your original request. This field is present only if the request succeeded and additional
results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "custom_attributes": null, + "cursor": null, + "errors": null +} +``` + diff --git a/doc/models/retrieve-location-custom-attribute-definition-request.md b/doc/models/retrieve-location-custom-attribute-definition-request.md new file mode 100644 index 00000000..fdef680f --- /dev/null +++ b/doc/models/retrieve-location-custom-attribute-definition-request.md @@ -0,0 +1,23 @@ + +# Retrieve Location Custom Attribute Definition Request + +Represents a [RetrieveLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#retrieve-location-custom-attribute-definition) request. + +## Structure + +`RetrieveLocationCustomAttributeDefinitionRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `version` | `?int` | Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | getVersion(): ?int | setVersion(?int version): void | + +## Example (as JSON) + +```json +{ + "version": null +} +``` + diff --git a/doc/models/retrieve-location-custom-attribute-definition-response.md b/doc/models/retrieve-location-custom-attribute-definition-response.md new file mode 100644 index 00000000..85a98258 --- /dev/null +++ b/doc/models/retrieve-location-custom-attribute-definition-response.md @@ -0,0 +1,34 @@ + +# Retrieve Location Custom Attribute Definition Response + +Represents a [RetrieveLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#retrieve-location-custom-attribute-definition) response. +Either `custom_attribute_definition` or `errors` is present in the response. + +## Structure + +`RetrieveLocationCustomAttributeDefinitionResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttributeDefinition` | [`?CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | getCustomAttributeDefinition(): ?CustomAttributeDefinition | setCustomAttributeDefinition(?CustomAttributeDefinition customAttributeDefinition): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "custom_attribute_definition": { + "created_at": "2022-12-02T19:06:36.559Z", + "description": "Bestselling item at location", + "key": "bestseller", + "name": "Bestseller", + "schema": null, + "updated_at": "2022-12-02T19:06:36.559Z", + "version": 1, + "visibility": "VISIBILITY_READ_WRITE_VALUES" + } +} +``` + diff --git a/doc/models/retrieve-location-custom-attribute-request.md b/doc/models/retrieve-location-custom-attribute-request.md new file mode 100644 index 00000000..8acc5d6f --- /dev/null +++ b/doc/models/retrieve-location-custom-attribute-request.md @@ -0,0 +1,25 @@ + +# Retrieve Location Custom Attribute Request + +Represents a [RetrieveLocationCustomAttribute](../../doc/apis/location-custom-attributes.md#retrieve-location-custom-attribute) request. + +## Structure + +`RetrieveLocationCustomAttributeRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `withDefinition` | `?bool` | Optional | Indicates whether to return the [custom attribute definition](../../doc/models/custom-attribute-definition.md) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | getWithDefinition(): ?bool | setWithDefinition(?bool withDefinition): void | +| `version` | `?int` | Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | getVersion(): ?int | setVersion(?int version): void | + +## Example (as JSON) + +```json +{ + "with_definition": null, + "version": null +} +``` + diff --git a/doc/models/retrieve-location-custom-attribute-response.md b/doc/models/retrieve-location-custom-attribute-response.md new file mode 100644 index 00000000..43e61a59 --- /dev/null +++ b/doc/models/retrieve-location-custom-attribute-response.md @@ -0,0 +1,26 @@ + +# Retrieve Location Custom Attribute Response + +Represents a [RetrieveLocationCustomAttribute](../../doc/apis/location-custom-attributes.md#retrieve-location-custom-attribute) response. +Either `custom_attribute_definition` or `errors` is present in the response. + +## Structure + +`RetrieveLocationCustomAttributeResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttribute` | [`?CustomAttribute`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | getCustomAttribute(): ?CustomAttribute | setCustomAttribute(?CustomAttribute customAttribute): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "custom_attribute": null, + "errors": null +} +``` + diff --git a/doc/models/update-location-custom-attribute-definition-request.md b/doc/models/update-location-custom-attribute-definition-request.md new file mode 100644 index 00000000..f621b9c6 --- /dev/null +++ b/doc/models/update-location-custom-attribute-definition-request.md @@ -0,0 +1,27 @@ + +# Update Location Custom Attribute Definition Request + +Represents an [UpdateLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#update-location-custom-attribute-definition) request. + +## Structure + +`UpdateLocationCustomAttributeDefinitionRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | getCustomAttributeDefinition(): CustomAttributeDefinition | setCustomAttributeDefinition(CustomAttributeDefinition customAttributeDefinition): void | +| `idempotencyKey` | `?string` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | getIdempotencyKey(): ?string | setIdempotencyKey(?string idempotencyKey): void | + +## Example (as JSON) + +```json +{ + "custom_attribute_definition": { + "description": "Update the description as desired.", + "visibility": "VISIBILITY_READ_ONLY" + } +} +``` + diff --git a/doc/models/update-location-custom-attribute-definition-response.md b/doc/models/update-location-custom-attribute-definition-response.md new file mode 100644 index 00000000..bad75bae --- /dev/null +++ b/doc/models/update-location-custom-attribute-definition-response.md @@ -0,0 +1,34 @@ + +# Update Location Custom Attribute Definition Response + +Represents an [UpdateLocationCustomAttributeDefinition](../../doc/apis/location-custom-attributes.md#update-location-custom-attribute-definition) response. +Either `custom_attribute_definition` or `errors` is present in the response. + +## Structure + +`UpdateLocationCustomAttributeDefinitionResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttributeDefinition` | [`?CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | getCustomAttributeDefinition(): ?CustomAttributeDefinition | setCustomAttributeDefinition(?CustomAttributeDefinition customAttributeDefinition): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "custom_attribute_definition": { + "created_at": "2022-12-02T19:06:36.559Z", + "description": "Update the description as desired.", + "key": "bestseller", + "name": "Bestseller", + "schema": null, + "updated_at": "2022-12-02T19:34:10.181Z", + "version": 2, + "visibility": "VISIBILITY_READ_ONLY" + } +} +``` + diff --git a/doc/models/upsert-location-custom-attribute-request.md b/doc/models/upsert-location-custom-attribute-request.md new file mode 100644 index 00000000..b84364f7 --- /dev/null +++ b/doc/models/upsert-location-custom-attribute-request.md @@ -0,0 +1,31 @@ + +# Upsert Location Custom Attribute Request + +Represents an [UpsertLocationCustomAttribute](../../doc/apis/location-custom-attributes.md#upsert-location-custom-attribute) request. + +## Structure + +`UpsertLocationCustomAttributeRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | getCustomAttribute(): CustomAttribute | setCustomAttribute(CustomAttribute customAttribute): void | +| `idempotencyKey` | `?string` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | getIdempotencyKey(): ?string | setIdempotencyKey(?string idempotencyKey): void | + +## Example (as JSON) + +```json +{ + "custom_attribute": { + "key": null, + "value": null, + "version": null, + "visibility": null, + "definition": null + }, + "idempotency_key": null +} +``` + diff --git a/doc/models/upsert-location-custom-attribute-response.md b/doc/models/upsert-location-custom-attribute-response.md new file mode 100644 index 00000000..971129d5 --- /dev/null +++ b/doc/models/upsert-location-custom-attribute-response.md @@ -0,0 +1,26 @@ + +# Upsert Location Custom Attribute Response + +Represents an [UpsertLocationCustomAttribute](../../doc/apis/location-custom-attributes.md#upsert-location-custom-attribute) response. +Either `custom_attribute_definition` or `errors` is present in the response. + +## Structure + +`UpsertLocationCustomAttributeResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customAttribute` | [`?CustomAttribute`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | getCustomAttribute(): ?CustomAttribute | setCustomAttribute(?CustomAttribute customAttribute): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "custom_attribute": null, + "errors": null +} +``` + diff --git a/src/Apis/LocationCustomAttributesApi.php b/src/Apis/LocationCustomAttributesApi.php new file mode 100644 index 00000000..9f02c6b7 --- /dev/null +++ b/src/Apis/LocationCustomAttributesApi.php @@ -0,0 +1,469 @@ +requestBuilder(RequestMethod::GET, '/v2/locations/custom-attribute-definitions') + ->auth('global') + ->parameters( + QueryParam::init('visibility_filter', $visibilityFilter), + QueryParam::init('limit', $limit), + QueryParam::init('cursor', $cursor) + ); + + $_resHandler = $this->responseHandler() + ->type(ListLocationCustomAttributeDefinitionsResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Creates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square + * seller account. + * Use this endpoint to define a custom attribute that can be associated with locations. + * A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties + * for a custom attribute. After the definition is created, you can call + * [UpsertLocationCustomAttribute]($e/LocationCustomAttributes/UpsertLocationCustomAttribute) or + * [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) + * to set the custom attribute for locations. + * + * @param CreateLocationCustomAttributeDefinitionRequest $body An object containing the fields + * to POST for the request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function createLocationCustomAttributeDefinition( + CreateLocationCustomAttributeDefinitionRequest $body + ): ApiResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/locations/custom-attribute-definitions') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler() + ->type(CreateLocationCustomAttributeDefinitionResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Deletes a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square + * seller account. + * Deleting a custom attribute definition also deletes the corresponding custom attribute from + * all locations. + * Only the definition owner can delete a custom attribute definition. + * + * @param string $key The key of the custom attribute definition to delete. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function deleteLocationCustomAttributeDefinition(string $key): ApiResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::DELETE, + '/v2/locations/custom-attribute-definitions/{key}' + )->auth('global')->parameters(TemplateParam::init('key', $key)); + + $_resHandler = $this->responseHandler() + ->type(DeleteLocationCustomAttributeDefinitionResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Retrieves a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a + * Square seller account. + * To retrieve a custom attribute definition created by another application, the `visibility` + * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param string $key The key of the custom attribute definition to retrieve. If the requesting + * application + * is not the definition owner, you must use the qualified key. + * @param int|null $version The current version of the custom attribute definition, which is + * used for strongly consistent + * reads to guarantee that you receive the most up-to-date data. When included in the + * request, + * Square returns the specified version or a higher version if one exists. If the + * specified version + * is higher than the current version, Square returns a `BAD_REQUEST` error. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function retrieveLocationCustomAttributeDefinition(string $key, ?int $version = null): ApiResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/v2/locations/custom-attribute-definitions/{key}' + )->auth('global')->parameters(TemplateParam::init('key', $key), QueryParam::init('version', $version)); + + $_resHandler = $this->responseHandler() + ->type(RetrieveLocationCustomAttributeDefinitionResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square + * seller account. + * Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the + * `schema` for a `Selection` data type. + * Only the definition owner can update a custom attribute definition. + * + * @param string $key The key of the custom attribute definition to update. + * @param UpdateLocationCustomAttributeDefinitionRequest $body An object containing the fields + * to POST for the request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function updateLocationCustomAttributeDefinition( + string $key, + UpdateLocationCustomAttributeDefinitionRequest $body + ): ApiResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/v2/locations/custom-attribute-definitions/{key}' + ) + ->auth('global') + ->parameters( + TemplateParam::init('key', $key), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->type(UpdateLocationCustomAttributeDefinitionResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Deletes [custom attributes]($m/CustomAttribute) for locations as a bulk operation. + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. + * + * @param BulkDeleteLocationCustomAttributesRequest $body An object containing the fields to + * POST for the request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function bulkDeleteLocationCustomAttributes(BulkDeleteLocationCustomAttributesRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/locations/custom-attributes/bulk-delete') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler() + ->type(BulkDeleteLocationCustomAttributesResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Creates or updates [custom attributes]($m/CustomAttribute) for locations as a bulk operation. + * Use this endpoint to set the value of one or more custom attributes for one or more locations. + * A custom attribute is based on a custom attribute definition in a Square seller account, which is + * created using the + * [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeD + * efinition) endpoint. + * This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + * requests and returns a map of individual upsert responses. Each upsert request has a unique ID + * and provides a location ID and custom attribute. Each upsert response is returned with the ID + * of the corresponding request. + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. + * + * @param BulkUpsertLocationCustomAttributesRequest $body An object containing the fields to + * POST for the request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function bulkUpsertLocationCustomAttributes(BulkUpsertLocationCustomAttributesRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/locations/custom-attributes/bulk-upsert') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler() + ->type(BulkUpsertLocationCustomAttributesResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Lists the [custom attributes]($m/CustomAttribute) associated with a location. + * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + * in the same call. + * When all response pages are retrieved, the results include all custom attributes that are + * visible to the requesting application, including those that are owned by other applications + * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param string $locationId The ID of the target [location]($m/Location). + * @param string|null $visibilityFilter Filters the `CustomAttributeDefinition` results by their + * `visibility` values. + * @param int|null $limit The maximum number of results to return in a single paged response. + * This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the + * maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer. + * squareup.com/docs/build-basics/common-api-patterns/pagination). + * @param string|null $cursor The cursor returned in the paged response from the previous call + * to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more + * information, see [Pagination](https://developer.squareup.com/docs/build- + * basics/common-api-patterns/pagination). + * @param bool|null $withDefinitions Indicates whether to return the [custom attribute + * definition]($m/CustomAttributeDefinition) in the `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of + * each custom + * attribute, information about the data type, or other definition details. The default + * value is `false`. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function listLocationCustomAttributes( + string $locationId, + ?string $visibilityFilter = null, + ?int $limit = null, + ?string $cursor = null, + ?bool $withDefinitions = false + ): ApiResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v2/locations/{location_id}/custom-attributes') + ->auth('global') + ->parameters( + TemplateParam::init('location_id', $locationId), + QueryParam::init('visibility_filter', $visibilityFilter), + QueryParam::init('limit', $limit), + QueryParam::init('cursor', $cursor), + QueryParam::init('with_definitions', $withDefinitions) + ); + + $_resHandler = $this->responseHandler() + ->type(ListLocationCustomAttributesResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Deletes a [custom attribute]($m/CustomAttribute) associated with a location. + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. + * + * @param string $locationId The ID of the target [location]($m/Location). + * @param string $key The key of the custom attribute to delete. This key must match the `key` + * of a custom + * attribute definition in the Square seller account. If the requesting application is + * not the + * definition owner, you must use the qualified key. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function deleteLocationCustomAttribute(string $locationId, string $key): ApiResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::DELETE, + '/v2/locations/{location_id}/custom-attributes/{key}' + ) + ->auth('global') + ->parameters(TemplateParam::init('location_id', $locationId), TemplateParam::init('key', $key)); + + $_resHandler = $this->responseHandler() + ->type(DeleteLocationCustomAttributeResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Retrieves a [custom attribute]($m/CustomAttribute) associated with a location. + * You can use the `with_definition` query parameter to also retrieve the custom attribute definition + * in the same call. + * To retrieve a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param string $locationId The ID of the target [location]($m/Location). + * @param string $key The key of the custom attribute to retrieve. This key must match the `key` + * of a custom + * attribute definition in the Square seller account. If the requesting application is + * not the + * definition owner, you must use the qualified key. + * @param bool|null $withDefinition Indicates whether to return the [custom attribute + * definition]($m/CustomAttributeDefinition) in the `definition` field of + * the custom attribute. Set this parameter to `true` to get the name and description + * of the custom + * attribute, information about the data type, or other definition details. The default + * value is `false`. + * @param int|null $version The current version of the custom attribute, which is used for + * strongly consistent reads to + * guarantee that you receive the most up-to-date data. When included in the request, + * Square + * returns the specified version or a higher version if one exists. If the specified + * version is + * higher than the current version, Square returns a `BAD_REQUEST` error. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function retrieveLocationCustomAttribute( + string $locationId, + string $key, + ?bool $withDefinition = false, + ?int $version = null + ): ApiResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/v2/locations/{location_id}/custom-attributes/{key}' + ) + ->auth('global') + ->parameters( + TemplateParam::init('location_id', $locationId), + TemplateParam::init('key', $key), + QueryParam::init('with_definition', $withDefinition), + QueryParam::init('version', $version) + ); + + $_resHandler = $this->responseHandler() + ->type(RetrieveLocationCustomAttributeResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Creates or updates a [custom attribute]($m/CustomAttribute) for a location. + * Use this endpoint to set the value of a custom attribute for a specified location. + * A custom attribute is based on a custom attribute definition in a Square seller account, which + * is created using the + * [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeD + * efinition) endpoint. + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. + * + * @param string $locationId The ID of the target [location]($m/Location). + * @param string $key The key of the custom attribute to create or update. This key must match + * the `key` of a + * custom attribute definition in the Square seller account. If the requesting + * application is not + * the definition owner, you must use the qualified key. + * @param UpsertLocationCustomAttributeRequest $body An object containing the fields to POST for + * the request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function upsertLocationCustomAttribute( + string $locationId, + string $key, + UpsertLocationCustomAttributeRequest $body + ): ApiResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::POST, + '/v2/locations/{location_id}/custom-attributes/{key}' + ) + ->auth('global') + ->parameters( + TemplateParam::init('location_id', $locationId), + TemplateParam::init('key', $key), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->type(UpsertLocationCustomAttributeResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } +} diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index 7a2f5be8..37483d62 100644 --- a/src/ConfigurationDefaults.php +++ b/src/ConfigurationDefaults.php @@ -27,7 +27,7 @@ class ConfigurationDefaults public const HTTP_METHODS_TO_RETRY = ['GET', 'PUT']; - public const SQUARE_VERSION = '2022-12-14'; + public const SQUARE_VERSION = '2023-01-19'; public const ADDITIONAL_HEADERS = []; diff --git a/src/Models/BreakType.php b/src/Models/BreakType.php index 30d39749..9dc4f9c4 100644 --- a/src/Models/BreakType.php +++ b/src/Models/BreakType.php @@ -134,6 +134,8 @@ public function setBreakName(string $breakName): void * Returns Expected Duration. * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of * this break. Precision less than minutes is truncated. + * + * Example for break expected duration of 15 minutes: T15M */ public function getExpectedDuration(): string { @@ -145,6 +147,8 @@ public function getExpectedDuration(): string * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of * this break. Precision less than minutes is truncated. * + * Example for break expected duration of 15 minutes: T15M + * * @required * @maps expected_duration */ diff --git a/src/Models/BulkDeleteLocationCustomAttributesRequest.php b/src/Models/BulkDeleteLocationCustomAttributesRequest.php new file mode 100644 index 00000000..440b134f --- /dev/null +++ b/src/Models/BulkDeleteLocationCustomAttributesRequest.php @@ -0,0 +1,75 @@ + + */ + private $values; + + /** + * @param array $values + */ + public function __construct(array $values) + { + $this->values = $values; + } + + /** + * Returns Values. + * The data used to update the `CustomAttribute` objects. + * The keys must be unique and are used to map to the corresponding response. + * + * @return array + */ + public function getValues(): array + { + return $this->values; + } + + /** + * Sets Values. + * The data used to update the `CustomAttribute` objects. + * The keys must be unique and are used to map to the corresponding response. + * + * @required + * @maps values + * + * @param array $values + */ + public function setValues(array $values): void + { + $this->values = $values; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['values'] = $this->values; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.php b/src/Models/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.php new file mode 100644 index 00000000..b169178d --- /dev/null +++ b/src/Models/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.php @@ -0,0 +1,66 @@ +key; + } + + /** + * Sets Key. + * The key of the associated custom attribute definition. + * Represented as a qualified key if the requesting app is not the definition owner. + * + * @maps key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->key)) { + $json['key'] = $this->key; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkDeleteLocationCustomAttributesResponse.php b/src/Models/BulkDeleteLocationCustomAttributesResponse.php new file mode 100644 index 00000000..c2f20006 --- /dev/null +++ b/src/Models/BulkDeleteLocationCustomAttributesResponse.php @@ -0,0 +1,108 @@ + + */ + private $values; + + /** + * @var Error[]|null + */ + private $errors; + + /** + * @param array $values + */ + public function __construct(array $values) + { + $this->values = $values; + } + + /** + * Returns Values. + * A map of responses that correspond to individual delete requests. Each response has the + * same key as the corresponding request. + * + * @return array + */ + public function getValues(): array + { + return $this->values; + } + + /** + * Sets Values. + * A map of responses that correspond to individual delete requests. Each response has the + * same key as the corresponding request. + * + * @required + * @maps values + * + * @param array $values + */ + public function setValues(array $values): void + { + $this->values = $values; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['values'] = $this->values; + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.php b/src/Models/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.php new file mode 100644 index 00000000..7e810ece --- /dev/null +++ b/src/Models/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.php @@ -0,0 +1,94 @@ +locationId; + } + + /** + * Sets Location Id. + * The ID of the location associated with the custom attribute. + * + * @maps location_id + */ + public function setLocationId(?string $locationId): void + { + $this->locationId = $locationId; + } + + /** + * Returns Errors. + * Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->locationId)) { + $json['location_id'] = $this->locationId; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkUpsertLocationCustomAttributesRequest.php b/src/Models/BulkUpsertLocationCustomAttributesRequest.php new file mode 100644 index 00000000..05fd4f0d --- /dev/null +++ b/src/Models/BulkUpsertLocationCustomAttributesRequest.php @@ -0,0 +1,77 @@ + + */ + private $values; + + /** + * @param array $values + */ + public function __construct(array $values) + { + $this->values = $values; + } + + /** + * Returns Values. + * A map containing 1 to 25 individual upsert requests. For each request, provide an + * arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the + * information needed to create or update a custom attribute. + * + * @return array + */ + public function getValues(): array + { + return $this->values; + } + + /** + * Sets Values. + * A map containing 1 to 25 individual upsert requests. For each request, provide an + * arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the + * information needed to create or update a custom attribute. + * + * @required + * @maps values + * + * @param array $values + */ + public function setValues(array $values): void + { + $this->values = $values; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['values'] = $this->values; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.php b/src/Models/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.php new file mode 100644 index 00000000..4665142d --- /dev/null +++ b/src/Models/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.php @@ -0,0 +1,147 @@ +locationId = $locationId; + $this->customAttribute = $customAttribute; + } + + /** + * Returns Location Id. + * The ID of the target [location]($m/Location). + */ + public function getLocationId(): string + { + return $this->locationId; + } + + /** + * Sets Location Id. + * The ID of the target [location]($m/Location). + * + * @required + * @maps location_id + */ + public function setLocationId(string $locationId): void + { + $this->locationId = $locationId; + } + + /** + * Returns Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + */ + public function getCustomAttribute(): CustomAttribute + { + return $this->customAttribute; + } + + /** + * Sets Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + * + * @required + * @maps custom_attribute + */ + public function setCustomAttribute(CustomAttribute $customAttribute): void + { + $this->customAttribute = $customAttribute; + } + + /** + * Returns Idempotency Key. + * A unique identifier for this individual upsert request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/idempotency). + */ + public function getIdempotencyKey(): ?string + { + if (count($this->idempotencyKey) == 0) { + return null; + } + return $this->idempotencyKey['value']; + } + + /** + * Sets Idempotency Key. + * A unique identifier for this individual upsert request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/idempotency). + * + * @maps idempotency_key + */ + public function setIdempotencyKey(?string $idempotencyKey): void + { + $this->idempotencyKey['value'] = $idempotencyKey; + } + + /** + * Unsets Idempotency Key. + * A unique identifier for this individual upsert request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/idempotency). + */ + public function unsetIdempotencyKey(): void + { + $this->idempotencyKey = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['location_id'] = $this->locationId; + $json['custom_attribute'] = $this->customAttribute; + if (!empty($this->idempotencyKey)) { + $json['idempotency_key'] = $this->idempotencyKey['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkUpsertLocationCustomAttributesResponse.php b/src/Models/BulkUpsertLocationCustomAttributesResponse.php new file mode 100644 index 00000000..3fde63f8 --- /dev/null +++ b/src/Models/BulkUpsertLocationCustomAttributesResponse.php @@ -0,0 +1,103 @@ +|null + */ + private $values; + + /** + * @var Error[]|null + */ + private $errors; + + /** + * Returns Values. + * A map of responses that correspond to individual upsert requests. Each response has the + * same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or + * an `errors` field. + * + * @return array|null + */ + public function getValues(): ?array + { + return $this->values; + } + + /** + * Sets Values. + * A map of responses that correspond to individual upsert requests. Each response has the + * same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or + * an `errors` field. + * + * @maps values + * + * @param array|null $values + */ + public function setValues(?array $values): void + { + $this->values = $values; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->values)) { + $json['values'] = $this->values; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.php b/src/Models/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.php new file mode 100644 index 00000000..c393dec6 --- /dev/null +++ b/src/Models/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.php @@ -0,0 +1,124 @@ +locationId; + } + + /** + * Sets Location Id. + * The ID of the location associated with the custom attribute. + * + * @maps location_id + */ + public function setLocationId(?string $locationId): void + { + $this->locationId = $locationId; + } + + /** + * Returns Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + */ + public function getCustomAttribute(): ?CustomAttribute + { + return $this->customAttribute; + } + + /** + * Sets Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + * + * @maps custom_attribute + */ + public function setCustomAttribute(?CustomAttribute $customAttribute): void + { + $this->customAttribute = $customAttribute; + } + + /** + * Returns Errors. + * Any errors that occurred while processing the individual request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred while processing the individual request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->locationId)) { + $json['location_id'] = $this->locationId; + } + if (isset($this->customAttribute)) { + $json['custom_attribute'] = $this->customAttribute; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateLocationCustomAttributeDefinitionRequest.php b/src/Models/CreateLocationCustomAttributeDefinitionRequest.php new file mode 100644 index 00000000..3f041a0c --- /dev/null +++ b/src/Models/CreateLocationCustomAttributeDefinitionRequest.php @@ -0,0 +1,101 @@ +customAttributeDefinition = $customAttributeDefinition; + } + + /** + * Returns Custom Attribute Definition. + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + */ + public function getCustomAttributeDefinition(): CustomAttributeDefinition + { + return $this->customAttributeDefinition; + } + + /** + * Sets Custom Attribute Definition. + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + * + * @required + * @maps custom_attribute_definition + */ + public function setCustomAttributeDefinition(CustomAttributeDefinition $customAttributeDefinition): void + { + $this->customAttributeDefinition = $customAttributeDefinition; + } + + /** + * Returns Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + public function getIdempotencyKey(): ?string + { + return $this->idempotencyKey; + } + + /** + * Sets Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + * + * @maps idempotency_key + */ + public function setIdempotencyKey(?string $idempotencyKey): void + { + $this->idempotencyKey = $idempotencyKey; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['custom_attribute_definition'] = $this->customAttributeDefinition; + if (isset($this->idempotencyKey)) { + $json['idempotency_key'] = $this->idempotencyKey; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateLocationCustomAttributeDefinitionResponse.php b/src/Models/CreateLocationCustomAttributeDefinitionResponse.php new file mode 100644 index 00000000..5eba3526 --- /dev/null +++ b/src/Models/CreateLocationCustomAttributeDefinitionResponse.php @@ -0,0 +1,97 @@ +customAttributeDefinition; + } + + /** + * Sets Custom Attribute Definition. + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + * + * @maps custom_attribute_definition + */ + public function setCustomAttributeDefinition(?CustomAttributeDefinition $customAttributeDefinition): void + { + $this->customAttributeDefinition = $customAttributeDefinition; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->customAttributeDefinition)) { + $json['custom_attribute_definition'] = $this->customAttributeDefinition; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/DeleteLocationCustomAttributeDefinitionResponse.php b/src/Models/DeleteLocationCustomAttributeDefinitionResponse.php new file mode 100644 index 00000000..1ee7e950 --- /dev/null +++ b/src/Models/DeleteLocationCustomAttributeDefinitionResponse.php @@ -0,0 +1,64 @@ +errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/DeleteLocationCustomAttributeResponse.php b/src/Models/DeleteLocationCustomAttributeResponse.php new file mode 100644 index 00000000..4e6759ed --- /dev/null +++ b/src/Models/DeleteLocationCustomAttributeResponse.php @@ -0,0 +1,66 @@ +errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GiftCardActivity.php b/src/Models/GiftCardActivity.php index c8d85265..de233c66 100644 --- a/src/Models/GiftCardActivity.php +++ b/src/Models/GiftCardActivity.php @@ -114,6 +114,16 @@ class GiftCardActivity implements \JsonSerializable */ private $importReversalActivityDetails; + /** + * @var GiftCardActivityTransferBalanceTo|null + */ + private $transferBalanceToActivityDetails; + + /** + * @var GiftCardActivityTransferBalanceFrom|null + */ + private $transferBalanceFromActivityDetails; + /** * @param string $type * @param string $locationId @@ -578,6 +588,50 @@ public function setImportReversalActivityDetails( $this->importReversalActivityDetails = $importReversalActivityDetails; } + /** + * Returns Transfer Balance to Activity Details. + * Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type]($m/GiftCardActivityType). + */ + public function getTransferBalanceToActivityDetails(): ?GiftCardActivityTransferBalanceTo + { + return $this->transferBalanceToActivityDetails; + } + + /** + * Sets Transfer Balance to Activity Details. + * Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type]($m/GiftCardActivityType). + * + * @maps transfer_balance_to_activity_details + */ + public function setTransferBalanceToActivityDetails( + ?GiftCardActivityTransferBalanceTo $transferBalanceToActivityDetails + ): void { + $this->transferBalanceToActivityDetails = $transferBalanceToActivityDetails; + } + + /** + * Returns Transfer Balance From Activity Details. + * Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity + * type]($m/GiftCardActivityType). + */ + public function getTransferBalanceFromActivityDetails(): ?GiftCardActivityTransferBalanceFrom + { + return $this->transferBalanceFromActivityDetails; + } + + /** + * Sets Transfer Balance From Activity Details. + * Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity + * type]($m/GiftCardActivityType). + * + * @maps transfer_balance_from_activity_details + */ + public function setTransferBalanceFromActivityDetails( + ?GiftCardActivityTransferBalanceFrom $transferBalanceFromActivityDetails + ): void { + $this->transferBalanceFromActivityDetails = $transferBalanceFromActivityDetails; + } + /** * Encode this object to JSON * @@ -646,6 +700,12 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->importReversalActivityDetails)) { $json['import_reversal_activity_details'] = $this->importReversalActivityDetails; } + if (isset($this->transferBalanceToActivityDetails)) { + $json['transfer_balance_to_activity_details'] = $this->transferBalanceToActivityDetails; + } + if (isset($this->transferBalanceFromActivityDetails)) { + $json['transfer_balance_from_activity_details'] = $this->transferBalanceFromActivityDetails; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/GiftCardActivityTransferBalanceFrom.php b/src/Models/GiftCardActivityTransferBalanceFrom.php new file mode 100644 index 00000000..6aadd4d8 --- /dev/null +++ b/src/Models/GiftCardActivityTransferBalanceFrom.php @@ -0,0 +1,109 @@ +transferToGiftCardId = $transferToGiftCardId; + $this->amountMoney = $amountMoney; + } + + /** + * Returns Transfer to Gift Card Id. + * The ID of the gift card to which the specified amount was transferred. + */ + public function getTransferToGiftCardId(): string + { + return $this->transferToGiftCardId; + } + + /** + * Sets Transfer to Gift Card Id. + * The ID of the gift card to which the specified amount was transferred. + * + * @required + * @maps transfer_to_gift_card_id + */ + public function setTransferToGiftCardId(string $transferToGiftCardId): void + { + $this->transferToGiftCardId = $transferToGiftCardId; + } + + /** + * Returns Amount Money. + * Represents an amount of money. `Money` fields can be signed or unsigned. + * Fields that do not explicitly define whether they are signed or unsigned are + * considered unsigned and can only hold positive amounts. For signed fields, the + * sign of the value indicates the purpose of the money transfer. See + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- + * monetary-amounts) + * for more information. + */ + public function getAmountMoney(): Money + { + return $this->amountMoney; + } + + /** + * Sets Amount Money. + * Represents an amount of money. `Money` fields can be signed or unsigned. + * Fields that do not explicitly define whether they are signed or unsigned are + * considered unsigned and can only hold positive amounts. For signed fields, the + * sign of the value indicates the purpose of the money transfer. See + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- + * monetary-amounts) + * for more information. + * + * @required + * @maps amount_money + */ + public function setAmountMoney(Money $amountMoney): void + { + $this->amountMoney = $amountMoney; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['transfer_to_gift_card_id'] = $this->transferToGiftCardId; + $json['amount_money'] = $this->amountMoney; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GiftCardActivityTransferBalanceTo.php b/src/Models/GiftCardActivityTransferBalanceTo.php new file mode 100644 index 00000000..0c44556d --- /dev/null +++ b/src/Models/GiftCardActivityTransferBalanceTo.php @@ -0,0 +1,108 @@ +transferFromGiftCardId = $transferFromGiftCardId; + $this->amountMoney = $amountMoney; + } + + /** + * Returns Transfer From Gift Card Id. + * The ID of the gift card from which the specified amount was transferred. + */ + public function getTransferFromGiftCardId(): string + { + return $this->transferFromGiftCardId; + } + + /** + * Sets Transfer From Gift Card Id. + * The ID of the gift card from which the specified amount was transferred. + * + * @required + * @maps transfer_from_gift_card_id + */ + public function setTransferFromGiftCardId(string $transferFromGiftCardId): void + { + $this->transferFromGiftCardId = $transferFromGiftCardId; + } + + /** + * Returns Amount Money. + * Represents an amount of money. `Money` fields can be signed or unsigned. + * Fields that do not explicitly define whether they are signed or unsigned are + * considered unsigned and can only hold positive amounts. For signed fields, the + * sign of the value indicates the purpose of the money transfer. See + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- + * monetary-amounts) + * for more information. + */ + public function getAmountMoney(): Money + { + return $this->amountMoney; + } + + /** + * Sets Amount Money. + * Represents an amount of money. `Money` fields can be signed or unsigned. + * Fields that do not explicitly define whether they are signed or unsigned are + * considered unsigned and can only hold positive amounts. For signed fields, the + * sign of the value indicates the purpose of the money transfer. See + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- + * monetary-amounts) + * for more information. + * + * @required + * @maps amount_money + */ + public function setAmountMoney(Money $amountMoney): void + { + $this->amountMoney = $amountMoney; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['transfer_from_gift_card_id'] = $this->transferFromGiftCardId; + $json['amount_money'] = $this->amountMoney; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GiftCardActivityType.php b/src/Models/GiftCardActivityType.php index f16f50d1..0f7a9db3 100644 --- a/src/Models/GiftCardActivityType.php +++ b/src/Models/GiftCardActivityType.php @@ -89,4 +89,18 @@ class GiftCardActivityType * cannot be created using the Gift Card Activities API. */ public const IMPORT_REVERSAL = 'IMPORT_REVERSAL'; + + /** + * Deducted money from a gift card as the result of a transfer to the balance of another gift card. + * `TRANSFER_BALANCE_FROM` activities are managed by Square and cannot be created using the Gift Card + * Activities API. + */ + public const TRANSFER_BALANCE_FROM = 'TRANSFER_BALANCE_FROM'; + + /** + * Added money to a gift card as the result of a transfer from the balance of another gift card. + * `TRANSFER_BALANCE_TO` activities are managed by Square and cannot be created using the Gift Card + * Activities API. + */ + public const TRANSFER_BALANCE_TO = 'TRANSFER_BALANCE_TO'; } diff --git a/src/Models/ListLocationCustomAttributeDefinitionsRequest.php b/src/Models/ListLocationCustomAttributeDefinitionsRequest.php new file mode 100644 index 00000000..4d5a6928 --- /dev/null +++ b/src/Models/ListLocationCustomAttributeDefinitionsRequest.php @@ -0,0 +1,165 @@ +visibilityFilter; + } + + /** + * Sets Visibility Filter. + * Enumeration of visibility-filter values used to set the ability to view custom attributes or custom + * attribute definitions. + * + * @maps visibility_filter + */ + public function setVisibilityFilter(?string $visibilityFilter): void + { + $this->visibilityFilter = $visibilityFilter; + } + + /** + * Returns Limit. + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is + * 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + */ + public function getLimit(): ?int + { + if (count($this->limit) == 0) { + return null; + } + return $this->limit['value']; + } + + /** + * Sets Limit. + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is + * 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + * + * @maps limit + */ + public function setLimit(?int $limit): void + { + $this->limit['value'] = $limit; + } + + /** + * Unsets Limit. + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is + * 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + */ + public function unsetLimit(): void + { + $this->limit = []; + } + + /** + * Returns Cursor. + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/pagination). + */ + public function getCursor(): ?string + { + if (count($this->cursor) == 0) { + return null; + } + return $this->cursor['value']; + } + + /** + * Sets Cursor. + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/pagination). + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor['value'] = $cursor; + } + + /** + * Unsets Cursor. + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/pagination). + */ + public function unsetCursor(): void + { + $this->cursor = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->visibilityFilter)) { + $json['visibility_filter'] = $this->visibilityFilter; + } + if (!empty($this->limit)) { + $json['limit'] = $this->limit['value']; + } + if (!empty($this->cursor)) { + $json['cursor'] = $this->cursor['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ListLocationCustomAttributeDefinitionsResponse.php b/src/Models/ListLocationCustomAttributeDefinitionsResponse.php new file mode 100644 index 00000000..1ea7d507 --- /dev/null +++ b/src/Models/ListLocationCustomAttributeDefinitionsResponse.php @@ -0,0 +1,137 @@ +customAttributeDefinitions; + } + + /** + * Sets Custom Attribute Definitions. + * The retrieved custom attribute definitions. If no custom attribute definitions are found, + * Square returns an empty object (`{}`). + * + * @maps custom_attribute_definitions + * + * @param CustomAttributeDefinition[]|null $customAttributeDefinitions + */ + public function setCustomAttributeDefinitions(?array $customAttributeDefinitions): void + { + $this->customAttributeDefinitions = $customAttributeDefinitions; + } + + /** + * Returns Cursor. + * The cursor to provide in your next call to this endpoint to retrieve the next page of + * results for your original request. This field is present only if the request succeeded and + * additional results are available. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * Sets Cursor. + * The cursor to provide in your next call to this endpoint to retrieve the next page of + * results for your original request. This field is present only if the request succeeded and + * additional results are available. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor = $cursor; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->customAttributeDefinitions)) { + $json['custom_attribute_definitions'] = $this->customAttributeDefinitions; + } + if (isset($this->cursor)) { + $json['cursor'] = $this->cursor; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ListLocationCustomAttributesRequest.php b/src/Models/ListLocationCustomAttributesRequest.php new file mode 100644 index 00000000..372d4a26 --- /dev/null +++ b/src/Models/ListLocationCustomAttributesRequest.php @@ -0,0 +1,216 @@ +visibilityFilter; + } + + /** + * Sets Visibility Filter. + * Enumeration of visibility-filter values used to set the ability to view custom attributes or custom + * attribute definitions. + * + * @maps visibility_filter + */ + public function setVisibilityFilter(?string $visibilityFilter): void + { + $this->visibilityFilter = $visibilityFilter; + } + + /** + * Returns Limit. + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is + * 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + */ + public function getLimit(): ?int + { + if (count($this->limit) == 0) { + return null; + } + return $this->limit['value']; + } + + /** + * Sets Limit. + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is + * 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + * + * @maps limit + */ + public function setLimit(?int $limit): void + { + $this->limit['value'] = $limit; + } + + /** + * Unsets Limit. + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is + * 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + */ + public function unsetLimit(): void + { + $this->limit = []; + } + + /** + * Returns Cursor. + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. For more + * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/pagination). + */ + public function getCursor(): ?string + { + if (count($this->cursor) == 0) { + return null; + } + return $this->cursor['value']; + } + + /** + * Sets Cursor. + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. For more + * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/pagination). + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor['value'] = $cursor; + } + + /** + * Unsets Cursor. + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. For more + * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/pagination). + */ + public function unsetCursor(): void + { + $this->cursor = []; + } + + /** + * Returns With Definitions. + * Indicates whether to return the [custom attribute definition]($m/CustomAttributeDefinition) in the + * `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom + * attribute, information about the data type, or other definition details. The default value is + * `false`. + */ + public function getWithDefinitions(): ?bool + { + if (count($this->withDefinitions) == 0) { + return null; + } + return $this->withDefinitions['value']; + } + + /** + * Sets With Definitions. + * Indicates whether to return the [custom attribute definition]($m/CustomAttributeDefinition) in the + * `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom + * attribute, information about the data type, or other definition details. The default value is + * `false`. + * + * @maps with_definitions + */ + public function setWithDefinitions(?bool $withDefinitions): void + { + $this->withDefinitions['value'] = $withDefinitions; + } + + /** + * Unsets With Definitions. + * Indicates whether to return the [custom attribute definition]($m/CustomAttributeDefinition) in the + * `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom + * attribute, information about the data type, or other definition details. The default value is + * `false`. + */ + public function unsetWithDefinitions(): void + { + $this->withDefinitions = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->visibilityFilter)) { + $json['visibility_filter'] = $this->visibilityFilter; + } + if (!empty($this->limit)) { + $json['limit'] = $this->limit['value']; + } + if (!empty($this->cursor)) { + $json['cursor'] = $this->cursor['value']; + } + if (!empty($this->withDefinitions)) { + $json['with_definitions'] = $this->withDefinitions['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ListLocationCustomAttributesResponse.php b/src/Models/ListLocationCustomAttributesResponse.php new file mode 100644 index 00000000..0250c9c4 --- /dev/null +++ b/src/Models/ListLocationCustomAttributesResponse.php @@ -0,0 +1,137 @@ +customAttributes; + } + + /** + * Sets Custom Attributes. + * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field of each custom attribute. + * If no custom attributes are found, Square returns an empty object (`{}`). + * + * @maps custom_attributes + * + * @param CustomAttribute[]|null $customAttributes + */ + public function setCustomAttributes(?array $customAttributes): void + { + $this->customAttributes = $customAttributes; + } + + /** + * Returns Cursor. + * The cursor to use in your next call to this endpoint to retrieve the next page of results + * for your original request. This field is present only if the request succeeded and additional + * results are available. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * Sets Cursor. + * The cursor to use in your next call to this endpoint to retrieve the next page of results + * for your original request. This field is present only if the request succeeded and additional + * results are available. For more information, see [Pagination](https://developer.squareup. + * com/docs/build-basics/common-api-patterns/pagination). + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor = $cursor; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->customAttributes)) { + $json['custom_attributes'] = $this->customAttributes; + } + if (isset($this->cursor)) { + $json['cursor'] = $this->cursor; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/RetrieveLocationCustomAttributeDefinitionRequest.php b/src/Models/RetrieveLocationCustomAttributeDefinitionRequest.php new file mode 100644 index 00000000..59c60e4c --- /dev/null +++ b/src/Models/RetrieveLocationCustomAttributeDefinitionRequest.php @@ -0,0 +1,68 @@ +version; + } + + /** + * Sets Version. + * The current version of the custom attribute definition, which is used for strongly consistent + * reads to guarantee that you receive the most up-to-date data. When included in the request, + * Square returns the specified version or a higher version if one exists. If the specified version + * is higher than the current version, Square returns a `BAD_REQUEST` error. + * + * @maps version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->version)) { + $json['version'] = $this->version; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/RetrieveLocationCustomAttributeDefinitionResponse.php b/src/Models/RetrieveLocationCustomAttributeDefinitionResponse.php new file mode 100644 index 00000000..39ed1aa9 --- /dev/null +++ b/src/Models/RetrieveLocationCustomAttributeDefinitionResponse.php @@ -0,0 +1,97 @@ +customAttributeDefinition; + } + + /** + * Sets Custom Attribute Definition. + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + * + * @maps custom_attribute_definition + */ + public function setCustomAttributeDefinition(?CustomAttributeDefinition $customAttributeDefinition): void + { + $this->customAttributeDefinition = $customAttributeDefinition; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->customAttributeDefinition)) { + $json['custom_attribute_definition'] = $this->customAttributeDefinition; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/RetrieveLocationCustomAttributeRequest.php b/src/Models/RetrieveLocationCustomAttributeRequest.php new file mode 100644 index 00000000..9ce3711a --- /dev/null +++ b/src/Models/RetrieveLocationCustomAttributeRequest.php @@ -0,0 +1,120 @@ +withDefinition) == 0) { + return null; + } + return $this->withDefinition['value']; + } + + /** + * Sets With Definition. + * Indicates whether to return the [custom attribute definition]($m/CustomAttributeDefinition) in the + * `definition` field of + * the custom attribute. Set this parameter to `true` to get the name and description of the custom + * attribute, information about the data type, or other definition details. The default value is + * `false`. + * + * @maps with_definition + */ + public function setWithDefinition(?bool $withDefinition): void + { + $this->withDefinition['value'] = $withDefinition; + } + + /** + * Unsets With Definition. + * Indicates whether to return the [custom attribute definition]($m/CustomAttributeDefinition) in the + * `definition` field of + * the custom attribute. Set this parameter to `true` to get the name and description of the custom + * attribute, information about the data type, or other definition details. The default value is + * `false`. + */ + public function unsetWithDefinition(): void + { + $this->withDefinition = []; + } + + /** + * Returns Version. + * The current version of the custom attribute, which is used for strongly consistent reads to + * guarantee that you receive the most up-to-date data. When included in the request, Square + * returns the specified version or a higher version if one exists. If the specified version is + * higher than the current version, Square returns a `BAD_REQUEST` error. + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * Sets Version. + * The current version of the custom attribute, which is used for strongly consistent reads to + * guarantee that you receive the most up-to-date data. When included in the request, Square + * returns the specified version or a higher version if one exists. If the specified version is + * higher than the current version, Square returns a `BAD_REQUEST` error. + * + * @maps version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (!empty($this->withDefinition)) { + $json['with_definition'] = $this->withDefinition['value']; + } + if (isset($this->version)) { + $json['version'] = $this->version; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/RetrieveLocationCustomAttributeResponse.php b/src/Models/RetrieveLocationCustomAttributeResponse.php new file mode 100644 index 00000000..37d5841a --- /dev/null +++ b/src/Models/RetrieveLocationCustomAttributeResponse.php @@ -0,0 +1,97 @@ +customAttribute; + } + + /** + * Sets Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + * + * @maps custom_attribute + */ + public function setCustomAttribute(?CustomAttribute $customAttribute): void + { + $this->customAttribute = $customAttribute; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->customAttribute)) { + $json['custom_attribute'] = $this->customAttribute; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/UpdateLocationCustomAttributeDefinitionRequest.php b/src/Models/UpdateLocationCustomAttributeDefinitionRequest.php new file mode 100644 index 00000000..da97e683 --- /dev/null +++ b/src/Models/UpdateLocationCustomAttributeDefinitionRequest.php @@ -0,0 +1,114 @@ +customAttributeDefinition = $customAttributeDefinition; + } + + /** + * Returns Custom Attribute Definition. + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + */ + public function getCustomAttributeDefinition(): CustomAttributeDefinition + { + return $this->customAttributeDefinition; + } + + /** + * Sets Custom Attribute Definition. + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + * + * @required + * @maps custom_attribute_definition + */ + public function setCustomAttributeDefinition(CustomAttributeDefinition $customAttributeDefinition): void + { + $this->customAttributeDefinition = $customAttributeDefinition; + } + + /** + * Returns Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + public function getIdempotencyKey(): ?string + { + if (count($this->idempotencyKey) == 0) { + return null; + } + return $this->idempotencyKey['value']; + } + + /** + * Sets Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + * + * @maps idempotency_key + */ + public function setIdempotencyKey(?string $idempotencyKey): void + { + $this->idempotencyKey['value'] = $idempotencyKey; + } + + /** + * Unsets Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + public function unsetIdempotencyKey(): void + { + $this->idempotencyKey = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['custom_attribute_definition'] = $this->customAttributeDefinition; + if (!empty($this->idempotencyKey)) { + $json['idempotency_key'] = $this->idempotencyKey['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/UpdateLocationCustomAttributeDefinitionResponse.php b/src/Models/UpdateLocationCustomAttributeDefinitionResponse.php new file mode 100644 index 00000000..d7ee880a --- /dev/null +++ b/src/Models/UpdateLocationCustomAttributeDefinitionResponse.php @@ -0,0 +1,97 @@ +customAttributeDefinition; + } + + /** + * Sets Custom Attribute Definition. + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + * + * @maps custom_attribute_definition + */ + public function setCustomAttributeDefinition(?CustomAttributeDefinition $customAttributeDefinition): void + { + $this->customAttributeDefinition = $customAttributeDefinition; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->customAttributeDefinition)) { + $json['custom_attribute_definition'] = $this->customAttributeDefinition; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/UpsertLocationCustomAttributeRequest.php b/src/Models/UpsertLocationCustomAttributeRequest.php new file mode 100644 index 00000000..7304c778 --- /dev/null +++ b/src/Models/UpsertLocationCustomAttributeRequest.php @@ -0,0 +1,113 @@ +customAttribute = $customAttribute; + } + + /** + * Returns Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + */ + public function getCustomAttribute(): CustomAttribute + { + return $this->customAttribute; + } + + /** + * Sets Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + * + * @required + * @maps custom_attribute + */ + public function setCustomAttribute(CustomAttribute $customAttribute): void + { + $this->customAttribute = $customAttribute; + } + + /** + * Returns Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + public function getIdempotencyKey(): ?string + { + if (count($this->idempotencyKey) == 0) { + return null; + } + return $this->idempotencyKey['value']; + } + + /** + * Sets Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + * + * @maps idempotency_key + */ + public function setIdempotencyKey(?string $idempotencyKey): void + { + $this->idempotencyKey['value'] = $idempotencyKey; + } + + /** + * Unsets Idempotency Key. + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + public function unsetIdempotencyKey(): void + { + $this->idempotencyKey = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['custom_attribute'] = $this->customAttribute; + if (!empty($this->idempotencyKey)) { + $json['idempotency_key'] = $this->idempotencyKey['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/UpsertLocationCustomAttributeResponse.php b/src/Models/UpsertLocationCustomAttributeResponse.php new file mode 100644 index 00000000..55d802da --- /dev/null +++ b/src/Models/UpsertLocationCustomAttributeResponse.php @@ -0,0 +1,96 @@ +customAttribute; + } + + /** + * Sets Custom Attribute. + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + * + * @maps custom_attribute + */ + public function setCustomAttribute(?CustomAttribute $customAttribute): void + { + $this->customAttribute = $customAttribute; + } + + /** + * Returns Errors. + * Any errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any errors that occurred during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->customAttribute)) { + $json['custom_attribute'] = $this->customAttribute; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/SquareClient.php b/src/SquareClient.php index 86374845..f05613d4 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -29,6 +29,7 @@ use Square\Apis\InventoryApi; use Square\Apis\InvoicesApi; use Square\Apis\LaborApi; +use Square\Apis\LocationCustomAttributesApi; use Square\Apis\LocationsApi; use Square\Apis\LoyaltyApi; use Square\Apis\MerchantsApi; @@ -100,6 +101,8 @@ class SquareClient implements ConfigurationInterface private $locations; + private $locationCustomAttributes; + private $checkout; private $transactions; @@ -156,7 +159,7 @@ public function __construct(array $config = []) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) ->userAgent( - 'Square-PHP-SDK/25.0.0.20221214 ({api-version}) {engine}/{engine-version} ({os-' . + 'Square-PHP-SDK/25.1.0.20230119 ({api-version}) {engine}/{engine-version} ({os-' . 'info}) {detail}' ) ->userAgentConfig( @@ -298,7 +301,7 @@ public function withConfiguration(array $config): self */ public function getSdkVersion(): string { - return '25.0.0.20221214'; + return '25.1.0.20230119'; } /** @@ -576,6 +579,17 @@ public function getLocationsApi(): LocationsApi return $this->locations; } + /** + * Returns Location Custom Attributes Api + */ + public function getLocationCustomAttributesApi(): LocationCustomAttributesApi + { + if ($this->locationCustomAttributes == null) { + $this->locationCustomAttributes = new LocationCustomAttributesApi($this->client); + } + return $this->locationCustomAttributes; + } + /** * Returns Checkout Api */