Shippo external API.: Use this API to integrate with the Shippo service
$ dotnet add package Shippodotnet add package Shippo
<!-- End SDK Installation [installation] -->
<!-- Start SDK Example Usage [usage] -->
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08");
var res = await sdk.Addresses.ListAsync(
page: 1,
results: 5,
shippoApiVersion: "2018-02-08");
// handle response
<!-- End SDK Example Usage [usage] -->
<!-- Start Available Resources and Operations [operations] -->
A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
For example, you can set SHIPPO-API-VERSION to "2018-02-08" at SDK initialization and then you do not have to pass the same value on calls to operations like List. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
The following global parameter is available.
| Name | Type | Required | Description |
|---|---|---|---|
| shippoApiVersion | string | String used to pick a non-default API version to use |
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08");
var res = await sdk.Addresses.ListAsync(
page: 1,
results: 5,
shippoApiVersion: "2018-02-08");
// handle response
<!-- End Global Parameters [global-parameters] -->
<!-- Start Error Handling [errors] -->
Handling errors in this SDK should largely match your expectations. All operations return a response object or thow an exception. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate type.
| Error Object | Status Code | Content Type |
|---|---|---|
| Shippo.Models.Errors.InitiateOauth2SigninResponseBody | 400 | application/json |
| Shippo.Models.Errors.InitiateOauth2SigninCarrierAccountsResponseBody | 401 | application/json |
| Shippo.Models.Errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody | 404 | application/json |
| Shippo.Models.Errors.SDKException | 4xx-5xx | / |
using Shippo;
using Shippo.Models.Components;
using System;
using Shippo.Models.Errors;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08");
InitiateOauth2SigninRequest req = new InitiateOauth2SigninRequest() {
CarrierAccountObjectId = "<value>",
RedirectUri = "http://fine-cummerbund.biz",
};
try
{
var res = await sdk.CarrierAccounts.InitiateOauth2SigninAsync(req);
// handle response
}
catch (Exception ex)
{
if (ex is InitiateOauth2SigninResponseBody)
{
// handle exception
}
else if (ex is InitiateOauth2SigninCarrierAccountsResponseBody)
{
// handle exception
}
else if (ex is InitiateOauth2SigninCarrierAccountsResponseResponseBody)
{
// handle exception
}
else if (ex is Shippo.Models.Errors.SDKException)
{
// handle exception
}
}
<!-- End Error Handling [errors] -->
<!-- Start Server Selection [server] -->
You can override the default server globally by passing a server index to the serverIndex: number optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables |
|---|---|---|
| 0 | https://api.goshippo.com | None |
The default server can also be overridden globally by passing a URL to the serverUrl: str optional parameter when initializing the SDK client instance. For example:
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
|---|---|---|
APIKeyHeader | apiKey | API key |
To authenticate with the API the APIKeyHeader parameter must be set when initializing the SDK client instance. For example:
using Shippo;
using Shippo.Models.Components;
using Shippo.Models.Requests;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08");
var res = await sdk.Addresses.ListAsync(
page: 1,
results: 5,
shippoApiVersion: "2018-02-08");
// handle response
<!-- End Authentication [security] -->
<!-- Placeholder for Future Speakeasy SDK Sections -->
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!