7
7
using FikaAmazonAPI . Utils ;
8
8
using Newtonsoft . Json ;
9
9
using RestSharp ;
10
+ using RestSharp . Serializers . NewtonsoftJson ;
10
11
using System ;
11
12
using System . Collections . Generic ;
12
13
using System . Globalization ;
13
14
using System . Linq ;
14
15
using System . Net ;
15
16
using System . Threading . Tasks ;
16
- using RestSharp . Serializers . NewtonsoftJson ;
17
17
using static FikaAmazonAPI . AmazonSpApiSDK . Models . Token . CacheTokenData ;
18
18
using static FikaAmazonAPI . Utils . Constants ;
19
19
@@ -59,14 +59,6 @@ private void CreateRequest(string url, RestSharp.Method method)
59
59
RequestClient . UseNewtonsoftJson ( ) ;
60
60
Request = new RestRequest ( url , method ) ;
61
61
}
62
- protected async Task CreateUnAuthorizedRequestAsync ( string url , RestSharp . Method method , List < KeyValuePair < string , string > > queryParameters = null , object postJsonObj = null )
63
- {
64
- CreateRequest ( url , method ) ;
65
- if ( postJsonObj != null )
66
- AddJsonBody ( postJsonObj ) ;
67
- if ( queryParameters != null )
68
- AddQueryParameters ( queryParameters ) ;
69
- }
70
62
71
63
protected async Task CreateAuthorizedRequestAsync ( string url , RestSharp . Method method , List < KeyValuePair < string , string > > queryParameters = null , object postJsonObj = null , TokenDataType tokenDataType = TokenDataType . Normal , object parameter = null )
72
64
{
@@ -107,7 +99,7 @@ protected void CreateAuthorizedPagedRequest(AmazonFilter filter, string url, Res
107
99
RestHeader ( ) ;
108
100
AddAccessToken ( ) ;
109
101
AddShippingBusinessId ( ) ;
110
-
102
+
111
103
Request = await TokenGeneration . SignWithSTSKeysAndSecurityTokenAsync ( Request , RequestClient . Options . BaseUrl . Host , AmazonCredential ) ;
112
104
var response = await RequestClient . ExecuteAsync < T > ( Request ) ;
113
105
LogRequest ( Request , response ) ;
@@ -133,7 +125,7 @@ private void SaveLastRequestHeader(IReadOnlyCollection<RestSharp.HeaderParameter
133
125
}
134
126
}
135
127
136
- private void LogRequest ( RestRequest request , RestResponse response )
128
+ private void LogRequest ( RestRequest request , RestResponse response )
137
129
{
138
130
if ( AmazonCredential . IsDebugMode )
139
131
{
@@ -162,7 +154,7 @@ private void LogRequest(RestRequest request,RestResponse response)
162
154
errorMessage = response . ErrorMessage ,
163
155
} ;
164
156
165
- Console . WriteLine ( string . Format ( "Request completed, Request: {1 }, Response: {2 }" ,
157
+ Console . WriteLine ( string . Format ( "Request completed, Request: {0 }, Response: {1 }" ,
166
158
JsonConvert . SerializeObject ( requestToLog ) ,
167
159
JsonConvert . SerializeObject ( responseToLog ) ) ) ;
168
160
}
@@ -198,7 +190,7 @@ private void RestHeader()
198
190
{
199
191
if ( tryCount >= AmazonCredential . MaxThrottledRetryCount )
200
192
{
201
- if ( AmazonCredential . IsDebugMode )
193
+ if ( AmazonCredential . IsDebugMode )
202
194
Console . WriteLine ( "Throttle max try count reached" ) ;
203
195
204
196
throw ;
0 commit comments