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
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ If you need support using AfterShip products, please contact support@aftership.c
- [Endpoints](#endpoints)
- [/trackings](#trackings)
- [/couriers](#couriers)
- [/courier-connections](#courier-connections)
- [/estimated-delivery-date](#estimated-delivery-date)
- [Help](#help)
- [License](#license)
Expand All @@ -41,6 +42,7 @@ Each SDK version is designed to work with a specific API version. Please refer t

| SDK Version | Supported API Version | Branch |
| ----------- | --------------------- | ---------------------------------------------------------- |
| 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 |
| 8.x.x | 2024-07 | https://github.com/AfterShip/tracking-sdk-net/tree/2024-07 |
Expand Down Expand Up @@ -130,7 +132,7 @@ class Program

## Rate Limiter

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

## Error Handling

Expand Down Expand Up @@ -178,6 +180,7 @@ The AfterShip instance has the following properties which are exactly the same a

- courier - Get a list of our supported couriers.
- tracking - Create trackings, update trackings, and get tracking results.
- courier-connection - Create courier connections, update courier connections, and get courier connections results.
- estimated-delivery-date - Get estimated delivery date for your order.


Expand Down Expand Up @@ -216,7 +219,7 @@ if (resp != null)
```csharp
GetTrackingsOptions options = new GetTrackingsOptions();
options.Keyword = "test";
GetTrackingsResponseTrackingListData trackingsData = client.Tracking.GetTrackings(options);
GetTrackingsResponse trackingsData = client.Tracking.GetTrackings(options);
if (trackingsData != null && trackingsData.Trackings != null)
{
for (int i = 0; i < trackingsData.Trackings.Length; i++)
Expand Down Expand Up @@ -274,16 +277,8 @@ Console.WriteLine(tracking.TrackingNumber);
**GET** /couriers

```csharp
GetUserCouriersOptions options = new GetUserCouriersOptions();
GetUserCouriersResponse resp = client.Courier.GetUserCouriers(options);
Console.WriteLine(resp.Total);
```

**GET** /couriers/all

```csharp
GetAllCouriersOptions options = new GetAllCouriersOptions();
GetAllCouriersResponse resp = client.Courier.GetAllCouriers(options);
GetCouriersOptions options = new GetCouriersOptions();
GetCouriersResponse resp = client.Courier.GetCouriers(options);
Console.WriteLine(resp.Total);
```

Expand Down
Binary file removed src/.DS_Store
Binary file not shown.
Binary file removed src/AfterShipTracking/.DS_Store
Binary file not shown.
40 changes: 20 additions & 20 deletions src/AfterShipTracking/AfterShipTracking.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AfterShipTracking", "AfterShipTracking\AfterShipTracking.csproj", "{D3099A91-E005-4291-88AD-D7A3B85DDC1D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Release|Any CPU.Build.0 = Release|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C216FDA-5980-4A44-A348-7C9B82282CE4}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3099A91-E005-4291-88AD-D7A3B85DDC1D}.Release|Any CPU.Build.0 = Release|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2C22390-8325-4493-B940-F89BD8BA19EA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C216FDA-5980-4A44-A348-7C9B82282CE4}
EndGlobalSection
EndGlobal
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>10.0.0</VersionPrefix>
<VersionPrefix>11.0.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<Authors>AfterShip</Authors>
Expand All @@ -30,9 +30,9 @@
</PropertyGroup>

<ItemGroup>
<None Include="../../../README.md" Pack="true" PackagePath="\" />
<None Include="../../../icon.png" Pack="true" PackagePath="\" />
<None Include="../../../LICENSE.txt" Pack="true" PackagePath="\" />
<None Include="../../../README.md" Pack="true" PackagePath="\"/>
<None Include="../../../icon.png" Pack="true" PackagePath="\"/>
<None Include="../../../LICENSE.txt" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 5 additions & 3 deletions src/AfterShipTracking/AfterShipTracking/AftershipClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class AfterShipClient
public TrackingService Tracking { get; set; }
public CourierService Courier { get; set; }
public EstimatedDeliveryDateService EstimatedDeliveryDate { get; set; }
public CourierConnectionService CourierConnection { get; set; }
public AfterShipClient(
string domain = null,
string apiKey = null,
Expand All @@ -81,8 +82,8 @@ public AfterShipClient(
{
Domain = domain ?? AfterShipConfiguration.Domain;
ApiBase = Domain;
MaxRetry = maxRetry == 0 ? AfterShipConfiguration.MaxRetry : maxRetry;
Timeout = timeout == 0 ? AfterShipConfiguration.Timeout : timeout;
MaxRetry = maxRetry ==0 ? AfterShipConfiguration.MaxRetry:maxRetry;
Timeout = timeout ==0? AfterShipConfiguration.Timeout: timeout;
UserAgent = userAgent ?? AfterShipConfiguration.UserAgent;
Proxy = proxy ?? AfterShipConfiguration.Proxy;
ApiKey = apiKey ?? AfterShipConfiguration.ApiKey;
Expand All @@ -93,11 +94,12 @@ public AfterShipClient(

Authenticator authenticator = new Authenticator(ApiKey, ApiSecret, AuthenticationType);

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

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

private void CheckConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class ErrorCode
{ INTERNAL_ERROR, "Something went wrong on AfterShip's end."},
};

public static AfterShipError GenAPIError(int statusCode, int metaCode, string responseBody = null, string message = null, object responseHeader = null)
public static AfterShipError GenAPIError(int statusCode, int metaCode, string responseBody = null, string message = null, object responseHeader= null)
{
string errorCode = LocateErrorCode(metaCode);
return GenError(errorCode, statusCode, metaCode, responseBody, message, responseHeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ namespace AfterShipTracking
/// All available additional fields
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum AdditionalFieldsV1
public enum AdditionalFields
{
[EnumMember(Value = "tracking_account_number")]
TrackingAccountNumber,
[EnumMember(Value = "tracking_postal_code")]
TrackingPostalCode,
[EnumMember(Value = "tracking_ship_date")]
TrackingShipDate,
[EnumMember(Value = "destination_postal_code")]
DestinationPostalCode,
[EnumMember(Value = "destination_state")]
DestinationState,
[EnumMember(Value = "tracking_key")]
TrackingKey,
[EnumMember(Value = "tracking_origin_country_region")]
TrackingOriginCountryRegion,
[EnumMember(Value = "tracking_destination_country_region")]
TrackingDestinationCountryRegion,
[EnumMember(Value = "tracking_state")]
TrackingState,
[EnumMember(Value = "origin_country_region")]
OriginCountryRegion,
[EnumMember(Value = "destination_country_region")]
DestinationCountryRegion,
[EnumMember(Value = "tracking_ship_date")]
TrackingShipDate,
}
}
98 changes: 49 additions & 49 deletions src/AfterShipTracking/AfterShipTracking/Models/Checkpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,113 +11,113 @@ namespace AfterShipTracking
/// <summary>
/// Object describes checkpoint information.
/// </summary>
public class Checkpoint
public class Checkpoint
{
/// <summary>
/// CreatedAt The date and time of the checkpoint event was added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.
/// </summary>
[JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)]
public string? CreatedAt { get; set; }
[JsonProperty("created_at",NullValueHandling = NullValueHandling.Ignore)]
public string? CreatedAt { get; set; }
/// <summary>
/// Slug The unique code of courier for this checkpoint. Get courier slug
/// </summary>
[JsonProperty("slug", NullValueHandling = NullValueHandling.Ignore)]
public string? Slug { get; set; }
[JsonProperty("slug",NullValueHandling = NullValueHandling.Ignore)]
public string? Slug { get; set; }
/// <summary>
/// CheckpointTime The date and time of the checkpoint event, provided by the carrier. It uses the timezone of the checkpoint. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
/// </summary>
[JsonProperty("checkpoint_time", NullValueHandling = NullValueHandling.Ignore)]
public string? CheckpointTime { get; set; }
[JsonProperty("checkpoint_time",NullValueHandling = NullValueHandling.Ignore)]
public string? CheckpointTime { get; set; }
/// <summary>
/// Location Location info provided by carrier
/// </summary>
[JsonProperty("location", NullValueHandling = NullValueHandling.Ignore)]
public string? Location { get; set; }
[JsonProperty("location",NullValueHandling = NullValueHandling.Ignore)]
public string? Location { get; set; }
/// <summary>
/// City City info provided by carrier
/// </summary>
[JsonProperty("city", NullValueHandling = NullValueHandling.Ignore)]
public string? City { get; set; }
[JsonProperty("city",NullValueHandling = NullValueHandling.Ignore)]
public string? City { get; set; }
/// <summary>
/// State State info provided by carrier
/// </summary>
[JsonProperty("state", NullValueHandling = NullValueHandling.Ignore)]
public string? State { get; set; }
[JsonProperty("state",NullValueHandling = NullValueHandling.Ignore)]
public string? State { get; set; }
/// <summary>
/// Zip Postal code info provided by carrier
/// </summary>
[JsonProperty("zip", NullValueHandling = NullValueHandling.Ignore)]
public string? Zip { get; set; }
[JsonProperty("zip",NullValueHandling = NullValueHandling.Ignore)]
public string? Zip { get; set; }
/// <summary>
/// Coordinate The latitude and longitude coordinates indicate the precise location of the shipments that are currently in transit.
/// </summary>
[JsonProperty("coordinate", NullValueHandling = NullValueHandling.Ignore)]
public CoordinateCheckpoint? Coordinate { get; set; }
[JsonProperty("coordinate",NullValueHandling = NullValueHandling.Ignore)]
public CoordinateCheckpoint? Coordinate { get; set; }
/// <summary>
/// CountryRegion Country/Region ISO Alpha-3 (three letters) of the checkpoint
/// </summary>
[JsonProperty("country_region", NullValueHandling = NullValueHandling.Ignore)]
public string? CountryRegion { get; set; }
[JsonProperty("country_region",NullValueHandling = NullValueHandling.Ignore)]
public string? CountryRegion { get; set; }
/// <summary>
/// CountryRegionName Country/Region name of the checkpoint, may also contain other location info.
/// </summary>
[JsonProperty("country_region_name", NullValueHandling = NullValueHandling.Ignore)]
public string? CountryRegionName { get; set; }
[JsonProperty("country_region_name",NullValueHandling = NullValueHandling.Ignore)]
public string? CountryRegionName { get; set; }
/// <summary>
/// Message Checkpoint message
/// </summary>
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
public string? Message { get; set; }
[JsonProperty("message",NullValueHandling = NullValueHandling.Ignore)]
public string? Message { get; set; }
/// <summary>
/// Tag Current status of tracking. (
/// </summary>
[JsonProperty("tag", NullValueHandling = NullValueHandling.Ignore)]
public TagV1? Tag { get; set; }
[JsonProperty("tag",NullValueHandling = NullValueHandling.Ignore)]
public Tag? Tag { get; set; }
/// <summary>
/// Subtag Current subtag of checkpoint. (
/// </summary>
[JsonProperty("subtag", NullValueHandling = NullValueHandling.Ignore)]
public string? Subtag { get; set; }
[JsonProperty("subtag",NullValueHandling = NullValueHandling.Ignore)]
public string? Subtag { get; set; }
/// <summary>
/// SubtagMessage Normalized checkpoint message. (
/// </summary>
[JsonProperty("subtag_message", NullValueHandling = NullValueHandling.Ignore)]
public string? SubtagMessage { get; set; }
[JsonProperty("subtag_message",NullValueHandling = NullValueHandling.Ignore)]
public string? SubtagMessage { get; set; }
/// <summary>
/// RawTag Checkpoint raw status provided by courier
/// </summary>
[JsonProperty("raw_tag", NullValueHandling = NullValueHandling.Ignore)]
public string? RawTag { get; set; }
[JsonProperty("raw_tag",NullValueHandling = NullValueHandling.Ignore)]
public string? RawTag { get; set; }
/// <summary>
/// Events The array provides details about specific event(s) that occurred to a shipment, such as "returned_to_sender". You can find the full list of events and reasons </span>- The events' value for the same checkpoint message is subject to change as we consistently strive to enhance the performance of this feature.
/// </summary>
[JsonProperty("events", NullValueHandling = NullValueHandling.Ignore)]
public EventsCheckpoint?[] Events { get; set; }
[JsonProperty("events",NullValueHandling = NullValueHandling.Ignore)]
public EventsCheckpoint? [] Events { get; set; }
/// <summary>
/// Source The source of the checkpoint, which can either be from the carrier or when the user marks the tracking as completed.
/// </summary>
[JsonProperty("source", NullValueHandling = NullValueHandling.Ignore)]
public string? Source { get; set; }
[JsonProperty("source",NullValueHandling = NullValueHandling.Ignore)]
public string? Source { get; set; }
public Checkpoint()
{
}
}

/// <summary>
///
/// </summary>
public class CoordinateCheckpoint
public class CoordinateCheckpoint
{
/// <summary>
/// Latitude Represents the latitude.
/// </summary>
[JsonProperty("latitude", NullValueHandling = NullValueHandling.Ignore)]
public double? Latitude { get; set; }
[JsonProperty("latitude",NullValueHandling = NullValueHandling.Ignore)]
public double? Latitude { get; set; }
/// <summary>
/// Longitude Represents the longitude.
/// </summary>
[JsonProperty("longitude", NullValueHandling = NullValueHandling.Ignore)]
public double? Longitude { get; set; }
[JsonProperty("longitude",NullValueHandling = NullValueHandling.Ignore)]
public double? Longitude { get; set; }

public CoordinateCheckpoint()
{
Expand All @@ -126,13 +126,13 @@ public CoordinateCheckpoint()
/// <summary>
///
/// </summary>
public class ReasonEventsCheckpoint
public class ReasonEventsCheckpoint
{
/// <summary>
/// Code The code of the reason.
/// </summary>
[JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)]
public string? Code { get; set; }
[JsonProperty("code",NullValueHandling = NullValueHandling.Ignore)]
public string? Code { get; set; }

public ReasonEventsCheckpoint()
{
Expand All @@ -141,18 +141,18 @@ public ReasonEventsCheckpoint()
/// <summary>
///
/// </summary>
public class EventsCheckpoint
public class EventsCheckpoint
{
/// <summary>
/// Code Represents the event code.
/// </summary>
[JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)]
public string? Code { get; set; }
[JsonProperty("code",NullValueHandling = NullValueHandling.Ignore)]
public string? Code { get; set; }
/// <summary>
/// Reason Describes the specific reason that led to the event.
/// </summary>
[JsonProperty("reason", NullValueHandling = NullValueHandling.Ignore)]
public ReasonEventsCheckpoint? Reason { get; set; }
[JsonProperty("reason",NullValueHandling = NullValueHandling.Ignore)]
public ReasonEventsCheckpoint? Reason { get; set; }

public EventsCheckpoint()
{
Expand Down
Loading