Developer-friendly & type-safe Csharp SDK specifically catered to leverage ApideckUnifySdk API.
Apideck: The Apideck OpenAPI Spec: SDK Optimized
For more information about the API: Apideck Developer Docs
To add the NuGet package to a .NET project:
dotnet add package ApideckUnifySdk
To add a reference to a local instance of the SDK in a .NET project:
dotnet add reference src/ApideckUnifySdk/ApideckUnifySdk.csproj
using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
AccountingTaxRatesAllRequest req = new AccountingTaxRatesAllRequest() {
ServiceId = "salesforce",
Filter = new TaxRatesFilter() {
Assets = true,
Equity = true,
Expenses = true,
Liabilities = true,
Revenue = true,
},
PassThrough = new Dictionary<string, object>() {
{ "search", "San Francisco" },
},
Fields = "id,updated_at",
};
AccountingTaxRatesAllResponse? res = await sdk.Accounting.TaxRates.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
ApiKey |
http | HTTP Bearer |
To authenticate with the API the ApiKey
parameter must be set when initializing the SDK client instance. For example:
using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
AccountingTaxRatesAllRequest req = new AccountingTaxRatesAllRequest() {
ServiceId = "salesforce",
Filter = new TaxRatesFilter() {
Assets = true,
Equity = true,
Expenses = true,
Liabilities = true,
Revenue = true,
},
PassThrough = new Dictionary<string, object>() {
{ "search", "San Francisco" },
},
Fields = "id,updated_at",
};
AccountingTaxRatesAllResponse? res = await sdk.Accounting.TaxRates.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
Available methods
- Get - Get Aged Debtors
- List - List Attachments
- Get - Get Attachment
- Delete - Delete Attachment
- Download - Download Attachment
- Get - Get BalanceSheet
- List - List Bill Payments
- Create - Create Bill Payment
- Get - Get Bill Payment
- Update - Update Bill Payment
- Delete - Delete Bill Payment
- Get - Get company info
- List - List Credit Notes
- Create - Create Credit Note
- Get - Get Credit Note
- Update - Update Credit Note
- Delete - Delete Credit Note
- List - List Customers
- Create - Create Customer
- Get - Get Customer
- Update - Update Customer
- Delete - Delete Customer
- List - List Departments
- Create - Create Department
- Get - Get Department
- Update - Update Department
- Delete - Delete Department
- List - List Expenses
- Create - Create Expense
- Get - Get Expense
- Update - Update Expense
- Delete - Delete Expense
- List - List Invoice Items
- Create - Create Invoice Item
- Get - Get Invoice Item
- Update - Update Invoice Item
- Delete - Delete Invoice Item
- List - List Invoices
- Create - Create Invoice
- Get - Get Invoice
- Update - Update Invoice
- Delete - Delete Invoice
- List - List Journal Entries
- Create - Create Journal Entry
- Get - Get Journal Entry
- Update - Update Journal Entry
- Delete - Delete Journal Entry
- List - List Ledger Accounts
- Create - Create Ledger Account
- Get - Get Ledger Account
- Update - Update Ledger Account
- Delete - Delete Ledger Account
- List - List Locations
- Create - Create Location
- Get - Get Location
- Update - Update Location
- Delete - Delete Location
- List - List Payments
- Create - Create Payment
- Get - Get Payment
- Update - Update Payment
- Delete - Delete Payment
- Get - Get Profit and Loss
- List - List Purchase Orders
- Create - Create Purchase Order
- Get - Get Purchase Order
- Update - Update Purchase Order
- Delete - Delete Purchase Order
- List - List Subsidiaries
- Create - Create Subsidiary
- Get - Get Subsidiary
- Update - Update Subsidiary
- Delete - Delete Subsidiary
- List - List Suppliers
- Create - Create Supplier
- Get - Get Supplier
- Update - Update Supplier
- Delete - Delete Supplier
- List - List Tax Rates
- Create - Create Tax Rate
- Get - Get Tax Rate
- Update - Update Tax Rate
- Delete - Delete Tax Rate
- List - List Tracking Categories
- Create - Create Tracking Category
- Get - Get Tracking Category
- Update - Update Tracking Category
- Delete - Delete Tracking Category
- List - List Applicants
- Create - Create Applicant
- Get - Get Applicant
- Update - Update Applicant
- Delete - Delete Applicant
- List - List Applications
- Create - Create Application
- Get - Get Application
- Update - Update Application
- Delete - Delete Application
- Get - Get API Resource Coverage
- Get - Get API Resource
- Get - Get Connector Doc content
- Get - Get Connector Resource
- List - List activities
- Create - Create activity
- Get - Get activity
- Update - Update activity
- Delete - Delete activity
- List - List companies
- Create - Create company
- Get - Get company
- Update - Update company
- Delete - Delete company
- List - List contacts
- Create - Create contact
- Get - Get contact
- Update - Update contact
- Delete - Delete contact
- List - List opportunities
- Create - Create opportunity
- Get - Get opportunity
- Update - Update opportunity
- Delete - Delete opportunity
- List - List pipelines
- Get - Get Store
- List - List DriveGroups
- Create - Create DriveGroup
- Get - Get DriveGroup
- Update - Update DriveGroup
- Delete - Delete DriveGroup
- List - List Drives
- Create - Create Drive
- Get - Get Drive
- Update - Update Drive
- Delete - Delete Drive
- List - List Files
- Search - Search Files
- Get - Get File
- Update - Rename or move File
- Delete - Delete File
- Download - Download File
- Export - Export File
- Create - Create Folder
- Get - Get Folder
- Update - Rename or move Folder
- Delete - Delete Folder
- Copy - Copy Folder
- List - List SharedLinks
- Create - Create Shared Link
- Get - Get Shared Link
- Update - Update Shared Link
- Delete - Delete Shared Link
- Create - Start Upload Session
- Get - Get Upload Session
- Delete - Abort Upload Session
- Finish - Finish Upload Session
- List - List Companies
- Create - Create Company
- Get - Get Company
- Update - Update Company
- Delete - Delete Company
- List - List Departments
- Create - Create Department
- Get - Get Department
- Update - Update Department
- Delete - Delete Department
- List - List Employees
- Create - Create Employee
- Get - Get Employee
- Update - Update Employee
- Delete - Delete Employee
- List - List Employee Schedules
- List - List Time Off Requests
- Create - Create Time Off Request
- Get - Get Time Off Request
- Update - Update Time Off Request
- Delete - Delete Time Off Request
- List - List Tags
- List - List Comments
- Create - Create Comment
- Get - Get Comment
- Update - Update Comment
- Delete - Delete Comment
- List - List Tickets
- Create - Create Ticket
- Get - Get Ticket
- Update - Update Ticket
- Delete - Delete Ticket
- List - List Messages
- Create - Create Message
- Get - Get Message
- Update - Update Message
- Delete - Delete Message
- List - List connection custom mappings
- List - Get all connections
- Get - Get connection
- Update - Update connection
- Delete - Deletes a connection
- Imports - Import connection
- Token - Authorize Access Token
- List - Consumer request counts
- Create - Create consumer
- List - Get all consumers
- Get - Get consumer
- Update - Update consumer
- Delete - Delete consumer
- State - Create Callback State
- List - Get resource custom fields
- List - List custom mappings
- List - Get all consumer request logs
- Create - Create Session
- State - Validate Connection State
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next
method that can be called to pull down the next group of results. If the
return value of Next
is null
, then there are no more pages to be fetched.
Here's an example of one such pagination call:
using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
AccountingTaxRatesAllRequest req = new AccountingTaxRatesAllRequest() {
ServiceId = "salesforce",
Filter = new TaxRatesFilter() {
Assets = true,
Equity = true,
Expenses = true,
Liabilities = true,
Revenue = true,
},
PassThrough = new Dictionary<string, object>() {
{ "search", "San Francisco" },
},
Fields = "id,updated_at",
};
AccountingTaxRatesAllResponse? res = await sdk.Accounting.TaxRates.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
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 ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
AccountingTaxRatesAllRequest req = new AccountingTaxRatesAllRequest() {
ServiceId = "salesforce",
Filter = new TaxRatesFilter() {
Assets = true,
Equity = true,
Expenses = true,
Liabilities = true,
Revenue = true,
},
PassThrough = new Dictionary<string, object>() {
{ "search", "San Francisco" },
},
Fields = "id,updated_at",
};
AccountingTaxRatesAllResponse? res = await sdk.Accounting.TaxRates.ListAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
request: req
);
while(res != null)
{
// handle items
res = await res.Next!();
}
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 ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
AccountingTaxRatesAllRequest req = new AccountingTaxRatesAllRequest() {
ServiceId = "salesforce",
Filter = new TaxRatesFilter() {
Assets = true,
Equity = true,
Expenses = true,
Liabilities = true,
Revenue = true,
},
PassThrough = new Dictionary<string, object>() {
{ "search", "San Francisco" },
},
Fields = "id,updated_at",
};
AccountingTaxRatesAllResponse? res = await sdk.Accounting.TaxRates.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
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 ApideckUnifySdk.Models.Errors.APIException
exception, which has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | The error message |
Request |
HttpRequestMessage | The HTTP request |
Response |
HttpResponseMessage | The HTTP response |
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 ListAsync
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
ApideckUnifySdk.Models.Errors.BadRequestResponse | 400 | application/json |
ApideckUnifySdk.Models.Errors.UnauthorizedResponse | 401 | application/json |
ApideckUnifySdk.Models.Errors.PaymentRequiredResponse | 402 | application/json |
ApideckUnifySdk.Models.Errors.NotFoundResponse | 404 | application/json |
ApideckUnifySdk.Models.Errors.UnprocessableResponse | 422 | application/json |
ApideckUnifySdk.Models.Errors.APIException | 4XX, 5XX | */* |
using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Errors;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
try
{
AccountingTaxRatesAllRequest req = new AccountingTaxRatesAllRequest() {
ServiceId = "salesforce",
Filter = new TaxRatesFilter() {
Assets = true,
Equity = true,
Expenses = true,
Liabilities = true,
Revenue = true,
},
PassThrough = new Dictionary<string, object>() {
{ "search", "San Francisco" },
},
Fields = "id,updated_at",
};
AccountingTaxRatesAllResponse? res = await sdk.Accounting.TaxRates.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
}
catch (Exception ex)
{
if (ex is BadRequestResponse)
{
// Handle exception data
throw;
}
else if (ex is UnauthorizedResponse)
{
// Handle exception data
throw;
}
else if (ex is PaymentRequiredResponse)
{
// Handle exception data
throw;
}
else if (ex is NotFoundResponse)
{
// Handle exception data
throw;
}
else if (ex is UnprocessableResponse)
{
// Handle exception data
throw;
}
else if (ex is ApideckUnifySdk.Models.Errors.APIException)
{
// Handle default exception
throw;
}
}
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 ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
serverUrl: "https://unify.apideck.com",
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
AccountingTaxRatesAllRequest req = new AccountingTaxRatesAllRequest() {
ServiceId = "salesforce",
Filter = new TaxRatesFilter() {
Assets = true,
Equity = true,
Expenses = true,
Liabilities = true,
Revenue = true,
},
PassThrough = new Dictionary<string, object>() {
{ "search", "San Francisco" },
},
Fields = "id,updated_at",
};
AccountingTaxRatesAllResponse? res = await sdk.Accounting.TaxRates.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;
var sdk = new Apideck(
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
consumerId: "test-consumer",
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);
FileStorageUploadSessionsAddRequest req = new FileStorageUploadSessionsAddRequest() {
CreateUploadSessionRequest = new CreateUploadSessionRequest() {
Name = "Documents",
ParentFolderId = "1234",
DriveId = "1234",
Size = 1810673,
PassThrough = new List<PassThroughBody>() {
new PassThroughBody() {
ServiceId = "<id>",
ExtendPaths = new List<ExtendPaths>() {
new ExtendPaths() {
Path = "$.nested.property",
Value = new Dictionary<string, object>() {
{ "TaxClassificationRef", new Dictionary<string, object>() {
{ "value", "EUC-99990201-V1-00020000" },
} },
},
},
},
},
},
},
ServiceId = "salesforce",
};
var res = await sdk.FileStorage.UploadSessions.CreateAsync(
request: req,
serverUrl: "https://upload.apideck.com"
);
// handle response
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.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.