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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="chasp-sdk-client" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="chasp-sdk-client" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="chasp-sdk-client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add chasp-sdk-client --version 1.0.0
                    
#r "nuget: chasp-sdk-client, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package chasp-sdk-client@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=chasp-sdk-client&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=chasp-sdk-client&version=1.0.0
                    
Install as a Cake Tool

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

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);
            }
        }
    }
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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