Skip to content

Commit c4d8812

Browse files
authored
Merge pull request #45 from paypal/release
Refactors
2 parents 546461b + c9d3839 commit c4d8812

File tree

421 files changed

+997
-4667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

421 files changed

+997
-4667
lines changed

PaypalServerSdk.Standard/Authentication/ClientCredentialsAuthManager.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
//
44
// This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
55
// </copyright>
6+
using APIMatic.Core.Authentication;
7+
using APIMatic.Core.Request;
8+
using APIMatic.Core.Utilities;
9+
using PaypalServerSdk.Standard.Controllers;
10+
using PaypalServerSdk.Standard.Exceptions;
11+
using PaypalServerSdk.Standard.Models;
612
using System;
713
using System.Collections.Generic;
814
using System.Text;
915
using System.Threading;
1016
using System.Threading.Tasks;
11-
using PaypalServerSdk.Standard.Controllers;
12-
using PaypalServerSdk.Standard.Http.Response;using PaypalServerSdk.Standard.Models;
13-
using PaypalServerSdk.Standard.Utilities;
14-
using PaypalServerSdk.Standard.Exceptions;
15-
using APIMatic.Core.Authentication;
16-
using APIMatic.Core.Request;
17-
using APIMatic.Core;
1817

1918
namespace PaypalServerSdk.Standard.Authentication
2019
{
@@ -101,7 +100,7 @@ public bool Equals(string oAuthClientId, string oAuthClientSecret, Models.OAuthT
101100
/// <param name="additionalParameters">Dictionary of additional parameters.</param>
102101
/// <returns>Models.OAuthToken.</returns>
103102
public Models.OAuthToken FetchToken(Dictionary<string, object> additionalParameters = null)
104-
=> ApiHelper.RunTask(FetchTokenAsync(additionalParameters));
103+
=> CoreHelper.RunTask(FetchTokenAsync(additionalParameters));
105104

106105

107106
/// <summary>

PaypalServerSdk.Standard/Controllers/BaseController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ protected static ErrorCase<HttpRequest, HttpResponse, HttpContext, ApiException>
3333
protected ApiCall<HttpRequest, HttpResponse, HttpContext, ApiException, ApiResponse<T>, T> CreateApiCall<T>(ArraySerialization arraySerialization = ArraySerialization.Indexed)
3434
=> new ApiCall<HttpRequest, HttpResponse, HttpContext, ApiException, ApiResponse<T>, T>(
3535
globalConfiguration,
36-
compatibilityFactory,
36+
CompatibilityFactory,
3737
serialization: arraySerialization,
3838
returnTypeCreator: (response, result) => new ApiResponse<T>(response.StatusCode, response.Headers, result)
3939
);
4040

41-
private static readonly CompatibilityFactory compatibilityFactory = new CompatibilityFactory();
41+
private static readonly CompatibilityFactory CompatibilityFactory = new CompatibilityFactory();
4242
}
4343
}

PaypalServerSdk.Standard/Controllers/OAuthAuthorizationController.cs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@
33
//
44
// This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
55
// </copyright>
6-
using System;
7-
using System.Collections.Generic;
8-
using System.Dynamic;
9-
using System.Globalization;
10-
using System.IO;
11-
using System.Linq;
12-
using System.Text;
13-
using System.Threading;
14-
using System.Threading.Tasks;
156
using APIMatic.Core;
16-
using APIMatic.Core.Types;
177
using APIMatic.Core.Utilities;
18-
using APIMatic.Core.Utilities.Date.Xml;
19-
using Newtonsoft.Json.Converters;
20-
using PaypalServerSdk.Standard;
218
using PaypalServerSdk.Standard.Exceptions;
22-
using PaypalServerSdk.Standard.Http.Client;
239
using PaypalServerSdk.Standard.Http.Response;
24-
using PaypalServerSdk.Standard.Utilities;
10+
using System.Collections.Generic;
2511
using System.Net.Http;
12+
using System.Threading;
13+
using System.Threading.Tasks;
2614

2715
namespace PaypalServerSdk.Standard.Controllers
2816
{
@@ -59,16 +47,16 @@ internal OAuthAuthorizationController(GlobalConfiguration globalConfiguration) :
5947
Dictionary<string, object> fieldParameters = null,
6048
CancellationToken cancellationToken = default)
6149
=> await CreateApiCall<Models.OAuthToken>()
62-
.RequestBuilder(_requestBuilder => _requestBuilder
50+
.RequestBuilder(requestBuilder => requestBuilder
6351
.Setup(HttpMethod.Post, "/v1/oauth2/token")
64-
.Parameters(_parameters => _parameters
65-
.AdditionalForms(_additionalForms => _additionalForms.Setup(fieldParameters))
66-
.Form(_form => _form.Setup("grant_type", "client_credentials"))
67-
.Header(_header => _header.Setup("Authorization", input.Authorization))
68-
.Form(_form => _form.Setup("scope", input.Scope))))
69-
.ResponseHandler(_responseHandler => _responseHandler
70-
.ErrorCase("400", CreateErrorCase("OAuth 2 provider returned an error.", (_reason, _context) => new OAuthProviderException(_reason, _context)))
71-
.ErrorCase("401", CreateErrorCase("OAuth 2 provider says client authentication failed.", (_reason, _context) => new OAuthProviderException(_reason, _context))))
52+
.Parameters(parameters => parameters
53+
.AdditionalForms(additionalForms => additionalForms.Setup(fieldParameters))
54+
.Form(form => form.Setup("grant_type", "client_credentials"))
55+
.Header(header => header.Setup("Authorization", input.Authorization))
56+
.Form(form => form.Setup("scope", input.Scope))))
57+
.ResponseHandler(responseHandler => responseHandler
58+
.ErrorCase("400", CreateErrorCase("OAuth 2 provider returned an error.", (errorReason, context) => new OAuthProviderException(errorReason, context)))
59+
.ErrorCase("401", CreateErrorCase("OAuth 2 provider says client authentication failed.", (errorReason, context) => new OAuthProviderException(errorReason, context))))
7260
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
7361
}
7462
}

0 commit comments

Comments
 (0)