Duffel.ApiClient 0.3.0

.NET Standard 2.1
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


DotNet client library for the Duffel API

Getting started

Installing latest version:

Install-Package Duffel.ApiClient


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:

  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


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-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)
Additional computed target framework(s)
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-RC7 424 8/9/2023
1.0.0-RC6 674 3/8/2023
1.0.0-RC5 403 2/7/2023
1.0.0-RC4 367 10/28/2022
1.0.0-RC3 655 8/2/2022
1.0.0-RC2 136 6/17/2022
1.0.0-RC1 118 4/4/2022
0.3.0 686 3/2/2022
0.2.0 402 2/23/2022
0.1.0 377 2/17/2022
0.0.3-alpha 123 2/10/2022
0.0.2-alpha 120 2/10/2022
0.0.1-alpha 137 2/9/2022