1
1
using FikaAmazonAPI . AmazonSpApiSDK . Models . FbaSmallandLight ;
2
2
using FikaAmazonAPI . Utils ;
3
3
using System . Collections . Generic ;
4
+ using System . Threading . Tasks ;
4
5
5
6
namespace FikaAmazonAPI . Services
6
7
{
@@ -13,67 +14,85 @@ public FbaSmallandLightService(AmazonCredential amazonCredential) : base(amazonC
13
14
}
14
15
15
16
16
- public SmallAndLightEnrollment GetSmallAndLightEnrollmentBySellerSKU ( string sellerSKU )
17
+ public SmallAndLightEnrollment GetSmallAndLightEnrollmentBySellerSKU ( string sellerSKU ) =>
18
+ GetSmallAndLightEnrollmentBySellerSKUAsync ( sellerSKU ) . GetAwaiter ( ) . GetResult ( ) ;
19
+
20
+ public async Task < SmallAndLightEnrollment > GetSmallAndLightEnrollmentBySellerSKUAsync ( string sellerSKU )
17
21
{
18
22
List < KeyValuePair < string , string > > queryParameters = new List < KeyValuePair < string , string > > ( ) ;
19
23
queryParameters . Add ( new KeyValuePair < string , string > ( "marketplaceIds" , AmazonCredential . MarketPlace . ID ) ) ;
20
24
21
- CreateAuthorizedRequest ( FBASmallAndLightApiUrls . GetSmallAndLightEnrollmentBySellerSKU ( sellerSKU ) , RestSharp . Method . GET ) ;
25
+ await CreateAuthorizedRequestAsync ( FBASmallAndLightApiUrls . GetSmallAndLightEnrollmentBySellerSKU ( sellerSKU ) , RestSharp . Method . GET ) ;
22
26
23
- var response = ExecuteRequest < SmallAndLightEnrollment > ( RateLimitType . FbaSmallandLight_GetSmallAndLightEnrollmentBySellerSKU ) ;
27
+ var response = await ExecuteRequestAsync < SmallAndLightEnrollment > ( RateLimitType . FbaSmallandLight_GetSmallAndLightEnrollmentBySellerSKU ) ;
24
28
25
29
return response ;
26
30
27
31
}
28
- public SmallAndLightEnrollment PutSmallAndLightEnrollmentBySellerSKU ( string sellerSKU )
32
+
33
+ public SmallAndLightEnrollment PutSmallAndLightEnrollmentBySellerSKU ( string sellerSKU ) =>
34
+ PutSmallAndLightEnrollmentBySellerSKUAsync ( sellerSKU ) . GetAwaiter ( ) . GetResult ( ) ;
35
+
36
+ public async Task < SmallAndLightEnrollment > PutSmallAndLightEnrollmentBySellerSKUAsync ( string sellerSKU )
29
37
{
30
38
List < KeyValuePair < string , string > > queryParameters = new List < KeyValuePair < string , string > > ( ) ;
31
39
queryParameters . Add ( new KeyValuePair < string , string > ( "marketplaceIds" , AmazonCredential . MarketPlace . ID ) ) ;
32
40
33
41
34
- CreateAuthorizedRequest ( FBASmallAndLightApiUrls . PutSmallAndLightEnrollmentBySellerSKU ( sellerSKU ) , RestSharp . Method . PUT , queryParameters ) ;
42
+ await CreateAuthorizedRequestAsync ( FBASmallAndLightApiUrls . PutSmallAndLightEnrollmentBySellerSKU ( sellerSKU ) , RestSharp . Method . PUT , queryParameters ) ;
35
43
36
- var response = ExecuteRequest < SmallAndLightEnrollment > ( RateLimitType . FbaSmallandLight_PutSmallAndLightEnrollmentBySellerSKU ) ;
44
+ var response = await ExecuteRequestAsync < SmallAndLightEnrollment > ( RateLimitType . FbaSmallandLight_PutSmallAndLightEnrollmentBySellerSKU ) ;
37
45
38
46
return response ;
39
47
40
48
}
41
- public bool DeleteSmallAndLightEnrollmentBySellerSKU ( string sellerSKU )
49
+
50
+ public bool DeleteSmallAndLightEnrollmentBySellerSKU ( string sellerSKU ) =>
51
+ DeleteSmallAndLightEnrollmentBySellerSKUAsync ( sellerSKU ) . GetAwaiter ( ) . GetResult ( ) ;
52
+
53
+ public async Task < bool > DeleteSmallAndLightEnrollmentBySellerSKUAsync ( string sellerSKU )
42
54
{
43
55
List < KeyValuePair < string , string > > queryParameters = new List < KeyValuePair < string , string > > ( ) ;
44
56
queryParameters . Add ( new KeyValuePair < string , string > ( "marketplaceIds" , AmazonCredential . MarketPlace . ID ) ) ;
45
57
46
58
47
- CreateAuthorizedRequest ( FBASmallAndLightApiUrls . DeleteSmallAndLightEnrollmentBySellerSKU ( sellerSKU ) , RestSharp . Method . DELETE , queryParameters ) ;
59
+ await CreateAuthorizedRequestAsync ( FBASmallAndLightApiUrls . DeleteSmallAndLightEnrollmentBySellerSKU ( sellerSKU ) , RestSharp . Method . DELETE , queryParameters ) ;
48
60
49
- var response = ExecuteRequest < object > ( RateLimitType . FbaSmallandLight_DeleteSmallAndLightEnrollmentBySellerSKU ) ;
61
+ var response = await ExecuteRequestAsync < object > ( RateLimitType . FbaSmallandLight_DeleteSmallAndLightEnrollmentBySellerSKU ) ;
50
62
51
63
return true ;
52
64
53
65
}
54
66
55
- public SmallAndLightEligibility GetSmallAndLightEligibilityBySellerSKU ( string sellerSKU )
67
+ public SmallAndLightEligibility GetSmallAndLightEligibilityBySellerSKU ( string sellerSKU ) =>
68
+ GetSmallAndLightEligibilityBySellerSKUAsync ( sellerSKU ) . GetAwaiter ( ) . GetResult ( ) ;
69
+
70
+ public async Task < SmallAndLightEligibility > GetSmallAndLightEligibilityBySellerSKUAsync ( string sellerSKU )
56
71
{
57
72
58
73
List < KeyValuePair < string , string > > queryParameters = new List < KeyValuePair < string , string > > ( ) ;
59
74
queryParameters . Add ( new KeyValuePair < string , string > ( "marketplaceIds" , AmazonCredential . MarketPlace . ID ) ) ;
60
75
61
76
62
- CreateAuthorizedRequest ( FBASmallAndLightApiUrls . GetSmallAndLightEligibilityBySellerSKU ( sellerSKU ) , RestSharp . Method . GET , queryParameters ) ;
77
+ await CreateAuthorizedRequestAsync ( FBASmallAndLightApiUrls . GetSmallAndLightEligibilityBySellerSKU ( sellerSKU ) , RestSharp . Method . GET , queryParameters ) ;
63
78
64
- var response = ExecuteRequest < SmallAndLightEligibility > ( RateLimitType . FbaSmallandLight_GetSmallAndLightEligibilityBySellerSKU ) ;
79
+ var response = await ExecuteRequestAsync < SmallAndLightEligibility > ( RateLimitType . FbaSmallandLight_GetSmallAndLightEligibilityBySellerSKU ) ;
65
80
66
81
return response ;
67
82
68
83
}
69
- public List < FeePreview > GetSmallAndLightFeePreview ( SmallAndLightFeePreviewRequest smallAndLightFeePreviewRequest )
84
+
85
+ public List < FeePreview > GetSmallAndLightFeePreview ( SmallAndLightFeePreviewRequest smallAndLightFeePreviewRequest ) =>
86
+ GetSmallAndLightFeePreviewAsync ( smallAndLightFeePreviewRequest ) . GetAwaiter ( ) . GetResult ( ) ;
87
+
88
+ public async Task < List < FeePreview > > GetSmallAndLightFeePreviewAsync ( SmallAndLightFeePreviewRequest smallAndLightFeePreviewRequest )
70
89
{
71
90
List < KeyValuePair < string , string > > queryParameters = new List < KeyValuePair < string , string > > ( ) ;
72
91
queryParameters . Add ( new KeyValuePair < string , string > ( "marketplaceIds" , AmazonCredential . MarketPlace . ID ) ) ;
73
92
74
- CreateAuthorizedRequest ( FBASmallAndLightApiUrls . GetSmallAndLightFeePreview , RestSharp . Method . POST , postJsonObj : smallAndLightFeePreviewRequest ) ;
93
+ await CreateAuthorizedRequestAsync ( FBASmallAndLightApiUrls . GetSmallAndLightFeePreview , RestSharp . Method . POST , postJsonObj : smallAndLightFeePreviewRequest ) ;
75
94
76
- var response = ExecuteRequest < SmallAndLightFeePreviews > ( RateLimitType . FbaSmallandLight_GetSmallAndLightFeePreview ) ;
95
+ var response = await ExecuteRequestAsync < SmallAndLightFeePreviews > ( RateLimitType . FbaSmallandLight_GetSmallAndLightFeePreview ) ;
77
96
if ( response != null && response . Data != null )
78
97
return response . Data ;
79
98
0 commit comments