Codat.Sync.Payroll
4.0.0
dotnet add package Codat.Sync.Payroll --version 4.0.0
NuGet\Install-Package Codat.Sync.Payroll -Version 4.0.0
<PackageReference Include="Codat.Sync.Payroll" Version="4.0.0" />
<PackageVersion Include="Codat.Sync.Payroll" Version="4.0.0" />
<PackageReference Include="Codat.Sync.Payroll" />
paket add Codat.Sync.Payroll --version 4.0.0
#r "nuget: Codat.Sync.Payroll, 4.0.0"
#:package Codat.Sync.Payroll@4.0.0
#addin nuget:?package=Codat.Sync.Payroll&version=4.0.0
#tool nuget:?package=Codat.Sync.Payroll&version=4.0.0
Codat.Sync.Payroll
SDK Example Usage
Example
using Codat.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
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.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
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
),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.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(
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() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
Error Handling
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 |
---|---|---|
Codat.Sync.Payroll.Models.Errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json |
Codat.Sync.Payroll.Models.Errors.SDKException | 4xx-5xx | / |
Example
using Codat.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
using System;
using Codat.Sync.Payroll.Models.Errors;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
try
{
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
}
catch (Exception ex)
{
if (ex is ErrorMessage)
{
// handle exception
}
else if (ex is Codat.Sync.Payroll.Models.Errors.SDKException)
{
// handle exception
}
}
Server Selection
Select Server by Index
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.codat.io |
None |
Override Server URL Per-Client
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:
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.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
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.