Unified.to API: One API to Rule Them All


Keywords
License
MIT
Install
Install-Package UnifiedTo -Version 0.22.13

Documentation

Installation

dotnet add package UnifiedTo

SDK Example Usage

Example

using System.Collections.Generic;
using UnifiedTo;
using UnifiedTo.Models.Components;

var sdk = new UnifiedToSDK(security: new Security() {
    Jwt = "<YOUR_API_KEY_HERE>",
});

var res = await sdk.Accounting.CreateAccountingAccountAsync(
    connectionId: "<id>",
    accountingAccount: new AccountingAccount() {},
    fields: new List<string>() {
        "<value>",
    }
);

// handle response

Available Resources and Operations

Available methods

Ats

Crm

Job

Kms

Lms

Uc

Server Selection

Select Server by Index

You can override the default server globally by passing a server index to the serverIndex: int 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
0 https://api.unified.to
1 https://api-eu.unified.to

Example

using System.Collections.Generic;
using UnifiedTo;
using UnifiedTo.Models.Components;

var sdk = new UnifiedToSDK(
    serverIndex: 1,
    security: new Security() {
        Jwt = "<YOUR_API_KEY_HERE>",
    }
);

var res = await sdk.Accounting.CreateAccountingAccountAsync(
    connectionId: "<id>",
    accountingAccount: new AccountingAccount() {},
    fields: new List<string>() {
        "<value>",
    }
);

// handle response

Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the serverUrl: string optional parameter when initializing the SDK client instance. For example:

using System.Collections.Generic;
using UnifiedTo;
using UnifiedTo.Models.Components;

var sdk = new UnifiedToSDK(
    serverUrl: "https://api.unified.to",
    security: new Security() {
        Jwt = "<YOUR_API_KEY_HERE>",
    }
);

var res = await sdk.Accounting.CreateAccountingAccountAsync(
    connectionId: "<id>",
    accountingAccount: new AccountingAccount() {},
    fields: new List<string>() {
        "<value>",
    }
);

// handle response

Summary

Unified.to API: One API to Rule Them All

Table of Contents

SDK Installation

NuGet

To add the NuGet package to a .NET project:

dotnet add package UnifiedTo

Locally

To add a reference to a local instance of the SDK in a .NET project:

dotnet add reference UnifiedTo/UnifiedTo.csproj

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
Jwt apiKey API key

You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:

using System.Collections.Generic;
using UnifiedTo;
using UnifiedTo.Models.Components;

var sdk = new UnifiedToSDK(security: new Security() {
    Jwt = "<YOUR_API_KEY_HERE>",
});

var res = await sdk.Accounting.CreateAccountingAccountAsync(
    connectionId: "<id>",
    accountingAccount: new AccountingAccount() {},
    fields: new List<string>() {
        "<value>",
    }
);

// handle response

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default, an API error will raise a UnifiedTo.Models.Errors.SDKException exception, which has the following properties:

Property Type Description
Message string The error message
StatusCode int The HTTP status code
RawResponse HttpResponseMessage The raw HTTP response
Body string The response content

When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the CreateAccountingAccountAsync method throws the following exceptions:

Error Type Status Code Content Type
UnifiedTo.Models.Errors.SDKException 4XX, 5XX */*

Example

using System.Collections.Generic;
using UnifiedTo;
using UnifiedTo.Models.Components;
using UnifiedTo.Models.Errors;

var sdk = new UnifiedToSDK(security: new Security() {
    Jwt = "<YOUR_API_KEY_HERE>",
});

try
{
    var res = await sdk.Accounting.CreateAccountingAccountAsync(
        connectionId: "<id>",
        accountingAccount: new AccountingAccount() {},
        fields: new List<string>() {
            "<value>",
        }
    );

    // handle response
}
catch (Exception ex)
{
    if (ex is UnifiedTo.Models.Errors.SDKException)
    {
        // Handle default exception
        throw;
    }
}

Development

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

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!

SDK Created by Speakeasy