chasp-sdk-client
1.0.0
dotnet add package chasp-sdk-client --version 1.0.0
NuGet\Install-Package chasp-sdk-client -Version 1.0.0
<PackageReference Include="chasp-sdk-client" Version="1.0.0" />
<PackageVersion Include="chasp-sdk-client" Version="1.0.0" />
<PackageReference Include="chasp-sdk-client" />
paket add chasp-sdk-client --version 1.0.0
#r "nuget: chasp-sdk-client, 1.0.0"
#:package chasp-sdk-client@1.0.0
#addin nuget:?package=chasp-sdk-client&version=1.0.0
#tool nuget:?package=chasp-sdk-client&version=1.0.0
IO.Swagger - the C# library for the Order Tracking API
API for tracking orders
This C# SDK is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.dotnet.CSharpClientCodegen
<a name="frameworks-supported"></a>
Frameworks supported
- .NET 4.7.1 or later
<a name="dependencies"></a>
Dependencies
- RestSharp - 111.4.1 or later
- Json.NET - 7.0.0 or later
- JsonSubTypes - 1.2.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742
<a name="installation"></a>
Installation
Run the following commands to generate the DLL
cd src/IO.Swagger
dotnet restore
dotnet build
Then include the DLL (under the bin folder) in the C# project, and use the namespaces:
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
<a name="packaging"></a>
Packaging
A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.
This .nuspec uses placeholders from the .csproj, so build the .csproj directly:
nuget pack -Build -OutputDirectory out IO.Swagger.csproj
Then, publish to a local feed or other host and consume the new package via Nuget as usual.
<a name="getting-started"></a>
Getting Started
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
var apiInstance = new DefaultApi();
var xApiKey = xApiKey_example; // string | API key for authentication
var orderNumber = orderNumber_example; // string | Order number to track
try
{
// Track an order
InlineResponse200 result = apiInstance.ApiOrdersTrackGet(xApiKey, orderNumber);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling DefaultApi.ApiOrdersTrackGet: " + e.Message );
}
}
}
}
<a name="documentation-for-api-endpoints"></a>
Documentation for API Endpoints
All URIs are relative to http://localhost:3000
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DefaultApi | ApiOrdersTrackGet | GET /api/orders/track | Track an order |
<a name="documentation-for-models"></a>
Documentation for Models
<a name="documentation-for-authorization"></a>
Documentation for Authorization
All endpoints do not require authorization.
Example usage with Polly
using System;
using System.Diagnostics;
using System.Net.Http;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
using Polly;
using Polly.Retry;
namespace Example
{
public class Example
{
public void Main()
{
var apiInstance = new DefaultApi();
var xApiKey = "xApiKey_example"; // string | API key for authentication
var orderNumber = "orderNumber_example"; // string | Order number to track
// Define a retry policy with exponential backoff
RetryPolicy retryPolicy = Policy
.Handle<HttpRequestException>()
.Or<ApiException>()
.WaitAndRetry(
retryCount: 3,
sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
onRetry: (exception, timeSpan, retryCount, context) =>
{
Debug.WriteLine($"Retry {retryCount} encountered an error: {exception.Message}. Waiting {timeSpan} before next retry.");
});
try
{
// Use Polly to make the API call resilient
retryPolicy.Execute(() =>
{
// Track an order
InlineResponse200 result = apiInstance.ApiOrdersTrackGet(xApiKey, orderNumber);
Debug.WriteLine(result);
});
}
catch (Exception e)
{
Debug.Print("Exception when calling DefaultApi.ApiOrdersTrackGet: " + e.Message);
}
}
}
}
Learn more about Target Frameworks and .NET Standard.
-
- JsonSubTypes (>= 1.2.0)
- NewtonSoft.Json (>= 13.0.3)
- RestSharp (>= 111.4.1)
- System.Net.Http (>= 4.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 588 | 11/10/2024 |