Duffel.ApiClient 0.3.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Duffel.ApiClient --version 0.3.0
NuGet\Install-Package Duffel.ApiClient -Version 0.3.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="Duffel.ApiClient" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Duffel.ApiClient --version 0.3.0
#r "nuget: Duffel.ApiClient, 0.3.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.
// Install Duffel.ApiClient as a Cake Addin
#addin nuget:?package=Duffel.ApiClient&version=0.3.0

// Install Duffel.ApiClient as a Cake Tool
#tool nuget:?package=Duffel.ApiClient&version=0.3.0

GitHub license Nuget

duffel-api-dotnet

DotNet client library for the Duffel API

Getting started

Installing latest version:

Install-Package Duffel.ApiClient

Usage

You first need to set the API token you can find in the Duffel dashboard under the section Developers > Access Tokens.

using Duffel.ApiClient;

var accessToken = Environment.GetEnvironmentVariable("DUFFEL_ACCESS_TOKEN");
var client = new DuffelApiClient(accessToken: accessToken, production: false);

After you have a client you can interact with, you can make calls to the Duffel API:

var response = await client.OfferRequests.Create(offersRequest, returnOffers: false);

var selectedOffer = response.Offers.First();

var pricedOffer = await client.Offers.Get(selectedOffer.Id, returnAvailableServices: true);

Error handling

The call to API can result in an error, which will then throw one out of two exceptions:

try
{
  var response = await client.OfferRequests.Create(offersRequest, returnOffers: false);
}
catch (ApiException apiEx)
{
    // apiEx.Errors - list of errors returned by the the API
    // apiEx.Metadata.RequestId - a Duffel id of the request
    // apiEx.StatusCode - an Http status code returned by the API    
}
catch (ApiDeserializationException desEx)
{
    // desEx.Payload - contains payload returned by the API
    // apiEx.StatusCode - an Http status code returned by the API
}

For more detailed information about error handling, see: https://duffel.com/docs/api/overview/errors

Examples

You can find a complete e2e examples in ./Examples folder

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in 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-RC9 140 2/5/2024
1.0.0-RC8 63 2/1/2024
1.0.0-RC7 1,005 8/9/2023
1.0.0-RC6 697 3/8/2023
1.0.0-RC5 438 2/7/2023
1.0.0-RC4 373 10/28/2022
1.0.0-RC3 661 8/2/2022
1.0.0-RC2 143 6/17/2022
1.0.0-RC1 123 4/4/2022
0.3.0 715 3/2/2022
0.2.0 412 2/23/2022
0.1.0 384 2/17/2022
0.0.3-alpha 142 2/10/2022
0.0.2-alpha 152 2/10/2022
0.0.1-alpha 157 2/9/2022