Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
square-sdk-deployer committed Jan 22, 2020
1 parent 9d4a23b commit 63f6b5d
Show file tree
Hide file tree
Showing 492 changed files with 3,192 additions and 2,965 deletions.
20 changes: 10 additions & 10 deletions Square.sln
Expand Up @@ -2,24 +2,24 @@ 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", "{a71d06ad-1968-47c9-a5ed-5f8cbba2413e}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square", "Square/Square.csproj", "{4ab9eb37-d74c-4ef7-abf1-8cb193a65d25}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square.Tests", "Square.Tests/Square.Tests.csproj", "{7612e05f-6e0e-4cdc-9fd7-f07a2fcc7197}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square.Tests", "Square.Tests/Square.Tests.csproj", "{e928dce4-5cdd-4091-b72b-09e6c76ac7cc}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{a71d06ad-1968-47c9-a5ed-5f8cbba2413e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{a71d06ad-1968-47c9-a5ed-5f8cbba2413e}.Debug|Any CPU.Build.0 = Debug|Any CPU
{a71d06ad-1968-47c9-a5ed-5f8cbba2413e}.Release|Any CPU.ActiveCfg = Release|Any CPU
{a71d06ad-1968-47c9-a5ed-5f8cbba2413e}.Release|Any CPU.Build.0 = Release|Any CPU
{7612e05f-6e0e-4cdc-9fd7-f07a2fcc7197}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7612e05f-6e0e-4cdc-9fd7-f07a2fcc7197}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7612e05f-6e0e-4cdc-9fd7-f07a2fcc7197}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7612e05f-6e0e-4cdc-9fd7-f07a2fcc7197}.Release|Any CPU.Build.0 = Release|Any CPU
{4ab9eb37-d74c-4ef7-abf1-8cb193a65d25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4ab9eb37-d74c-4ef7-abf1-8cb193a65d25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4ab9eb37-d74c-4ef7-abf1-8cb193a65d25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4ab9eb37-d74c-4ef7-abf1-8cb193a65d25}.Release|Any CPU.Build.0 = Release|Any CPU
{e928dce4-5cdd-4091-b72b-09e6c76ac7cc}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{e928dce4-5cdd-4091-b72b-09e6c76ac7cc}.Debug|Any CPU.Build.0 = Debug|Any CPU
{e928dce4-5cdd-4091-b72b-09e6c76ac7cc}.Release|Any CPU.ActiveCfg = Release|Any CPU
{e928dce4-5cdd-4091-b72b-09e6c76ac7cc}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
16 changes: 9 additions & 7 deletions Square/Apis/ApplePayApi.cs
Expand Up @@ -5,13 +5,15 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Converters;
using Square;
using Square.Utilities;
using Square.Http.Request;
using Square.Http.Response;
using Square.Http.Client;
using Square.Authentication;
using Square.Exceptions;

namespace Square.Apis
Expand Down Expand Up @@ -51,7 +53,7 @@ public Models.RegisterDomainResponse RegisterDomain(Models.RegisterDomainRequest
/// </summary>
/// <param name="body">Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.</param>
/// <return>Returns the Models.RegisterDomainResponse response from the API call</return>
public async Task<Models.RegisterDomainResponse> RegisterDomainAsync(Models.RegisterDomainRequest body)
public async Task<Models.RegisterDomainResponse> RegisterDomainAsync(Models.RegisterDomainRequest body, CancellationToken cancellationToken = default)
{
//the base uri for api requests
string _baseUri = config.GetBaseUri();
Expand All @@ -64,12 +66,12 @@ public async Task<Models.RegisterDomainResponse> RegisterDomainAsync(Models.Regi
string _queryUrl = ApiHelper.CleanUrl(_queryBuilder);

//append request with appropriate headers and parameters
var _headers = new Dictionary<string,string>()
var _headers = new Dictionary<string, string>()
{
{ "user-agent", "Square-DotNet-SDK/4.0.0" },
{ "user-agent", userAgent },
{ "accept", "application/json" },
{ "content-type", "application/json; charset=utf-8" },
{ "Square-Version", "2019-12-17" }
{ "Square-Version", "2020-01-22" }
};

//append body params
Expand All @@ -82,10 +84,10 @@ public async Task<Models.RegisterDomainResponse> RegisterDomainAsync(Models.Regi
HttpCallBack.OnBeforeHttpRequestEventHandler(GetClientInstance(), _request);
}

_request = authManagers["default"].Apply(_request);
_request = await authManagers["default"].ApplyAsync(_request).ConfigureAwait(false);

//invoke request and get response
HttpStringResponse _response = (HttpStringResponse) await GetClientInstance().ExecuteAsStringAsync(_request).ConfigureAwait(false);
HttpStringResponse _response = await GetClientInstance().ExecuteAsStringAsync(_request, cancellationToken).ConfigureAwait(false);
HttpContext _context = new HttpContext(_request, _response);
if (HttpCallBack != null)
{
Expand All @@ -101,4 +103,4 @@ public async Task<Models.RegisterDomainResponse> RegisterDomainAsync(Models.Regi
}

}
}
}
10 changes: 8 additions & 2 deletions Square/Apis/BaseApi.cs
Expand Up @@ -5,6 +5,7 @@
using Square.Utilities;
using Square.Http.Client;
using Square.Http.Response;
using Square.Authentication;
using Square.Exceptions;

namespace Square.Apis
Expand All @@ -19,6 +20,11 @@ internal class BaseApi
/// </summary>
protected IConfiguration config;

/// <summary>
/// User-Agent header value
/// </summary>
internal string userAgent = "Square-DotNet-SDK/4.1.0";

/// <summary>
/// HttpClient instance
/// </summary>
Expand Down Expand Up @@ -85,10 +91,10 @@ internal IHttpClient GetClientInstance()
/// <param name="_context">Context of the request and the recieved response</param>
protected void ValidateResponse(HttpResponse _response, HttpContext _context)
{
if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK
if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200, 208] = HTTP OK
{
throw new ApiException(@"HTTP Response Not OK", _context);
}
}
}
}
}
46 changes: 24 additions & 22 deletions Square/Apis/CashDrawersApi.cs
Expand Up @@ -5,13 +5,15 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Converters;
using Square;
using Square.Utilities;
using Square.Http.Request;
using Square.Http.Response;
using Square.Http.Client;
using Square.Authentication;
using Square.Exceptions;

namespace Square.Apis
Expand Down Expand Up @@ -63,7 +65,7 @@ internal class CashDrawersApi: BaseApi, ICashDrawersApi
string beginTime = null,
string endTime = null,
int? limit = null,
string cursor = null)
string cursor = null, CancellationToken cancellationToken = default)
{
//the base uri for api requests
string _baseUri = config.GetBaseUri();
Expand All @@ -81,17 +83,17 @@ internal class CashDrawersApi: BaseApi, ICashDrawersApi
{ "end_time", endTime },
{ "limit", limit },
{ "cursor", cursor }
},ArrayDeserializationFormat,ParameterSeparator);
}, ArrayDeserializationFormat, ParameterSeparator);

//validate and preprocess url
string _queryUrl = ApiHelper.CleanUrl(_queryBuilder);

//append request with appropriate headers and parameters
var _headers = new Dictionary<string,string>()
var _headers = new Dictionary<string, string>()
{
{ "user-agent", "Square-DotNet-SDK/4.0.0" },
{ "user-agent", userAgent },
{ "accept", "application/json" },
{ "Square-Version", "2019-12-17" }
{ "Square-Version", "2020-01-22" }
};

//prepare the API call request to fetch the response
Expand All @@ -101,10 +103,10 @@ internal class CashDrawersApi: BaseApi, ICashDrawersApi
HttpCallBack.OnBeforeHttpRequestEventHandler(GetClientInstance(), _request);
}

_request = authManagers["default"].Apply(_request);
_request = await authManagers["default"].ApplyAsync(_request).ConfigureAwait(false);

//invoke request and get response
HttpStringResponse _response = (HttpStringResponse) await GetClientInstance().ExecuteAsStringAsync(_request).ConfigureAwait(false);
HttpStringResponse _response = await GetClientInstance().ExecuteAsStringAsync(_request, cancellationToken).ConfigureAwait(false);
HttpContext _context = new HttpContext(_request, _response);
if (HttpCallBack != null)
{
Expand Down Expand Up @@ -140,7 +142,7 @@ public Models.RetrieveCashDrawerShiftResponse RetrieveCashDrawerShift(string loc
/// <param name="locationId">Required parameter: The ID of the location to retrieve cash drawer shifts from.</param>
/// <param name="shiftId">Required parameter: The shift ID.</param>
/// <return>Returns the Models.RetrieveCashDrawerShiftResponse response from the API call</return>
public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShiftAsync(string locationId, string shiftId)
public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShiftAsync(string locationId, string shiftId, CancellationToken cancellationToken = default)
{
//the base uri for api requests
string _baseUri = config.GetBaseUri();
Expand All @@ -159,17 +161,17 @@ public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShif
ApiHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary<string, object>()
{
{ "location_id", locationId }
},ArrayDeserializationFormat,ParameterSeparator);
}, ArrayDeserializationFormat, ParameterSeparator);

//validate and preprocess url
string _queryUrl = ApiHelper.CleanUrl(_queryBuilder);

//append request with appropriate headers and parameters
var _headers = new Dictionary<string,string>()
var _headers = new Dictionary<string, string>()
{
{ "user-agent", "Square-DotNet-SDK/4.0.0" },
{ "user-agent", userAgent },
{ "accept", "application/json" },
{ "Square-Version", "2019-12-17" }
{ "Square-Version", "2020-01-22" }
};

//prepare the API call request to fetch the response
Expand All @@ -179,10 +181,10 @@ public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShif
HttpCallBack.OnBeforeHttpRequestEventHandler(GetClientInstance(), _request);
}

_request = authManagers["default"].Apply(_request);
_request = await authManagers["default"].ApplyAsync(_request).ConfigureAwait(false);

//invoke request and get response
HttpStringResponse _response = (HttpStringResponse) await GetClientInstance().ExecuteAsStringAsync(_request).ConfigureAwait(false);
HttpStringResponse _response = await GetClientInstance().ExecuteAsStringAsync(_request, cancellationToken).ConfigureAwait(false);
HttpContext _context = new HttpContext(_request, _response);
if (HttpCallBack != null)
{
Expand Down Expand Up @@ -228,7 +230,7 @@ public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShif
string locationId,
string shiftId,
int? limit = null,
string cursor = null)
string cursor = null, CancellationToken cancellationToken = default)
{
//the base uri for api requests
string _baseUri = config.GetBaseUri();
Expand All @@ -249,17 +251,17 @@ public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShif
{ "location_id", locationId },
{ "limit", limit },
{ "cursor", cursor }
},ArrayDeserializationFormat,ParameterSeparator);
}, ArrayDeserializationFormat, ParameterSeparator);

//validate and preprocess url
string _queryUrl = ApiHelper.CleanUrl(_queryBuilder);

//append request with appropriate headers and parameters
var _headers = new Dictionary<string,string>()
var _headers = new Dictionary<string, string>()
{
{ "user-agent", "Square-DotNet-SDK/4.0.0" },
{ "user-agent", userAgent },
{ "accept", "application/json" },
{ "Square-Version", "2019-12-17" }
{ "Square-Version", "2020-01-22" }
};

//prepare the API call request to fetch the response
Expand All @@ -269,10 +271,10 @@ public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShif
HttpCallBack.OnBeforeHttpRequestEventHandler(GetClientInstance(), _request);
}

_request = authManagers["default"].Apply(_request);
_request = await authManagers["default"].ApplyAsync(_request).ConfigureAwait(false);

//invoke request and get response
HttpStringResponse _response = (HttpStringResponse) await GetClientInstance().ExecuteAsStringAsync(_request).ConfigureAwait(false);
HttpStringResponse _response = await GetClientInstance().ExecuteAsStringAsync(_request, cancellationToken).ConfigureAwait(false);
HttpContext _context = new HttpContext(_request, _response);
if (HttpCallBack != null)
{
Expand All @@ -288,4 +290,4 @@ public async Task<Models.RetrieveCashDrawerShiftResponse> RetrieveCashDrawerShif
}

}
}
}

0 comments on commit 63f6b5d

Please sign in to comment.