Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 96 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Each SDK version is designed to work with a specific API version. Please refer t

| SDK Version | Supported API Version | Branch |
| ----------- | --------------------- | ---------------------------------------------------------- |
| 12.x.x | 2025-07 | https://github.com/AfterShip/tracking-sdk-net/tree/2025-07 |
| 11.x.x | 2025-04 | https://github.com/AfterShip/tracking-sdk-net/tree/2025-04 |
| 10.x.x | 2025-01 | https://github.com/AfterShip/tracking-sdk-net/tree/2025-01 |
| 9.x.x | 2024-10 | https://github.com/AfterShip/tracking-sdk-net/tree/2024-10 |
Expand Down Expand Up @@ -132,7 +133,7 @@ class Program

## Rate Limiter

See the [Rate Limit](https://www.aftership.com/docs/tracking/2025-04/quickstart/rate-limit) to understand the AfterShip rate limit policy.
See the [Rate Limit](https://www.aftership.com/docs/tracking/2025-07/quickstart/rate-limit) to understand the AfterShip rate limit policy.

## Error Handling

Expand Down Expand Up @@ -293,6 +294,73 @@ DetectCourierResponse resp = client.Courier.DetectCourier(options);
Console.WriteLine(resp.Total);
```

### /courier-connections

**POST** /courier-connections
```csharp
PostCourierConnectionsOptions postCourierConnectionsOptions = new PostCourierConnectionsOptions();
postCourierConnectionsOptions.PostCourierConnectionsRequest = new PostCourierConnectionsRequest();
PostCourierConnectionsRequest req = new PostCourierConnectionsRequest();
req.CourierSlug = "dhl-api";
Dictionary<string, string> credentails = new Dictionary<string, string>();
credentails.Add("api_key", "<dhl_api_key>");
req.Credentials = credentails;
postCourierConnectionsOptions.PostCourierConnectionsRequest = req;
CourierConnection createdCourierConnection = client.CourierConnection.PostCourierConnections(postCourierConnectionsOptions);
if (createdCourierConnection != null)
{
Console.WriteLine(createdCourierConnection.Id);
}
```

**GET** /courier-connections
```csharp
GetCourierConnectionsResponseCourierConnectionListData listCourierConnectionData = client.CourierConnection.GetCourierConnections();
if (listCourierConnectionData != null)
{
for (int i = 0; i < listCourierConnectionData.CourierConnections.Length; i++)
{
Console.WriteLine(listCourierConnectionData.CourierConnections[i].Id);
}
}
```

**GET** /courier-connections/:id
```csharp
CourierConnection courierConnection = client.CourierConnection.GetCourierConnectionsById("<courier connection id>");
if (courierConnection != null)
{
Console.WriteLine(courierConnection.Id);
}
```

**DELETE** /courier-connections/:id
```csharp
CourierConnection courierConnection = client.CourierConnection.DeleteCourierConnectionsById("<courier connection id>");
if (courierConnection != null)
{
Console.WriteLine(courierConnection.Id);
}
```

**PATCH** /courier-connections/:id
```csharp
PutCourierConnectionsByIdOptions putCourierConnectionsOptions = new PutCourierConnectionsByIdOptions();
putCourierConnectionsOptions.PutCourierConnectionsByIdRequest = new PutCourierConnectionsByIdRequest();
PutCourierConnectionsByIdRequest req = new PutCourierConnectionsByIdRequest();

Dictionary<string, string> credentails = new Dictionary<string, string>();
credentails.Add("api_key", "<dhl_api_key>");
req.Credentials = credentails;
putCourierConnectionsOptions.PutCourierConnectionsByIdRequest = req;
CourierConnection courierConnection = client.CourierConnection.PutCourierConnectionsById("<courier connection id>", putCourierConnectionsOptions);
if (courierConnection != null)
{
Console.WriteLine(courierConnection.Id);
}
```


### /estimated-delivery-date

**POST** /estimated-delivery-date/predict-batch
Expand Down Expand Up @@ -326,6 +394,33 @@ PredictBatchResponse resp = client.EstimatedDeliveryDate.PredictBatch(options);
Console.WriteLine(resp.EstimatedDeliveryDates[0].PickupTime);
```

**POST** /estimated-delivery-date/predict

```csharp
PredictOptions options = new PredictOptions();
PredictRequest request = new PredictRequest();

EstimatedDeliveryDateRequest estimatedDeliveryDateRequest = new EstimatedDeliveryDateRequest();

DestinationAddressEstimatedDeliveryDateRequest dest = new DestinationAddressEstimatedDeliveryDateRequest();
dest.CountryRegion = "<ISO 3166-1 country/region code>";
dest.State = "<ISO 3166-1 country/region code>";
estimatedDeliveryDateRequest.DestinationAddress = dest;

OriginAddressEstimatedDeliveryDateRequest origin = new OriginAddressEstimatedDeliveryDateRequest();
origin.CountryRegion = "<ISO 3166-1 country/region code>";
origin.State = "<ISO 3166-1 country/region code>";
estimatedDeliveryDateRequest.OriginAddress = origin;

estimatedDeliveryDateRequest.Slug = "<slug>";
estimatedDeliveryDateRequest.PickupTime = "2024-08-01 06:42:30";

options.PredictRequest = request;

EstimatedDeliveryDateResponse resp = client.EstimatedDeliveryDate.Predict(options);
Console.WriteLine(resp.PickupTime);
```

## Help

If you get stuck, we're here to help:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Copyright>Copyright © AfterShip</Copyright>
<AssemblyTitle>AfterShipTracking</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>11.0.0</VersionPrefix>
<VersionPrefix>12.0.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<Authors>AfterShip</Authors>
Expand Down
8 changes: 4 additions & 4 deletions src/AfterShipTracking/AfterShipTracking/AftershipClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public class AfterShipClient

public IHttpClient HttpClient { get; }

public CourierConnectionService CourierConnection { get; set; }
public TrackingService Tracking { get; set; }
public CourierService Courier { get; set; }
public EstimatedDeliveryDateService EstimatedDeliveryDate { get; set; }
public CourierConnectionService CourierConnection { get; set; }
public CourierService Courier { get; set; }
public AfterShipClient(
string domain = null,
string apiKey = null,
Expand Down Expand Up @@ -96,10 +96,10 @@ public AfterShipClient(

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

CourierConnection = new CourierConnectionService(HttpClient);
Tracking = new TrackingService(HttpClient);
Courier = new CourierService(HttpClient);
EstimatedDeliveryDate = new EstimatedDeliveryDateService(HttpClient);
CourierConnection = new CourierConnectionService(HttpClient);
Courier = new CourierService(HttpClient);
}

private void CheckConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class LatestEstimatedDeliveryCreateTrackingResponse
[JsonProperty("datetime_max")]
public string? DatetimeMax { get; set; }
/// <summary>
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
/// </summary>
[JsonProperty("revise_reason")]
public string? ReviseReason { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class LatestEstimatedDeliveryDeleteTrackingByIdResponse
[JsonProperty("datetime_max")]
public string? DatetimeMax { get; set; }
/// <summary>
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
/// </summary>
[JsonProperty("revise_reason")]
public string? ReviseReason { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class LatestEstimatedDeliveryGetTrackingByIdResponse
[JsonProperty("datetime_max")]
public string? DatetimeMax { get; set; }
/// <summary>
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
/// </summary>
[JsonProperty("revise_reason")]
public string? ReviseReason { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse
[JsonProperty("datetime_max")]
public string? DatetimeMax { get; set; }
/// <summary>
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
/// </summary>
[JsonProperty("revise_reason")]
public string? ReviseReason { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class LatestEstimatedDeliveryRetrackTrackingByIdResponse
[JsonProperty("datetime_max")]
public string? DatetimeMax { get; set; }
/// <summary>
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
/// </summary>
[JsonProperty("revise_reason")]
public string? ReviseReason { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/AfterShipTracking/AfterShipTracking/Models/Tracking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class LatestEstimatedDeliveryTracking
[JsonProperty("datetime_max",NullValueHandling = NullValueHandling.Ignore)]
public string? DatetimeMax { get; set; }
/// <summary>
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
/// </summary>
[JsonProperty("revise_reason",NullValueHandling = NullValueHandling.Ignore)]
public string? ReviseReason { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class LatestEstimatedDeliveryUpdateTrackingByIdResponse
[JsonProperty("datetime_max")]
public string? DatetimeMax { get; set; }
/// <summary>
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
/// ReviseReason Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
/// </summary>
[JsonProperty("revise_reason")]
public string? ReviseReason { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

internal class AssemblyInformation
{
public const string AssemblyInformationalVersion = "11.0.0";
public const string AssemblyInformationalVersion = "12.0.0";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class AfterShipConfiguration
public const string SDK_PREFIX = "AFTERSHIP_TRACKING_SDK";
public const int DEFAULT_MAX_RETRY = 2;
public const int DEFAULT_TIMEOUT = 10000;
public const string DEFAULT_USER_AGENT = "tracking-sdk-net/11.0.0 (https://www.aftership.com) System.Net.Http.HttpClient/0.0.0";
public const string DEFAULT_USER_AGENT = "tracking-sdk-net/12.0.0 (https://www.aftership.com) System.Net.Http.HttpClient/0.0.0";
public const string DEFAULT_DOMAIN = "https://api.aftership.com";

private static string domain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CourierService(IHttpClient httpClient)

public GetCouriersResponse GetCouriers( GetCouriersOptions? options = null)
{
string path = $"/tracking/2025-04/couriers";
string path = $"/tracking/2025-07/couriers";
Request request = new Request(
HttpMethod.Get,
path,
Expand All @@ -30,7 +30,7 @@ public GetCouriersResponse GetCouriers( GetCouriersOptions? options = null)
}
public DetectCourierResponse DetectCourier( DetectCourierOptions? options = null)
{
string path = $"/tracking/2025-04/couriers/detect";
string path = $"/tracking/2025-07/couriers/detect";
Request request = new Request(
HttpMethod.Post,
path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,36 @@ namespace AfterShipTracking
/// <summary>
/// Description
/// </summary>
public class PutCourierConnectionsByIdOptions : BaseOptions
public class PostCourierConnectionsOptions : BaseOptions
{
public PutCourierConnectionsByIdOptions()
public PostCourierConnectionsOptions()
{
}


public PutCourierConnectionsByIdRequest PutCourierConnectionsByIdRequest { get; set; }
public PostCourierConnectionsRequest PostCourierConnectionsRequest { get; set; }

override public string GetBody()
{
string body = null;

if ( PutCourierConnectionsByIdRequest != null)
if ( PostCourierConnectionsRequest != null)
{
body = BaseResourceService.ToJson(PutCourierConnectionsByIdRequest);
body = BaseResourceService.ToJson(PostCourierConnectionsRequest);
}
return body;
}
}
/// <summary>
/// Description
/// </summary>
public class DeleteCourierConnectionsByIdOptions : BaseOptions
{
public DeleteCourierConnectionsByIdOptions()
{
}


}
/// <summary>
/// Description
Expand All @@ -55,29 +66,6 @@ override public List<KeyValuePair<string, string>> GetQueryParams()
/// <summary>
/// Description
/// </summary>
public class PostCourierConnectionsOptions : BaseOptions
{
public PostCourierConnectionsOptions()
{
}


public PostCourierConnectionsRequest PostCourierConnectionsRequest { get; set; }

override public string GetBody()
{
string body = null;

if ( PostCourierConnectionsRequest != null)
{
body = BaseResourceService.ToJson(PostCourierConnectionsRequest);
}
return body;
}
}
/// <summary>
/// Description
/// </summary>
public class GetCourierConnectionsByIdOptions : BaseOptions
{
public GetCourierConnectionsByIdOptions()
Expand All @@ -89,12 +77,24 @@ public GetCourierConnectionsByIdOptions()
/// <summary>
/// Description
/// </summary>
public class DeleteCourierConnectionsByIdOptions : BaseOptions
public class PutCourierConnectionsByIdOptions : BaseOptions
{
public DeleteCourierConnectionsByIdOptions()
public PutCourierConnectionsByIdOptions()
{
}


public PutCourierConnectionsByIdRequest PutCourierConnectionsByIdRequest { get; set; }

override public string GetBody()
{
string body = null;

if ( PutCourierConnectionsByIdRequest != null)
{
body = BaseResourceService.ToJson(PutCourierConnectionsByIdRequest);
}
return body;
}
}
}
Loading