Codat.Platform
6.1.0
dotnet add package Codat.Platform --version 6.1.0
NuGet\Install-Package Codat.Platform -Version 6.1.0
<PackageReference Include="Codat.Platform" Version="6.1.0" />
<PackageVersion Include="Codat.Platform" Version="6.1.0" />
<PackageReference Include="Codat.Platform" />
paket add Codat.Platform --version 6.1.0
#r "nuget: Codat.Platform, 6.1.0"
#:package Codat.Platform@6.1.0
#addin nuget:?package=Codat.Platform&version=6.1.0
#tool nuget:?package=Codat.Platform&version=6.1.0
Codat.Platform
SDK Example Usage
Example
using Codat.Platform;
using Codat.Platform.Models.Components;
using Codat.Platform.Models.Requests;
var sdk = new CodatPlatform(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
Tags = "region=uk && team=invoice-finance",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply pass a RetryConfig
to the call:
using Codat.Platform;
using Codat.Platform.Models.Components;
using Codat.Platform.Models.Requests;
var sdk = new CodatPlatform(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
Tags = "region=uk && team=invoice-finance",
};
var res = await sdk.Companies.ListAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
request: req
);
// handle response
If you'd like to override the default retry strategy for all operations that support retries, you can use the RetryConfig
optional parameter when intitializing the SDK:
using Codat.Platform;
using Codat.Platform.Models.Components;
using Codat.Platform.Models.Requests;
var sdk = new CodatPlatform(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
authHeader: "Basic BASE_64_ENCODED(API_KEY)"
);
ListCompaniesRequest req = new ListCompaniesRequest() {
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
Tags = "region=uk && team=invoice-finance",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
Error Handling
CodatPlatformException
is the base exception class for all HTTP error responses. It has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | Error message |
StatusCode |
int | HTTP status code |
Headers |
HttpResponseHeaders | HTTP headers |
ContentType |
string? | HTTP content type |
RawResponse |
HttpResponseMessage | HTTP response object |
Body |
string | HTTP response body |
Some exceptions in this SDK include an additional Payload
field, which will contain deserialized custom error data when present. Possible exceptions are listed in the Error Classes section.
Example
using Codat.Platform;
using Codat.Platform.Models.Components;
using Codat.Platform.Models.Errors;
using Codat.Platform.Models.Requests;
var sdk = new CodatPlatform(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
try
{
ListCompaniesRequest req = new ListCompaniesRequest() {
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
Tags = "region=uk && team=invoice-finance",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
}
catch (CodatPlatformException ex) // all SDK exceptions inherit from CodatPlatformException
{
// ex.ToString() provides a detailed error message
System.Console.WriteLine(ex);
// Base exception fields
HttpResponseMessage rawResponse = ex.RawResponse;
HttpResponseHeaders headers = ex.Headers;
int statusCode = ex.StatusCode;
string? contentType = ex.ContentType;
var responseBody = ex.Body;
if (ex is Models.Errors.ErrorMessage) // different exceptions may be thrown depending on the method
{
// Check error data fields
Models.Errors.ErrorMessagePayload payload = ex.Payload;
long StatusCode = payload.StatusCode;
string Service = payload.Service;
// ...
}
// An underlying cause may be provided
if (ex.InnerException != null)
{
Exception cause = ex.InnerException;
}
}
catch (System.Net.Http.HttpRequestException ex)
{
// Check ex.InnerException for Network connectivity errors
}
Error Classes
Primary exceptions:
CodatPlatformException
: The base class for HTTP error responses.ErrorMessage
: Yourquery
parameter was not correctly formed.
<details><summary>Less common exceptions (2)</summary>
System.Net.Http.HttpRequestException
: Network connectivity error. For more details about the underlying cause, inspect theex.InnerException
.Inheriting from
CodatPlatformException
:ResponseValidationError
: Thrown when the response data could not be deserialized into the expected type. </details>
Server Selection
Override Server URL Per-Client
The default server can be overridden globally by passing a URL to the serverUrl: string
optional parameter when initializing the SDK client instance. For example:
using Codat.Platform;
using Codat.Platform.Models.Components;
using Codat.Platform.Models.Requests;
var sdk = new CodatPlatform(
serverUrl: "https://api.codat.io",
authHeader: "Basic BASE_64_ENCODED(API_KEY)"
);
ListCompaniesRequest req = new ListCompaniesRequest() {
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
Tags = "region=uk && team=invoice-finance",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
AuthHeader |
apiKey | API key |
To authenticate with the API the AuthHeader
parameter must be set when initializing the SDK client instance. For example:
using Codat.Platform;
using Codat.Platform.Models.Components;
using Codat.Platform.Models.Requests;
var sdk = new CodatPlatform(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
Tags = "region=uk && team=invoice-finance",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- newtonsoft.json (>= 13.0.3)
- nodatime (>= 3.1.9)
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 |
---|---|---|
6.1.0 | 3 | 10/15/2025 |
6.0.0 | 678 | 11/26/2024 |
5.0.0 | 186 | 10/29/2024 |
4.0.0 | 178 | 9/13/2024 |
3.7.1 | 792 | 9/9/2024 |
3.7.0 | 1,015 | 7/9/2024 |
3.5.0 | 1,083 | 3/6/2024 |
3.4.0 | 185 | 2/14/2024 |
3.3.0 | 2,210 | 12/21/2023 |
3.2.0 | 186 | 12/21/2023 |
3.1.0 | 194 | 12/20/2023 |
3.0.0 | 216 | 12/15/2023 |
2.2.0 | 1,230 | 10/17/2023 |
2.1.0 | 192 | 9/25/2023 |
1.1.0 | 171 | 9/18/2023 |
0.5.0 | 178 | 9/15/2023 |
0.4.0 | 193 | 9/13/2023 |
0.1.0 | 207 | 9/1/2023 |