Skip to content

Latest commit

 

History

History
485 lines (411 loc) · 25.6 KB

README.md

File metadata and controls

485 lines (411 loc) · 25.6 KB

JournalEntries

(Accounting.JournalEntries)

Overview

Available Operations

  • List - List Journal Entries
  • Create - Create Journal Entry
  • Get - Get Journal Entry
  • Update - Update Journal Entry
  • Delete - Delete Journal Entry

List

List Journal Entries

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System;
using System.Collections.Generic;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

AccountingJournalEntriesAllRequest req = new AccountingJournalEntriesAllRequest() {
    ServiceId = "salesforce",
    Filter = new JournalEntriesFilter() {
        UpdatedSince = System.DateTime.Parse("2020-09-30T07:43:32.000Z"),
    },
    Sort = new JournalEntriesSort() {
        By = JournalEntriesSortBy.UpdatedAt,
        Direction = SortDirection.Desc,
    },
    PassThrough = new Dictionary<string, object>() {
        { "search", "San Francisco" },
    },
    Fields = "id,updated_at",
};

AccountingJournalEntriesAllResponse? res = await sdk.Accounting.JournalEntries.ListAsync(req);

while(res != null)
{
    // handle items

    res = await res.Next!();
}

Parameters

Parameter Type Required Description
request AccountingJournalEntriesAllRequest ✔️ The request object to use for the request.

Response

AccountingJournalEntriesAllResponse

Errors

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 */*

Create

Create Journal Entry

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System;
using System.Collections.Generic;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

AccountingJournalEntriesAddRequest req = new AccountingJournalEntriesAddRequest() {
    JournalEntry = new JournalEntryInput() {
        Title = "Purchase Invoice-Inventory (USD): 2019/02/01 Batch Summary Entry",
        CurrencyRate = 0.69D,
        Currency = Currency.Usd,
        CompanyId = "12345",
        LineItems = new List<JournalEntryLineItemInput>() {
            new JournalEntryLineItemInput() {
                Description = "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
                TaxAmount = 27500D,
                SubTotal = 27500D,
                TotalAmount = 27500D,
                Type = JournalEntryLineItemType.Debit,
                TaxRate = new LinkedTaxRateInput() {
                    Id = "123456",
                    Rate = 10D,
                },
                TrackingCategories = new List<LinkedTrackingCategory>() {
                    new LinkedTrackingCategory() {
                        Id = "123456",
                        Name = "New York",
                    },
                },
                LedgerAccount = new LinkedLedgerAccountInput() {
                    Id = "123456",
                    NominalCode = "N091",
                    Code = "453",
                },
                Customer = new LinkedCustomerInput() {
                    Id = "12345",
                    DisplayName = "Windsurf Shop",
                    Email = "boring@boring.com",
                },
                Supplier = new LinkedSupplierInput() {
                    Id = "12345",
                    DisplayName = "Windsurf Shop",
                    Address = new Address() {
                        Id = "123",
                        Type = ApideckUnifySdk.Models.Components.Type.Primary,
                        String = "25 Spring Street, Blackburn, VIC 3130",
                        Name = "HQ US",
                        Line1 = "Main street",
                        Line2 = "apt #",
                        Line3 = "Suite #",
                        Line4 = "delivery instructions",
                        StreetNumber = "25",
                        City = "San Francisco",
                        State = "CA",
                        PostalCode = "94104",
                        Country = "US",
                        Latitude = "40.759211",
                        Longitude = "-73.984638",
                        County = "Santa Clara",
                        ContactName = "Elon Musk",
                        Salutation = "Mr",
                        PhoneNumber = "111-111-1111",
                        Fax = "122-111-1111",
                        Email = "elon@musk.com",
                        Website = "https://elonmusk.com",
                        Notes = "Address notes or delivery instructions.",
                        RowVersion = "1-12345",
                    },
                },
                LineNumber = 1,
            },
        },
        Memo = "Thank you for your business and have a great day!",
        PostedAt = System.DateTime.Parse("2020-09-30T07:43:32.000Z"),
        JournalSymbol = "IND",
        TaxType = "sales",
        TaxCode = "1234",
        Number = "OIT00546",
        TrackingCategories = new List<LinkedTrackingCategory>() {
            new LinkedTrackingCategory() {
                Id = "123456",
                Name = "New York",
            },
        },
        AccountingPeriod = "01-24",
        RowVersion = "1-12345",
        CustomFields = new List<CustomField>() {
            new CustomField() {
                Id = "2389328923893298",
                Name = "employee_level",
                Description = "Employee Level",
                Value = Value.CreateBoolean(
                    true
                ),
            },
        },
        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.Accounting.JournalEntries.CreateAsync(req);

// handle response

Parameters

Parameter Type Required Description
request AccountingJournalEntriesAddRequest ✔️ The request object to use for the request.

Response

AccountingJournalEntriesAddResponse

Errors

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 */*

Get

Get Journal Entry

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

AccountingJournalEntriesOneRequest req = new AccountingJournalEntriesOneRequest() {
    Id = "<id>",
    ServiceId = "salesforce",
    Fields = "id,updated_at",
};

var res = await sdk.Accounting.JournalEntries.GetAsync(req);

// handle response

Parameters

Parameter Type Required Description
request AccountingJournalEntriesOneRequest ✔️ The request object to use for the request.

Response

AccountingJournalEntriesOneResponse

Errors

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 */*

Update

Update Journal Entry

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System;
using System.Collections.Generic;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

AccountingJournalEntriesUpdateRequest req = new AccountingJournalEntriesUpdateRequest() {
    Id = "<id>",
    JournalEntry = new JournalEntryInput() {
        Title = "Purchase Invoice-Inventory (USD): 2019/02/01 Batch Summary Entry",
        CurrencyRate = 0.69D,
        Currency = Currency.Usd,
        CompanyId = "12345",
        LineItems = new List<JournalEntryLineItemInput>() {
            new JournalEntryLineItemInput() {
                Description = "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
                TaxAmount = 27500D,
                SubTotal = 27500D,
                TotalAmount = 27500D,
                Type = JournalEntryLineItemType.Debit,
                TaxRate = new LinkedTaxRateInput() {
                    Id = "123456",
                    Rate = 10D,
                },
                TrackingCategories = new List<LinkedTrackingCategory>() {
                    new LinkedTrackingCategory() {
                        Id = "123456",
                        Name = "New York",
                    },
                },
                LedgerAccount = new LinkedLedgerAccountInput() {
                    Id = "123456",
                    NominalCode = "N091",
                    Code = "453",
                },
                Customer = new LinkedCustomerInput() {
                    Id = "12345",
                    DisplayName = "Windsurf Shop",
                    Email = "boring@boring.com",
                },
                Supplier = new LinkedSupplierInput() {
                    Id = "12345",
                    DisplayName = "Windsurf Shop",
                    Address = new Address() {
                        Id = "123",
                        Type = ApideckUnifySdk.Models.Components.Type.Primary,
                        String = "25 Spring Street, Blackburn, VIC 3130",
                        Name = "HQ US",
                        Line1 = "Main street",
                        Line2 = "apt #",
                        Line3 = "Suite #",
                        Line4 = "delivery instructions",
                        StreetNumber = "25",
                        City = "San Francisco",
                        State = "CA",
                        PostalCode = "94104",
                        Country = "US",
                        Latitude = "40.759211",
                        Longitude = "-73.984638",
                        County = "Santa Clara",
                        ContactName = "Elon Musk",
                        Salutation = "Mr",
                        PhoneNumber = "111-111-1111",
                        Fax = "122-111-1111",
                        Email = "elon@musk.com",
                        Website = "https://elonmusk.com",
                        Notes = "Address notes or delivery instructions.",
                        RowVersion = "1-12345",
                    },
                },
                LineNumber = 1,
            },
        },
        Memo = "Thank you for your business and have a great day!",
        PostedAt = System.DateTime.Parse("2020-09-30T07:43:32.000Z"),
        JournalSymbol = "IND",
        TaxType = "sales",
        TaxCode = "1234",
        Number = "OIT00546",
        TrackingCategories = new List<LinkedTrackingCategory>() {
            new LinkedTrackingCategory() {
                Id = "123456",
                Name = "New York",
            },
        },
        AccountingPeriod = "01-24",
        RowVersion = "1-12345",
        CustomFields = new List<CustomField>() {
            new CustomField() {
                Id = "2389328923893298",
                Name = "employee_level",
                Description = "Employee Level",
                Value = Value.CreateArrayOf6(
                    new List<Six>() {
                        new Six() {},
                    }
                ),
            },
        },
        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.Accounting.JournalEntries.UpdateAsync(req);

// handle response

Parameters

Parameter Type Required Description
request AccountingJournalEntriesUpdateRequest ✔️ The request object to use for the request.

Response

AccountingJournalEntriesUpdateResponse

Errors

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 */*

Delete

Delete Journal Entry

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

AccountingJournalEntriesDeleteRequest req = new AccountingJournalEntriesDeleteRequest() {
    Id = "<id>",
    ServiceId = "salesforce",
};

var res = await sdk.Accounting.JournalEntries.DeleteAsync(req);

// handle response

Parameters

Parameter Type Required Description
request AccountingJournalEntriesDeleteRequest ✔️ The request object to use for the request.

Response

AccountingJournalEntriesDeleteResponse

Errors

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 */*