From e168122f64e08faa2d4b36608c5adc58d969bc90 Mon Sep 17 00:00:00 2001 From: autobot Date: Tue, 16 Apr 2024 22:35:40 +0000 Subject: [PATCH] Generated PR for Release: 36.0.0.20240417 --- .github/pull_request_template.md | 4 + doc/api/o-auth.md | 71 ---------------- doc/client.md | 6 +- .../catalog-custom-attribute-definition.md | 2 +- doc/models/order-line-item-tax.md | 2 +- doc/models/order.md | 4 +- doc/models/renew-token-request.md | 21 ----- doc/models/renew-token-response.md | 31 ------- pyproject.toml | 4 +- requirements.txt | 1 - square/api/base_api.py | 2 +- square/api/o_auth_api.py | 80 ------------------- square/client.py | 6 +- square/configuration.py | 2 +- tests/api/test_locations_api.py | 1 - 15 files changed, 18 insertions(+), 219 deletions(-) create mode 100644 .github/pull_request_template.md delete mode 100644 doc/models/renew-token-request.md delete mode 100644 doc/models/renew-token-response.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..77bc5759 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,4 @@ +# **ATTENTION** +This repository **cannot** accept Pull Requests. If you wish to proceed with opening this PR, please understand that your code **will not** be pulled into this repository. Consider opening an issue which lays out the problem instead. Thank you very much for your efforts and highlighting issues! + +Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, [join us in our Square Developer Discord server](https://discord.com/invite/squaredev) or [post in our Developer Forums](https://developer.squareup.com/forums). For private support, [contact our Developer Success Engineers](https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68) directly. diff --git a/doc/api/o-auth.md b/doc/api/o-auth.md index 2b6ea271..691a05f7 100644 --- a/doc/api/o-auth.md +++ b/doc/api/o-auth.md @@ -10,82 +10,11 @@ o_auth_api = client.o_auth ## Methods -* [Renew Token](../../doc/api/o-auth.md#renew-token) * [Revoke Token](../../doc/api/o-auth.md#revoke-token) * [Obtain Token](../../doc/api/o-auth.md#obtain-token) * [Retrieve Token Status](../../doc/api/o-auth.md#retrieve-token-status) -# Renew Token - -**This endpoint is deprecated.** - -`RenewToken` is deprecated. For information about refreshing OAuth access tokens, see -[Migrate from Renew to Refresh OAuth Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens). - -Renews an OAuth access token before it expires. - -OAuth access tokens besides your application's personal access token expire after 30 days. -You can also renew expired tokens within 15 days of their expiration. -You cannot renew an access token that has been expired for more than 15 days. -Instead, the associated user must recomplete the OAuth flow from the beginning. - -__Important:__ The `Authorization` header for this endpoint must have the -following format: - -``` -Authorization: Client APPLICATION_SECRET -``` - -Replace `APPLICATION_SECRET` with the application secret on the **Credentials** -page in the [Developer Dashboard](https://developer.squareup.com/apps). - -:information_source: **Note** This endpoint does not require authentication. - -```python -def renew_token(self, - client_id, - body, - authorization) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `client_id` | `str` | Template, Required | Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps). | -| `body` | [`Renew Token Request`](../../doc/models/renew-token-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `authorization` | `str` | Header, Required | Client APPLICATION_SECRET | - -## Response Type - -This method returns a `ApiResponse` instance. The `body` property of this instance returns the response data which is of type [`Renew Token Response`](../../doc/models/renew-token-response.md). - -## Example Usage - -```python -client_id = 'client_id8' - -body = { - 'access_token': 'ACCESS_TOKEN' -} - -authorization = 'Client CLIENT_SECRET' - -result = o_auth_api.renew_token( - client_id, - body, - authorization -) -print(result) - -if result.is_success(): - print(result.body) -elif result.is_error(): - print(result.errors) -``` - - # Revoke Token Revokes an access token generated with the OAuth flow. diff --git a/doc/client.md b/doc/client.md index 992d0cd5..bb2b1b05 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 | | --- | --- | --- | -| `square_version` | `str` | Square Connect API versions
*Default*: `'2024-03-20'` | +| `square_version` | `str` | Square Connect API versions
*Default*: `'2024-04-17'` | | `custom_url` | `str` | 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`** | | `http_client_instance` | `HttpClient` | The Http Client passed from the sdk user for making requests | @@ -24,7 +24,7 @@ The API client can be initialized as follows: ```python client = Client( - square_version='2024-03-20', + square_version='2024-04-17', bearer_auth_credentials=BearerAuthCredentials( access_token='AccessToken' ) @@ -51,7 +51,7 @@ from square.http.auth.o_auth_2 import BearerAuthCredentials from square.client import Client client = Client( - square_version='2024-03-20', + square_version='2024-04-17', bearer_auth_credentials=BearerAuthCredentials( access_token='AccessToken' ) diff --git a/doc/models/catalog-custom-attribute-definition.md b/doc/models/catalog-custom-attribute-definition.md index 3b3daa53..3defdbd7 100644 --- a/doc/models/catalog-custom-attribute-definition.md +++ b/doc/models/catalog-custom-attribute-definition.md @@ -19,7 +19,7 @@ to store any sensitive information (personally identifiable information, card de | `name` | `str` | Required | The name of this definition for API and seller-facing UI purposes.
The name must be unique within the (merchant, application) pair. Required.
May not be empty and may not exceed 255 characters. Can be modified after creation.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | | `description` | `str` | Optional | Seller-oriented description of the meaning of this Custom Attribute,
any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs.
**Constraints**: *Maximum Length*: `255` | | `source_application` | [`Source Application`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. | -| `allowed_object_types` | [`str (List Catalog Object Type)`](../../doc/models/catalog-object-type.md) | Required | The set of `CatalogObject` types that this custom atttribute may be applied to.
Currently, only `ITEM`, `ITEM_VARIATION`, and `MODIFIER` are allowed. At least one type must be included.
See [CatalogObjectType](#type-catalogobjecttype) for possible values | +| `allowed_object_types` | [`str (List Catalog Object Type)`](../../doc/models/catalog-object-type.md) | Required | The set of `CatalogObject` types that this custom atttribute may be applied to.
Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included.
See [CatalogObjectType](#type-catalogobjecttype) for possible values | | `seller_visibility` | [`str (Catalog Custom Attribute Definition Seller Visibility)`](../../doc/models/catalog-custom-attribute-definition-seller-visibility.md) | Optional | Defines the visibility of a custom attribute to sellers in Square
client applications, Square APIs or in Square UIs (including Square Point
of Sale applications and Square Dashboard). | | `app_visibility` | [`str (Catalog Custom Attribute Definition App Visibility)`](../../doc/models/catalog-custom-attribute-definition-app-visibility.md) | Optional | Defines the visibility of a custom attribute to applications other than their
creating application. | | `string_config` | [`Catalog Custom Attribute Definition String Config`](../../doc/models/catalog-custom-attribute-definition-string-config.md) | Optional | Configuration associated with Custom Attribute Definitions of type `STRING`. | diff --git a/doc/models/order-line-item-tax.md b/doc/models/order-line-item-tax.md index 629bb974..c1773cbd 100644 --- a/doc/models/order-line-item-tax.md +++ b/doc/models/order-line-item-tax.md @@ -20,7 +20,7 @@ contributes to the order subtotal. | `catalog_version` | `long\|int` | Optional | The version of the catalog object that this tax references. | | `name` | `str` | Optional | The tax's name.
**Constraints**: *Maximum Length*: `255` | | `type` | [`str (Order Line Item Tax Type)`](../../doc/models/order-line-item-tax-type.md) | Optional | Indicates how the tax is applied to the associated line item or order. | -| `percentage` | `str` | Optional | The percentage of the tax, as a string representation of a decimal
number. For example, a value of `"7.25"` corresponds to a percentage of
7.25%.

Either `percentage` or `amount_money` should be set, but not both.
**Constraints**: *Maximum Length*: `10` | +| `percentage` | `str` | Optional | The percentage of the tax, as a string representation of a decimal
number. For example, a value of `"7.25"` corresponds to a percentage of
7.25%.
**Constraints**: *Maximum Length*: `10` | | `metadata` | `Dict[str, str]` | Optional | Application-defined data attached to this tax. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | | `applied_money` | [`Money`](../../doc/models/money.md) | Optional | 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. | | `scope` | [`str (Order Line Item Tax Scope)`](../../doc/models/order-line-item-tax-scope.md) | Optional | Indicates whether this is a line-item or order-level tax. | diff --git a/doc/models/order.md b/doc/models/order.md index dd52859c..2e190910 100644 --- a/doc/models/order.md +++ b/doc/models/order.md @@ -33,8 +33,8 @@ itemization data. | `tenders` | [`List Tender`](../../doc/models/tender.md) | Optional | The tenders that were used to pay for the order. | | `refunds` | [`List Refund`](../../doc/models/refund.md) | Optional | The refunds that are part of this order. | | `metadata` | `Dict[str, str]` | Optional | Application-defined data attached to this order. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `created_at` | `str` | Optional | The timestamp for when the order was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `updated_at` | `str` | Optional | The timestamp for when the order was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | +| `created_at` | `str` | Optional | The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | +| `updated_at` | `str` | Optional | The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | | `closed_at` | `str` | Optional | The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). | | `state` | [`str (Order State)`](../../doc/models/order-state.md) | Optional | The state of the order. | | `version` | `int` | Optional | The version number, which is incremented each time an update is committed to the order.
Orders not created through the API do not include a version number and
therefore cannot be updated.

[Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). | diff --git a/doc/models/renew-token-request.md b/doc/models/renew-token-request.md deleted file mode 100644 index d3be8c6a..00000000 --- a/doc/models/renew-token-request.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Renew Token Request - -## Structure - -`Renew Token Request` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `access_token` | `str` | Optional | The token you want to renew.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | - -## Example (as JSON) - -```json -{ - "access_token": "ACCESS_TOKEN" -} -``` - diff --git a/doc/models/renew-token-response.md b/doc/models/renew-token-response.md deleted file mode 100644 index e0280a57..00000000 --- a/doc/models/renew-token-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Renew Token Response - -## Structure - -`Renew Token Response` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `access_token` | `str` | Optional | The renewed access token.
This value might be different from the `access_token` you provided in your request.
You provide this token in a header with every request to Connect API endpoints.
See [Request and response headers](https://developer.squareup.com/docs/api/connect/v2/#requestandresponseheaders) for the format of this header.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | -| `token_type` | `str` | Optional | This value is always _bearer_.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `10` | -| `expires_at` | `str` | Optional | The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `48` | -| `merchant_id` | `str` | Optional | The ID of the authorizing merchant's business.
**Constraints**: *Minimum Length*: `8`, *Maximum Length*: `191` | -| `subscription_id` | `str` | Optional | __LEGACY FIELD__. The ID of the merchant subscription associated with
the authorization. The ID is only present if the merchant signed up for a subscription
during authorization. | -| `plan_id` | `str` | Optional | __LEGACY FIELD__. The ID of the subscription plan the merchant signed
up for. The ID is only present if the merchant signed up for a subscription plan during
authorization. | -| `errors` | [`List Error`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "access_token": "ACCESS_TOKEN", - "expires_at": "2006-01-02T15:04:05Z", - "merchant_id": "MERCHANT_ID", - "token_type": "bearer", - "subscription_id": "subscription_id8" -} -``` - diff --git a/pyproject.toml b/pyproject.toml index 57545fa9..109e4ac5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,11 +4,11 @@ requires = ["setuptools>=61.0"] [project] name = "squareup" description = "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management." -version = "35.1.0.20240320" +version = "36.0.0.20240417" readme = "README.md" requires-python = ">=3.7" authors = [{name = "Square Developer Platform", email = "developers@squareup.com"}] -dependencies = ["apimatic-core~=0.2.0", "apimatic-core-interfaces~=0.1.0", "apimatic-requests-client-adapter~=0.1.0", "python-dateutil~=2.8.1", "deprecation~=2.1"] +dependencies = ["apimatic-core~=0.2.0", "apimatic-core-interfaces~=0.1.0", "apimatic-requests-client-adapter~=0.1.0", "deprecation~=2.1"] [project.optional-dependencies] testutils = ["pytest>=7.2.2"] [tool.setuptools.packages.find] diff --git a/requirements.txt b/requirements.txt index 1d9ad37c..26c48167 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ apimatic-core~=0.2.0 apimatic-core-interfaces~=0.1.0 apimatic-requests-client-adapter~=0.1.0 -python-dateutil~=2.8.1 deprecation~=2.1 diff --git a/square/api/base_api.py b/square/api/base_api.py index b5ec78bb..4b4e2846 100644 --- a/square/api/base_api.py +++ b/square/api/base_api.py @@ -22,7 +22,7 @@ class BaseApi(object): @staticmethod def user_agent(): - return 'Square-Python-SDK/35.1.0.20240320 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}' + return 'Square-Python-SDK/36.0.0.20240417 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}' @staticmethod def user_agent_parameters(): diff --git a/square/api/o_auth_api.py b/square/api/o_auth_api.py index 4c3ddcfb..2a720042 100644 --- a/square/api/o_auth_api.py +++ b/square/api/o_auth_api.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from deprecation import deprecated from square.api_helper import APIHelper from square.http.api_response import ApiResponse from square.api.base_api import BaseApi @@ -16,85 +15,6 @@ class OAuthApi(BaseApi): def __init__(self, config): super(OAuthApi, self).__init__(config) - @deprecated() - def renew_token(self, - client_id, - body, - authorization): - """Does a POST request to /oauth2/clients/{client_id}/access-token/renew. - - `RenewToken` is deprecated. For information about refreshing OAuth - access tokens, see - [Migrate from Renew to Refresh OAuth - Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refres - h-tokens). - Renews an OAuth access token before it expires. - OAuth access tokens besides your application's personal access token - expire after 30 days. - You can also renew expired tokens within 15 days of their expiration. - You cannot renew an access token that has been expired for more than - 15 days. - Instead, the associated user must recomplete the OAuth flow from the - beginning. - __Important:__ The `Authorization` header for this endpoint must have - the - following format: - ``` - Authorization: Client APPLICATION_SECRET - ``` - Replace `APPLICATION_SECRET` with the application secret on the - **Credentials** - page in the [Developer - Dashboard](https://developer.squareup.com/apps). - - Args: - client_id (str): Your application ID, which is available on the - **OAuth** page in the [Developer - Dashboard](https://developer.squareup.com/apps). - body (RenewTokenRequest): An object containing the fields to POST - for the request. See the corresponding object definition for - field details. - authorization (str): Client APPLICATION_SECRET - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. Success - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - return super().new_api_call_builder.request( - RequestBuilder().server('default') - .path('/oauth2/clients/{client_id}/access-token/renew') - .http_method(HttpMethodEnum.POST) - .template_param(Parameter() - .key('client_id') - .value(client_id) - .should_encode(True)) - .header_param(Parameter() - .key('Content-Type') - .value('application/json')) - .body_param(Parameter() - .value(body)) - .header_param(Parameter() - .key('Authorization') - .value(authorization)) - .header_param(Parameter() - .key('accept') - .value('application/json')) - .body_serializer(APIHelper.json_serialize) - ).response( - ResponseHandler() - .deserializer(APIHelper.json_deserialize) - .is_api_response(True) - .convertor(ApiResponse.create) - ).execute() - def revoke_token(self, body, authorization): diff --git a/square/client.py b/square/client.py index e1a077c1..de032643 100644 --- a/square/client.py +++ b/square/client.py @@ -54,11 +54,11 @@ class Client(object): @staticmethod def sdk_version(): - return '35.1.0.20240320' + return '36.0.0.20240417' @staticmethod def square_version(): - return '2024-03-20' + return '2024-04-17' def user_agent_detail(self): return self.config.user_agent_detail @@ -233,7 +233,7 @@ def __init__(self, http_client_instance=None, retry_statuses=None, retry_methods=None, environment='production', custom_url='https://connect.squareup.com', access_token=None, - bearer_auth_credentials=None, square_version='2024-03-20', + bearer_auth_credentials=None, square_version='2024-04-17', additional_headers={}, user_agent_detail='', config=None): self.config = config or Configuration( http_client_instance=http_client_instance, diff --git a/square/configuration.py b/square/configuration.py index 069a2b6c..42587743 100644 --- a/square/configuration.py +++ b/square/configuration.py @@ -45,7 +45,7 @@ def __init__(self, http_client_instance=None, retry_statuses=None, retry_methods=None, environment='production', custom_url='https://connect.squareup.com', access_token=None, - bearer_auth_credentials=None, square_version='2024-03-20', + bearer_auth_credentials=None, square_version='2024-04-17', additional_headers={}, user_agent_detail=''): if retry_methods is None: retry_methods = ['GET', 'PUT'] diff --git a/tests/api/test_locations_api.py b/tests/api/test_locations_api.py index d5c606be..31d979f5 100644 --- a/tests/api/test_locations_api.py +++ b/tests/api/test_locations_api.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import json -import dateutil.parser from tests.api.api_test_base import ApiTestBase from apimatic_core.utilities.comparison_helper import ComparisonHelper