Duffel.ApiClient
0.3.0
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
<PackageReference Include="Duffel.ApiClient" Version="0.3.0" />
paket add Duffel.ApiClient --version 0.3.0
#r "nuget: Duffel.ApiClient, 0.3.0"
// 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
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 | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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. |
-
.NETStandard 2.1
- Newtonsoft.Json (>= 13.0.1)
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 | 2,463 | 2/5/2024 |
1.0.0-RC8 | 96 | 2/1/2024 |
1.0.0-RC7 | 2,167 | 8/9/2023 |
1.0.0-RC6 | 710 | 3/8/2023 |
1.0.0-RC5 | 463 | 2/7/2023 |
1.0.0-RC4 | 389 | 10/28/2022 |
1.0.0-RC3 | 694 | 8/2/2022 |
1.0.0-RC2 | 156 | 6/17/2022 |
1.0.0-RC11 | 112 | 8/20/2024 |
1.0.0-RC10 | 70 | 7/29/2024 |
1.0.0-RC1 | 154 | 4/4/2022 |
0.3.0 | 788 | 3/2/2022 |
0.2.0 | 456 | 2/23/2022 |
0.1.0 | 438 | 2/17/2022 |
0.0.3-alpha | 172 | 2/10/2022 |
0.0.2-alpha | 169 | 2/10/2022 |
0.0.1-alpha | 188 | 2/9/2022 |