From 2a7d2504cb210dce1c7629b25bfda749f7b3094c Mon Sep 17 00:00:00 2001 From: autobot Date: Tue, 16 Apr 2024 22:35:31 +0000 Subject: [PATCH] Generated PR for Release: 36.0.0 --- .github/pull_request_template.md | 4 + Square.sln | 20 +- Square/Apis/IOAuthApi.cs | 54 ---- Square/Apis/OAuthApi.cs | 66 ---- .../CatalogCustomAttributeDefinition.cs | 2 +- Square/Models/Order.cs | 4 +- Square/Models/OrderLineItemTax.cs | 1 - Square/Models/RenewTokenRequest.cs | 160 ---------- Square/Models/RenewTokenResponse.cs | 295 ------------------ Square/Square.csproj | 6 +- Square/SquareClient.cs | 6 +- 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 -- 18 files changed, 30 insertions(+), 725 deletions(-) create mode 100644 .github/pull_request_template.md delete mode 100644 Square/Models/RenewTokenRequest.cs delete mode 100644 Square/Models/RenewTokenResponse.cs 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/Square.sln b/Square.sln index 55a35e79..2250f47b 100644 --- a/Square.sln +++ b/Square.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square", "Square/Square.csproj", "{3e3d86c1-1cc2-431c-bb34-9d1a88554c6e}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square", "Square/Square.csproj", "{6e3f5606-ac3a-4f31-b282-c963803ed607}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square.Tests", "Square.Tests/Square.Tests.csproj", "{175ec7f2-668d-432c-934b-583b0830ab20}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square.Tests", "Square.Tests/Square.Tests.csproj", "{3b6c7029-db3d-4724-a411-e817ac6e70e3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -12,14 +12,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3e3d86c1-1cc2-431c-bb34-9d1a88554c6e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3e3d86c1-1cc2-431c-bb34-9d1a88554c6e}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3e3d86c1-1cc2-431c-bb34-9d1a88554c6e}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3e3d86c1-1cc2-431c-bb34-9d1a88554c6e}.Release|Any CPU.Build.0 = Release|Any CPU - {175ec7f2-668d-432c-934b-583b0830ab20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {175ec7f2-668d-432c-934b-583b0830ab20}.Debug|Any CPU.Build.0 = Debug|Any CPU - {175ec7f2-668d-432c-934b-583b0830ab20}.Release|Any CPU.ActiveCfg = Release|Any CPU - {175ec7f2-668d-432c-934b-583b0830ab20}.Release|Any CPU.Build.0 = Release|Any CPU + {6e3f5606-ac3a-4f31-b282-c963803ed607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6e3f5606-ac3a-4f31-b282-c963803ed607}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6e3f5606-ac3a-4f31-b282-c963803ed607}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6e3f5606-ac3a-4f31-b282-c963803ed607}.Release|Any CPU.Build.0 = Release|Any CPU + {3b6c7029-db3d-4724-a411-e817ac6e70e3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3b6c7029-db3d-4724-a411-e817ac6e70e3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3b6c7029-db3d-4724-a411-e817ac6e70e3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3b6c7029-db3d-4724-a411-e817ac6e70e3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Square/Apis/IOAuthApi.cs b/Square/Apis/IOAuthApi.cs index f2d56dce..2fa94117 100644 --- a/Square/Apis/IOAuthApi.cs +++ b/Square/Apis/IOAuthApi.cs @@ -19,60 +19,6 @@ namespace Square.Apis /// public interface IOAuthApi { - /// - /// `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). - /// - /// Required parameter: Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps).. - /// Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.. - /// Required parameter: Client APPLICATION_SECRET. - /// Returns the Models.RenewTokenResponse response from the API call. - [Obsolete] - Models.RenewTokenResponse RenewToken( - string clientId, - Models.RenewTokenRequest body, - string authorization); - - /// - /// `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). - /// - /// Required parameter: Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps).. - /// Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.. - /// Required parameter: Client APPLICATION_SECRET. - /// cancellationToken. - /// Returns the Models.RenewTokenResponse response from the API call. - [Obsolete] - Task RenewTokenAsync( - string clientId, - Models.RenewTokenRequest body, - string authorization, - CancellationToken cancellationToken = default); - /// /// Revokes an access token generated with the OAuth flow. /// If an account has more than one OAuth access token for your application, this. diff --git a/Square/Apis/OAuthApi.cs b/Square/Apis/OAuthApi.cs index 3c31dfb6..3a9cc3ed 100644 --- a/Square/Apis/OAuthApi.cs +++ b/Square/Apis/OAuthApi.cs @@ -29,72 +29,6 @@ internal class OAuthApi : BaseApi, IOAuthApi /// internal OAuthApi(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } - /// - /// `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). - /// - /// Required parameter: Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps).. - /// Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.. - /// Required parameter: Client APPLICATION_SECRET. - /// Returns the Models.RenewTokenResponse response from the API call. - [Obsolete] - public Models.RenewTokenResponse RenewToken( - string clientId, - Models.RenewTokenRequest body, - string authorization) - => CoreHelper.RunTask(RenewTokenAsync(clientId, body, authorization)); - - /// - /// `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). - /// - /// Required parameter: Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps).. - /// Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.. - /// Required parameter: Client APPLICATION_SECRET. - /// cancellationToken. - /// Returns the Models.RenewTokenResponse response from the API call. - [Obsolete] - public async Task RenewTokenAsync( - string clientId, - Models.RenewTokenRequest body, - string authorization, - CancellationToken cancellationToken = default) - => await CreateApiCall() - .RequestBuilder(_requestBuilder => _requestBuilder - .Setup(HttpMethod.Post, "/oauth2/clients/{client_id}/access-token/renew") - .Parameters(_parameters => _parameters - .Body(_bodyParameter => _bodyParameter.Setup(body)) - .Template(_template => _template.Setup("client_id", clientId)) - .Header(_header => _header.Setup("Content-Type", "application/json")) - .Header(_header => _header.Setup("Authorization", authorization)))) - .ResponseHandler(_responseHandler => _responseHandler - .ContextAdder((_result, _context) => _result.ContextSetter(_context))) - .ExecuteAsync(cancellationToken).ConfigureAwait(false); - /// /// Revokes an access token generated with the OAuth flow. /// If an account has more than one OAuth access token for your application, this. diff --git a/Square/Models/CatalogCustomAttributeDefinition.cs b/Square/Models/CatalogCustomAttributeDefinition.cs index 53c23853..85c8e37c 100644 --- a/Square/Models/CatalogCustomAttributeDefinition.cs +++ b/Square/Models/CatalogCustomAttributeDefinition.cs @@ -135,7 +135,7 @@ internal CatalogCustomAttributeDefinition(Dictionary shouldSeriali /// /// 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. + /// 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 /// [JsonProperty("allowed_object_types")] diff --git a/Square/Models/Order.cs b/Square/Models/Order.cs index e4730c9f..3e08ab10 100644 --- a/Square/Models/Order.cs +++ b/Square/Models/Order.cs @@ -381,13 +381,13 @@ internal Order(Dictionary shouldSerialize, public IDictionary Metadata { get; } /// - /// The timestamp for when the order was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + /// The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). /// [JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)] public string CreatedAt { get; } /// - /// The timestamp for when the order was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + /// The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). /// [JsonProperty("updated_at", NullValueHandling = NullValueHandling.Ignore)] public string UpdatedAt { get; } diff --git a/Square/Models/OrderLineItemTax.cs b/Square/Models/OrderLineItemTax.cs index c2422f19..f6da0939 100644 --- a/Square/Models/OrderLineItemTax.cs +++ b/Square/Models/OrderLineItemTax.cs @@ -154,7 +154,6 @@ internal OrderLineItemTax(Dictionary shouldSerialize, /// 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. /// [JsonProperty("percentage")] public string Percentage { get; } diff --git a/Square/Models/RenewTokenRequest.cs b/Square/Models/RenewTokenRequest.cs deleted file mode 100644 index c331487d..00000000 --- a/Square/Models/RenewTokenRequest.cs +++ /dev/null @@ -1,160 +0,0 @@ -namespace Square.Models -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.IO; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using APIMatic.Core.Utilities.Converters; - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using Square; - using Square.Utilities; - - /// - /// RenewTokenRequest. - /// - public class RenewTokenRequest - { - private readonly Dictionary shouldSerialize; - /// - /// Initializes a new instance of the class. - /// - /// access_token. - public RenewTokenRequest( - string accessToken = null) - { - shouldSerialize = new Dictionary - { - { "access_token", false } - }; - - if (accessToken != null) - { - shouldSerialize["access_token"] = true; - this.AccessToken = accessToken; - } - - } - internal RenewTokenRequest(Dictionary shouldSerialize, - string accessToken = null) - { - this.shouldSerialize = shouldSerialize; - AccessToken = accessToken; - } - - /// - /// The token you want to renew. - /// - [JsonProperty("access_token")] - public string AccessToken { get; } - - /// - public override string ToString() - { - var toStringOutput = new List(); - - this.ToString(toStringOutput); - - return $"RenewTokenRequest : ({string.Join(", ", toStringOutput)})"; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeAccessToken() - { - return this.shouldSerialize["access_token"]; - } - - /// - public override bool Equals(object obj) - { - if (obj == null) - { - return false; - } - - if (obj == this) - { - return true; - } - return obj is RenewTokenRequest other && ((this.AccessToken == null && other.AccessToken == null) || (this.AccessToken?.Equals(other.AccessToken) == true)); - } - - /// - public override int GetHashCode() - { - int hashCode = -475718546; - hashCode = HashCode.Combine(this.AccessToken); - - return hashCode; - } - /// - /// ToString overload. - /// - /// List of strings. - protected void ToString(List toStringOutput) - { - toStringOutput.Add($"this.AccessToken = {(this.AccessToken == null ? "null" : this.AccessToken)}"); - } - - /// - /// Converts to builder object. - /// - /// Builder. - public Builder ToBuilder() - { - var builder = new Builder() - .AccessToken(this.AccessToken); - return builder; - } - - /// - /// Builder class. - /// - public class Builder - { - private Dictionary shouldSerialize = new Dictionary - { - { "access_token", false }, - }; - - private string accessToken; - - /// - /// AccessToken. - /// - /// accessToken. - /// Builder. - public Builder AccessToken(string accessToken) - { - shouldSerialize["access_token"] = true; - this.accessToken = accessToken; - return this; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetAccessToken() - { - this.shouldSerialize["access_token"] = false; - } - - - /// - /// Builds class object. - /// - /// RenewTokenRequest. - public RenewTokenRequest Build() - { - return new RenewTokenRequest(shouldSerialize, - this.accessToken); - } - } - } -} \ No newline at end of file diff --git a/Square/Models/RenewTokenResponse.cs b/Square/Models/RenewTokenResponse.cs deleted file mode 100644 index 8284a997..00000000 --- a/Square/Models/RenewTokenResponse.cs +++ /dev/null @@ -1,295 +0,0 @@ -namespace Square.Models -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.IO; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using APIMatic.Core.Utilities.Converters; - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using Square; - using Square.Http.Client; - using Square.Utilities; - - /// - /// RenewTokenResponse. - /// - public class RenewTokenResponse - { - /// - /// Initializes a new instance of the class. - /// - /// access_token. - /// token_type. - /// expires_at. - /// merchant_id. - /// subscription_id. - /// plan_id. - /// errors. - public RenewTokenResponse( - string accessToken = null, - string tokenType = null, - string expiresAt = null, - string merchantId = null, - string subscriptionId = null, - string planId = null, - IList errors = null) - { - this.AccessToken = accessToken; - this.TokenType = tokenType; - this.ExpiresAt = expiresAt; - this.MerchantId = merchantId; - this.SubscriptionId = subscriptionId; - this.PlanId = planId; - this.Errors = errors; - } - - /// - /// Gets http context. - /// - [JsonIgnore] - public HttpContext Context { get; internal set; } - - /// - /// 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. - /// - [JsonProperty("access_token", NullValueHandling = NullValueHandling.Ignore)] - public string AccessToken { get; } - - /// - /// This value is always _bearer_. - /// - [JsonProperty("token_type", NullValueHandling = NullValueHandling.Ignore)] - public string TokenType { get; } - - /// - /// The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. - /// - [JsonProperty("expires_at", NullValueHandling = NullValueHandling.Ignore)] - public string ExpiresAt { get; } - - /// - /// The ID of the authorizing merchant's business. - /// - [JsonProperty("merchant_id", NullValueHandling = NullValueHandling.Ignore)] - public string MerchantId { get; } - - /// - /// __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. - /// - [JsonProperty("subscription_id", NullValueHandling = NullValueHandling.Ignore)] - public string SubscriptionId { get; } - - /// - /// __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. - /// - [JsonProperty("plan_id", NullValueHandling = NullValueHandling.Ignore)] - public string PlanId { get; } - - /// - /// Any errors that occurred during the request. - /// - [JsonProperty("errors", NullValueHandling = NullValueHandling.Ignore)] - public IList Errors { get; } - - /// - public override string ToString() - { - var toStringOutput = new List(); - - this.ToString(toStringOutput); - - return $"RenewTokenResponse : ({string.Join(", ", toStringOutput)})"; - } - - /// - public override bool Equals(object obj) - { - if (obj == null) - { - return false; - } - - if (obj == this) - { - return true; - } - return obj is RenewTokenResponse other && ((this.Context == null && other.Context == null) || (this.Context?.Equals(other.Context) == true)) && - ((this.AccessToken == null && other.AccessToken == null) || (this.AccessToken?.Equals(other.AccessToken) == true)) && - ((this.TokenType == null && other.TokenType == null) || (this.TokenType?.Equals(other.TokenType) == true)) && - ((this.ExpiresAt == null && other.ExpiresAt == null) || (this.ExpiresAt?.Equals(other.ExpiresAt) == true)) && - ((this.MerchantId == null && other.MerchantId == null) || (this.MerchantId?.Equals(other.MerchantId) == true)) && - ((this.SubscriptionId == null && other.SubscriptionId == null) || (this.SubscriptionId?.Equals(other.SubscriptionId) == true)) && - ((this.PlanId == null && other.PlanId == null) || (this.PlanId?.Equals(other.PlanId) == true)) && - ((this.Errors == null && other.Errors == null) || (this.Errors?.Equals(other.Errors) == true)); - } - - /// - public override int GetHashCode() - { - int hashCode = -709188927; - - if (this.Context != null) - { - hashCode += this.Context.GetHashCode(); - } - hashCode = HashCode.Combine(this.AccessToken, this.TokenType, this.ExpiresAt, this.MerchantId, this.SubscriptionId, this.PlanId, this.Errors); - - return hashCode; - } - internal RenewTokenResponse ContextSetter(HttpContext context) - { - this.Context = context; - return this; - } - - /// - /// ToString overload. - /// - /// List of strings. - protected void ToString(List toStringOutput) - { - toStringOutput.Add($"this.AccessToken = {(this.AccessToken == null ? "null" : this.AccessToken)}"); - toStringOutput.Add($"this.TokenType = {(this.TokenType == null ? "null" : this.TokenType)}"); - toStringOutput.Add($"this.ExpiresAt = {(this.ExpiresAt == null ? "null" : this.ExpiresAt)}"); - toStringOutput.Add($"this.MerchantId = {(this.MerchantId == null ? "null" : this.MerchantId)}"); - toStringOutput.Add($"this.SubscriptionId = {(this.SubscriptionId == null ? "null" : this.SubscriptionId)}"); - toStringOutput.Add($"this.PlanId = {(this.PlanId == null ? "null" : this.PlanId)}"); - toStringOutput.Add($"this.Errors = {(this.Errors == null ? "null" : $"[{string.Join(", ", this.Errors)} ]")}"); - } - - /// - /// Converts to builder object. - /// - /// Builder. - public Builder ToBuilder() - { - var builder = new Builder() - .AccessToken(this.AccessToken) - .TokenType(this.TokenType) - .ExpiresAt(this.ExpiresAt) - .MerchantId(this.MerchantId) - .SubscriptionId(this.SubscriptionId) - .PlanId(this.PlanId) - .Errors(this.Errors); - return builder; - } - - /// - /// Builder class. - /// - public class Builder - { - private string accessToken; - private string tokenType; - private string expiresAt; - private string merchantId; - private string subscriptionId; - private string planId; - private IList errors; - - /// - /// AccessToken. - /// - /// accessToken. - /// Builder. - public Builder AccessToken(string accessToken) - { - this.accessToken = accessToken; - return this; - } - - /// - /// TokenType. - /// - /// tokenType. - /// Builder. - public Builder TokenType(string tokenType) - { - this.tokenType = tokenType; - return this; - } - - /// - /// ExpiresAt. - /// - /// expiresAt. - /// Builder. - public Builder ExpiresAt(string expiresAt) - { - this.expiresAt = expiresAt; - return this; - } - - /// - /// MerchantId. - /// - /// merchantId. - /// Builder. - public Builder MerchantId(string merchantId) - { - this.merchantId = merchantId; - return this; - } - - /// - /// SubscriptionId. - /// - /// subscriptionId. - /// Builder. - public Builder SubscriptionId(string subscriptionId) - { - this.subscriptionId = subscriptionId; - return this; - } - - /// - /// PlanId. - /// - /// planId. - /// Builder. - public Builder PlanId(string planId) - { - this.planId = planId; - return this; - } - - /// - /// Errors. - /// - /// errors. - /// Builder. - public Builder Errors(IList errors) - { - this.errors = errors; - return this; - } - - /// - /// Builds class object. - /// - /// RenewTokenResponse. - public RenewTokenResponse Build() - { - return new RenewTokenResponse( - this.accessToken, - this.tokenType, - this.expiresAt, - this.merchantId, - this.subscriptionId, - this.planId, - this.errors); - } - } - } -} \ No newline at end of file diff --git a/Square/Square.csproj b/Square/Square.csproj index 4f63ed07..7444a1ef 100644 --- a/Square/Square.csproj +++ b/Square/Square.csproj @@ -4,13 +4,13 @@ netstandard2.0 Square - 35.1.0.0 + 36.0.0.0 Square Developer Platform Square Developer Platform Square Copyright © 2019 - 35.1.0.0 - 35.1.0.0 + 36.0.0.0 + 36.0.0.0 .NET client library for the Square API 7.3 true diff --git a/Square/SquareClient.cs b/Square/SquareClient.cs index 8cd068d8..ff9c6bd7 100644 --- a/Square/SquareClient.cs +++ b/Square/SquareClient.cs @@ -43,7 +43,7 @@ public sealed class SquareClient : ISquareClient }; private readonly GlobalConfiguration globalConfiguration; - private const string userAgent = "Square-DotNet-SDK/35.1.0 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}"; + private const string userAgent = "Square-DotNet-SDK/36.0.0 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}"; private readonly HttpCallBack httpCallBack; private readonly IDictionary> additionalHeaders; private readonly Lazy mobileAuthorization; @@ -420,7 +420,7 @@ private SquareClient( /// /// Gets the current version of the SDK. /// - public string SdkVersion => "35.1.0"; + public string SdkVersion => "36.0.0"; /// /// Gets the configuration of the Http Client associated with this client. @@ -578,7 +578,7 @@ private void SetupAdditionalHeaders(AdditionalHeaderParams additionalHeaderParam /// public class Builder { - private string squareVersion = "2024-03-20"; + private string squareVersion = "2024-04-17"; private string userAgentDetail = null; private Environment environment = Square.Environment.Production; private string customUrl = "https://connect.squareup.com"; diff --git a/doc/api/o-auth.md b/doc/api/o-auth.md index f7543fb9..9318b371 100644 --- a/doc/api/o-auth.md +++ b/doc/api/o-auth.md @@ -10,82 +10,11 @@ IOAuthApi oAuthApi = client.OAuthApi; ## 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. - -```csharp -RenewTokenAsync( - string clientId, - Models.RenewTokenRequest body, - string authorization) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `clientId` | `string` | Template, Required | Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps). | -| `body` | [`RenewTokenRequest`](../../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` | `string` | Header, Required | Client APPLICATION_SECRET | - -## Response Type - -[`Task`](../../doc/models/renew-token-response.md) - -## Example Usage - -```csharp -string clientId = "client_id8"; -Models.RenewTokenRequest body = new Models.RenewTokenRequest.Builder() -.AccessToken("ACCESS_TOKEN") -.Build(); - -string authorization = "Client CLIENT_SECRET"; -try -{ - RenewTokenResponse result = await oAuthApi.RenewTokenAsync( - clientId, - body, - authorization - ); -} -catch (ApiException e) -{ - // TODO: Handle exception here - Console.WriteLine(e.Message); -} -``` - - # Revoke Token Revokes an access token generated with the OAuth flow. diff --git a/doc/client.md b/doc/client.md index 3eb1224d..8694442a 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*: `"2024-03-20"` | +| `SquareVersion` | `string` | Square Connect API versions
*Default*: `"2024-04-17"` | | `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` | `TimeSpan` | Http client timeout.
*Default*: `TimeSpan.FromSeconds(60)` | @@ -21,7 +21,7 @@ Square.SquareClient client = new Square.SquareClient.Builder() "AccessToken" ) .Build()) - .SquareVersion("2024-03-20") + .SquareVersion("2024-04-17") .Environment(Square.Environment.Production) .CustomUrl("https://connect.squareup.com") .Build(); @@ -49,7 +49,7 @@ namespace Testing "AccessToken" ) .Build()) - .SquareVersion("2024-03-20") + .SquareVersion("2024-04-17") .Build(); ILocationsApi locationsApi = client.LocationsApi; diff --git a/doc/models/catalog-custom-attribute-definition.md b/doc/models/catalog-custom-attribute-definition.md index 471665d1..777fbe08 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` | `string` | 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` | `string` | 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` | | `SourceApplication` | [`SourceApplication`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. | -| `AllowedObjectTypes` | [`IList`](../../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 | +| `AllowedObjectTypes` | [`IList`](../../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 | | `SellerVisibility` | [`string`](../../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). | | `AppVisibility` | [`string`](../../doc/models/catalog-custom-attribute-definition-app-visibility.md) | Optional | Defines the visibility of a custom attribute to applications other than their
creating application. | | `StringConfig` | [`CatalogCustomAttributeDefinitionStringConfig`](../../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 6a93c2b6..086aca3d 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. | `CatalogVersion` | `long?` | Optional | The version of the catalog object that this tax references. | | `Name` | `string` | Optional | The tax's name.
**Constraints**: *Maximum Length*: `255` | | `Type` | [`string`](../../doc/models/order-line-item-tax-type.md) | Optional | Indicates how the tax is applied to the associated line item or order. | -| `Percentage` | `string` | 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` | `string` | 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` | `IDictionary` | 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). | | `AppliedMoney` | [`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` | [`string`](../../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 d23582f3..61076691 100644 --- a/doc/models/order.md +++ b/doc/models/order.md @@ -33,8 +33,8 @@ itemization data. | `Tenders` | [`IList`](../../doc/models/tender.md) | Optional | The tenders that were used to pay for the order. | | `Refunds` | [`IList`](../../doc/models/refund.md) | Optional | The refunds that are part of this order. | | `Metadata` | `IDictionary` | 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). | -| `CreatedAt` | `string` | Optional | The timestamp for when the order was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `UpdatedAt` | `string` | Optional | The timestamp for when the order was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | +| `CreatedAt` | `string` | Optional | The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | +| `UpdatedAt` | `string` | 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"). | | `ClosedAt` | `string` | 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` | [`string`](../../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 e82d2fd3..00000000 --- a/doc/models/renew-token-request.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Renew Token Request - -## Structure - -`RenewTokenRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `AccessToken` | `string` | 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 b4d8a6a7..00000000 --- a/doc/models/renew-token-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Renew Token Response - -## Structure - -`RenewTokenResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `AccessToken` | `string` | 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` | -| `TokenType` | `string` | Optional | This value is always _bearer_.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `10` | -| `ExpiresAt` | `string` | 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` | -| `MerchantId` | `string` | Optional | The ID of the authorizing merchant's business.
**Constraints**: *Minimum Length*: `8`, *Maximum Length*: `191` | -| `SubscriptionId` | `string` | 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. | -| `PlanId` | `string` | 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` | [`IList`](../../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" -} -``` -