Skip to content

Commit e04064b

Browse files
authored
Merge pull request #12 from 1415003719/2025-07
fix trackings pagination
2 parents 0269384 + d15aebe commit e04064b

File tree

12 files changed

+118
-158
lines changed

12 files changed

+118
-158
lines changed

src/AfterShipTracking/AfterShipTracking/AfterShipTracking.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Copyright>Copyright © AfterShip</Copyright>
1111
<AssemblyTitle>AfterShipTracking</AssemblyTitle>
1212
<NeutralLanguage>en-US</NeutralLanguage>
13-
<VersionPrefix>12.0.0</VersionPrefix>
13+
<VersionPrefix>13.0.0</VersionPrefix>
1414
<VersionSuffix>
1515
</VersionSuffix>
1616
<Authors>AfterShip</Authors>

src/AfterShipTracking/AfterShipTracking/AftershipClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public class AfterShipClient
6464

6565
public IHttpClient HttpClient { get; }
6666

67-
public CourierConnectionService CourierConnection { get; set; }
6867
public TrackingService Tracking { get; set; }
69-
public EstimatedDeliveryDateService EstimatedDeliveryDate { get; set; }
7068
public CourierService Courier { get; set; }
69+
public CourierConnectionService CourierConnection { get; set; }
70+
public EstimatedDeliveryDateService EstimatedDeliveryDate { get; set; }
7171
public AfterShipClient(
7272
string domain = null,
7373
string apiKey = null,
@@ -96,10 +96,10 @@ public AfterShipClient(
9696

9797
HttpClient = httpClient ?? new SystemNetHttpClient(this.ApiBase, authenticator, this.MaxRetry, this.Timeout, this.UserAgent,this.Proxy);
9898

99-
CourierConnection = new CourierConnectionService(HttpClient);
10099
Tracking = new TrackingService(HttpClient);
101-
EstimatedDeliveryDate = new EstimatedDeliveryDateService(HttpClient);
102100
Courier = new CourierService(HttpClient);
101+
CourierConnection = new CourierConnectionService(HttpClient);
102+
EstimatedDeliveryDate = new EstimatedDeliveryDateService(HttpClient);
103103
}
104104

105105
private void CheckConfig()

src/AfterShipTracking/AfterShipTracking/Models/GetCourierConnectionsResponse.cs

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public class GetCourierConnectionsResponse
2424
[JsonProperty("courier_connections")]
2525
public CourierConnection? [] CourierConnections { get; set; }
2626
/// <summary>
27+
/// Count
28+
/// </summary>
29+
[JsonProperty("total")]
30+
public int? Count { get; set; }
31+
/// <summary>
2732
/// Page
2833
/// </summary>
2934
[JsonProperty("page")]
@@ -33,11 +38,6 @@ public class GetCourierConnectionsResponse
3338
/// </summary>
3439
[JsonProperty("limit")]
3540
public int? Limit { get; set; }
36-
/// <summary>
37-
/// Count
38-
/// </summary>
39-
[JsonProperty("total")]
40-
public int? Count { get; set; }
4141
public GetCourierConnectionsResponse()
4242
{
4343
}
@@ -68,24 +68,4 @@ public PaginationGetCourierConnectionsResponse()
6868
{
6969
}
7070
}
71-
/// <summary>
72-
///
73-
/// </summary>
74-
public class GetCourierConnectionsResponseCourierConnectionListData
75-
{
76-
/// <summary>
77-
/// CourierConnections
78-
/// </summary>
79-
[JsonProperty("courier_connections")]
80-
public CourierConnection? [] CourierConnections { get; set; }
81-
/// <summary>
82-
/// Pagination
83-
/// </summary>
84-
[JsonProperty("pagination")]
85-
public PaginationPage? Pagination { get; set; }
86-
87-
public GetCourierConnectionsResponseCourierConnectionListData()
88-
{
89-
}
90-
}
9171
}

src/AfterShipTracking/AfterShipTracking/Models/GetTrackingsResponse.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,4 @@ public PaginationGetTrackingsResponse()
6868
{
6969
}
7070
}
71-
/// <summary>
72-
///
73-
/// </summary>
74-
public class GetTrackingsResponseTrackingListData
75-
{
76-
/// <summary>
77-
/// Trackings
78-
/// </summary>
79-
[JsonProperty("trackings")]
80-
public Tracking? [] Trackings { get; set; }
81-
/// <summary>
82-
/// Pagination
83-
/// </summary>
84-
[JsonProperty("pagination")]
85-
public PaginationPage? Pagination { get; set; }
86-
87-
public GetTrackingsResponseTrackingListData()
88-
{
89-
}
90-
}
9171
}

src/AfterShipTracking/AfterShipTracking/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
internal class AssemblyInformation
1414
{
15-
public const string AssemblyInformationalVersion = "12.0.0";
15+
public const string AssemblyInformationalVersion = "13.0.0";
1616
}

src/AfterShipTracking/AfterShipTracking/Public/AfterShipConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class AfterShipConfiguration
1515
public const string SDK_PREFIX = "AFTERSHIP_TRACKING_SDK";
1616
public const int DEFAULT_MAX_RETRY = 2;
1717
public const int DEFAULT_TIMEOUT = 10000;
18-
public const string DEFAULT_USER_AGENT = "tracking-sdk-net/12.0.0 (https://www.aftership.com) System.Net.Http.HttpClient/0.0.0";
18+
public const string DEFAULT_USER_AGENT = "tracking-sdk-net/13.0.0 (https://www.aftership.com) System.Net.Http.HttpClient/0.0.0";
1919
public const string DEFAULT_DOMAIN = "https://api.aftership.com";
2020

2121
private static string domain;

src/AfterShipTracking/AfterShipTracking/RestAPI/CourierConnection/CourierConnectionOption.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ namespace AfterShipTracking
1010
/// <summary>
1111
/// Description
1212
/// </summary>
13-
public class PostCourierConnectionsOptions : BaseOptions
13+
public class PutCourierConnectionsByIdOptions : BaseOptions
1414
{
15-
public PostCourierConnectionsOptions()
15+
public PutCourierConnectionsByIdOptions()
1616
{
1717
}
1818

1919

20-
public PostCourierConnectionsRequest PostCourierConnectionsRequest { get; set; }
20+
public PutCourierConnectionsByIdRequest PutCourierConnectionsByIdRequest { get; set; }
2121

2222
override public string GetBody()
2323
{
2424
string body = null;
2525

26-
if ( PostCourierConnectionsRequest != null)
26+
if ( PutCourierConnectionsByIdRequest != null)
2727
{
28-
body = BaseResourceService.ToJson(PostCourierConnectionsRequest);
28+
body = BaseResourceService.ToJson(PutCourierConnectionsByIdRequest);
2929
}
3030
return body;
3131
}
@@ -66,35 +66,35 @@ override public List<KeyValuePair<string, string>> GetQueryParams()
6666
/// <summary>
6767
/// Description
6868
/// </summary>
69-
public class GetCourierConnectionsByIdOptions : BaseOptions
70-
{
71-
public GetCourierConnectionsByIdOptions()
72-
{
73-
}
74-
75-
76-
}
77-
/// <summary>
78-
/// Description
79-
/// </summary>
80-
public class PutCourierConnectionsByIdOptions : BaseOptions
69+
public class PostCourierConnectionsOptions : BaseOptions
8170
{
82-
public PutCourierConnectionsByIdOptions()
71+
public PostCourierConnectionsOptions()
8372
{
8473
}
8574

8675

87-
public PutCourierConnectionsByIdRequest PutCourierConnectionsByIdRequest { get; set; }
76+
public PostCourierConnectionsRequest PostCourierConnectionsRequest { get; set; }
8877

8978
override public string GetBody()
9079
{
9180
string body = null;
9281

93-
if ( PutCourierConnectionsByIdRequest != null)
82+
if ( PostCourierConnectionsRequest != null)
9483
{
95-
body = BaseResourceService.ToJson(PutCourierConnectionsByIdRequest);
84+
body = BaseResourceService.ToJson(PostCourierConnectionsRequest);
9685
}
9786
return body;
9887
}
9988
}
89+
/// <summary>
90+
/// Description
91+
/// </summary>
92+
public class GetCourierConnectionsByIdOptions : BaseOptions
93+
{
94+
public GetCourierConnectionsByIdOptions()
95+
{
96+
}
97+
98+
99+
}
100100
}

src/AfterShipTracking/AfterShipTracking/RestAPI/CourierConnection/CourierConnectionService.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ public CourierConnectionService(IHttpClient httpClient)
1616
this.HttpClient = httpClient;
1717
}
1818

19-
public CourierConnection PostCourierConnections( PostCourierConnectionsOptions? options = null)
19+
public CourierConnection PutCourierConnectionsById(string id, PutCourierConnectionsByIdOptions? options = null)
2020
{
21-
string path = $"/tracking/2025-07/courier-connections";
21+
string path = $"/tracking/2025-07/courier-connections/{id}";
22+
if (string.IsNullOrEmpty(id))
23+
{
24+
throw ErrorCode.GenSDKError(ErrorCode.REQUEST_ERROR,"request error"+": `id` is invalid");
25+
}
2226
Request request = new Request(
23-
HttpMethod.Post,
27+
HttpMethod.Patch,
2428
path,
2529
options
2630
);
@@ -44,7 +48,7 @@ public CourierConnection DeleteCourierConnectionsById(string id, DeleteCourierC
4448
var response = this.HttpClient.MakeRequest(request);
4549
return ProcessData<CourierConnection>(response);
4650
}
47-
public GetCourierConnectionsResponseCourierConnectionListData GetCourierConnections( GetCourierConnectionsOptions? options = null)
51+
public GetCourierConnectionsResponse GetCourierConnections( GetCourierConnectionsOptions? options = null)
4852
{
4953
string path = $"/tracking/2025-07/courier-connections";
5054
Request request = new Request(
@@ -54,33 +58,29 @@ public GetCourierConnectionsResponseCourierConnectionListData GetCourierConnecti
5458
);
5559

5660
var response = this.HttpClient.MakeRequest(request);
57-
return ProcessData<GetCourierConnectionsResponseCourierConnectionListData>(response);
61+
return ProcessData<GetCourierConnectionsResponse>(response);
5862
}
59-
public CourierConnection GetCourierConnectionsById(string id, GetCourierConnectionsByIdOptions? options = null)
63+
public CourierConnection PostCourierConnections( PostCourierConnectionsOptions? options = null)
6064
{
61-
string path = $"/tracking/2025-07/courier-connections/{id}";
62-
if (string.IsNullOrEmpty(id))
63-
{
64-
throw ErrorCode.GenSDKError(ErrorCode.REQUEST_ERROR,"request error"+": `id` is invalid");
65-
}
65+
string path = $"/tracking/2025-07/courier-connections";
6666
Request request = new Request(
67-
HttpMethod.Get,
67+
HttpMethod.Post,
6868
path,
6969
options
7070
);
7171

7272
var response = this.HttpClient.MakeRequest(request);
7373
return ProcessData<CourierConnection>(response);
7474
}
75-
public CourierConnection PutCourierConnectionsById(string id, PutCourierConnectionsByIdOptions? options = null)
75+
public CourierConnection GetCourierConnectionsById(string id, GetCourierConnectionsByIdOptions? options = null)
7676
{
7777
string path = $"/tracking/2025-07/courier-connections/{id}";
7878
if (string.IsNullOrEmpty(id))
7979
{
8080
throw ErrorCode.GenSDKError(ErrorCode.REQUEST_ERROR,"request error"+": `id` is invalid");
8181
}
8282
Request request = new Request(
83-
HttpMethod.Patch,
83+
HttpMethod.Get,
8484
path,
8585
options
8686
);

src/AfterShipTracking/AfterShipTracking/RestAPI/EstimatedDeliveryDate/EstimatedDeliveryDateOption.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,45 @@ namespace AfterShipTracking
1010
/// <summary>
1111
/// Description
1212
/// </summary>
13-
public class PredictBatchOptions : BaseOptions
13+
public class PredictOptions : BaseOptions
1414
{
15-
public PredictBatchOptions()
15+
public PredictOptions()
1616
{
1717
}
1818

1919

20-
public PredictBatchRequest PredictBatchRequest { get; set; }
20+
public PredictRequest PredictRequest { get; set; }
2121

2222
override public string GetBody()
2323
{
2424
string body = null;
2525

26-
if ( PredictBatchRequest != null)
26+
if ( PredictRequest != null)
2727
{
28-
body = BaseResourceService.ToJson(PredictBatchRequest);
28+
body = BaseResourceService.ToJson(PredictRequest);
2929
}
3030
return body;
3131
}
3232
}
3333
/// <summary>
3434
/// Description
3535
/// </summary>
36-
public class PredictOptions : BaseOptions
36+
public class PredictBatchOptions : BaseOptions
3737
{
38-
public PredictOptions()
38+
public PredictBatchOptions()
3939
{
4040
}
4141

4242

43-
public PredictRequest PredictRequest { get; set; }
43+
public PredictBatchRequest PredictBatchRequest { get; set; }
4444

4545
override public string GetBody()
4646
{
4747
string body = null;
4848

49-
if ( PredictRequest != null)
49+
if ( PredictBatchRequest != null)
5050
{
51-
body = BaseResourceService.ToJson(PredictRequest);
51+
body = BaseResourceService.ToJson(PredictBatchRequest);
5252
}
5353
return body;
5454
}

src/AfterShipTracking/AfterShipTracking/RestAPI/EstimatedDeliveryDate/EstimatedDeliveryDateService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,29 @@ public EstimatedDeliveryDateService(IHttpClient httpClient)
1616
this.HttpClient = httpClient;
1717
}
1818

19-
public PredictBatchResponse PredictBatch( PredictBatchOptions? options = null)
19+
public EstimatedDeliveryDateResponse Predict( PredictOptions? options = null)
2020
{
21-
string path = $"/tracking/2025-07/estimated-delivery-date/predict-batch";
21+
string path = $"/tracking/2025-07/estimated-delivery-date/predict";
2222
Request request = new Request(
2323
HttpMethod.Post,
2424
path,
2525
options
2626
);
2727

2828
var response = this.HttpClient.MakeRequest(request);
29-
return ProcessData<PredictBatchResponse>(response);
29+
return ProcessData<EstimatedDeliveryDateResponse>(response);
3030
}
31-
public EstimatedDeliveryDateResponse Predict( PredictOptions? options = null)
31+
public PredictBatchResponse PredictBatch( PredictBatchOptions? options = null)
3232
{
33-
string path = $"/tracking/2025-07/estimated-delivery-date/predict";
33+
string path = $"/tracking/2025-07/estimated-delivery-date/predict-batch";
3434
Request request = new Request(
3535
HttpMethod.Post,
3636
path,
3737
options
3838
);
3939

4040
var response = this.HttpClient.MakeRequest(request);
41-
return ProcessData<EstimatedDeliveryDateResponse>(response);
41+
return ProcessData<PredictBatchResponse>(response);
4242
}
4343
}
4444
}

0 commit comments

Comments
 (0)