EasyPost-Extensions
0.1.0
See the version list below for details.
dotnet add package EasyPost-Extensions --version 0.1.0
NuGet\Install-Package EasyPost-Extensions -Version 0.1.0
<PackageReference Include="EasyPost-Extensions" Version="0.1.0" />
paket add EasyPost-Extensions --version 0.1.0
#r "nuget: EasyPost-Extensions, 0.1.0"
// Install EasyPost-Extensions as a Cake Addin #addin nuget:?package=EasyPost-Extensions&version=0.1.0 // Install EasyPost-Extensions as a Cake Tool #tool nuget:?package=EasyPost-Extensions&version=0.1.0
EasyPost Extensions (.NET)
A collection of helper utilities for the EasyPost .NET Client.
This project is unaffiliated with EasyPost.
Installation
The easiest way to install the EasyPost Extensions is via NuGet:
Install-Package EasyPost-Extensions
Usage
Parameter Dictionary Creation
Currently, the EasyPost .NET library requires end-users to pass in pre-formatted dictionaries of key-value pairs of data to the functions.
Example:
var parameters = new Dictionary<string, object> {
{ "name", "My Name" },
{ "street1", "123 Main St" },
{ "city", "San Francisco" },
{ "state", "CA" },
{ "zip", "94105" },
{ "country", "US" },
{ "phone", "415-123-4567" }
};
var address = myClient.Address.Create(parameters);
This can lead to some confusion when end-users are not familiar with what JSON key-value pairs are expected for a given function.
This can also lead to errors if the end-user were to accidentally misspell a key, or if the key were to change in a future version of the library.
The EasyPost Extensions library provides a set of helper functions to create these dictionaries for you, ensuring that:
- The correct keys are used
- The correct value types are used
- The data is formatted correctly
- All required parameters are included
Example:
// Use an object constructor to create the address creation parameters
var addressCreateParameters = new EasyPost.Extensions.Parameters.Address.Create {
Name = "My Name",
Street1 = "123 Main St",
City = "San Francisco",
State = "CA",
Zip = "94105",
Country = "US",
Phone = "415-123-4567"
};
// You can add additional parameters as needed outside of the constructor
addressCreateParameters.Company = "My Company";
// Then convert the object to a dictionary
// This step will validate the data and throw an exception if there are any errors (i.e. missing required parameters)
var addressCreateDictionary = addressCreateParameters.ToDictionary();
// Pass the dictionary into the EasyPost .NET library method as normal
var address = myClient.Address.Create(addressCreateDictionary);
The parameter object models are divided by object type (i.e. Address, Parcel, etc.) and by function (i.e. Create, Retrieve, etc.).
Optionally, the ToDictionary()
method can accept an ApiVersion
enum value to specify the API version to use when validating the data.
Internally, each parameter is marked with an ApiCompatibility
attribute that specifies the API version(s) that the parameter is compatible with. The provided API version can be utilized for compatibility checks during validation if provided. This can be useful if the EasyPost API parameters ever change in the future.
API URL Generator
The EasyPost API is currently on v2
, but there is also the beta
version for beta features.
In case the EasyPost API base URL ever changes (either to a new subdomain or to a new version), the EasyPost Extensions library provides a helper function to generate the API URL for you.
Example:
// Generate the API URL for the v2 API
var apiVersionV2Enum = EasyPost.Extensions.ApiVersion.V2;
var apiV2Url = = EasyPost.Extensions.General.BuildApiBaseUrl(apiVersionV2Enum);
// apiV2Url will be, e.g. "https://api.easypost.com/v2/"
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- EasyPost-Official (>= 4.0.0)
- N8.NetTools (>= 0.4.0)
- N8.NetTools.Attributes (>= 0.2.0)
-
.NETStandard 2.0
- EasyPost-Official (>= 4.0.0)
- N8.NetTools (>= 0.4.0)
- N8.NetTools.Attributes (>= 0.2.0)
-
.NETStandard 2.1
- EasyPost-Official (>= 4.0.0)
- N8.NetTools (>= 0.4.0)
- N8.NetTools.Attributes (>= 0.2.0)
-
net5.0
- EasyPost-Official (>= 4.0.0)
- N8.NetTools (>= 0.4.0)
- N8.NetTools.Attributes (>= 0.2.0)
-
net6.0
- EasyPost-Official (>= 4.0.0)
- N8.NetTools (>= 0.4.0)
- N8.NetTools.Attributes (>= 0.2.0)
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.7.2 | 76 | 11/5/2024 |
1.7.1 | 82 | 10/11/2024 |
1.7.0 | 108 | 10/10/2024 |
1.6.1 | 88 | 10/9/2024 |
1.6.0 | 85 | 10/9/2024 |
1.5.0 | 122 | 6/6/2024 |
1.4.0 | 249 | 11/6/2023 |
1.3.0 | 145 | 8/30/2023 |
1.2.0 | 181 | 7/6/2023 |
1.1.0 | 144 | 6/7/2023 |
1.0.0 | 160 | 5/16/2023 |
0.6.0 | 301 | 1/29/2023 |
0.5.0 | 286 | 1/22/2023 |
0.4.0 | 286 | 1/18/2023 |
0.3.0 | 284 | 1/14/2023 |
0.2.0 | 311 | 12/19/2022 |
0.1.0 | 328 | 10/19/2022 |
See Release Notes at https://github.com/nwithan8/easypost-extensions-dotnet/releases