### Get Profit and Loss Data (Xero Example) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/profitandloss/README.md This snippet demonstrates how to retrieve Profit and Loss data for a company using the Codat Lending SDK, with an example tailored for Xero integration. It shows the initialization of the SDK and a call to the `profitAndLoss.get` method with necessary parameters. ```APIDOC ## GET /companies/{companyId}/data/financials/profitAndLoss ### Description Retrieves the Profit and Loss financial statement for a given company. ### Method GET ### Endpoint /companies/{companyId}/data/financials/profitAndLoss ### Parameters #### Query Parameters - **periodLength** (integer) - Required - The length of the period to retrieve data for (e.g., 4 for quarterly). - **periodsToCompare** (integer) - Required - The number of previous periods to compare against. - **startMonth** (string) - Required - The start date for the data retrieval, in ISO 8601 format. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.financialStatements.profitAndLoss.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", periodLength: 4, periodsToCompare: 20, startMonth: "2022-10-23T00:00:00Z", }); console.log(result); } run(); ``` ### Standalone Function This shows how to use the standalone function for fetching Profit and Loss data, which can be beneficial for tree-shaking. ```typescript import { CodatLendingCore } from "@codat/lending/core.js"; import { financialStatementsProfitAndLossGet } from "@codat/lending/funcs/financialStatementsProfitAndLossGet.js"; const codatLending = new CodatLendingCore({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const res = await financialStatementsProfitAndLossGet(codatLending, { companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", periodLength: 4, periodsToCompare: 20, startMonth: "2022-10-23T00:00:00Z", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("financialStatementsProfitAndLossGet failed:", res.error); } } run(); ``` ``` -------------------------------- ### Example Usage Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-payroll/README.md An example demonstrating how to initialize the SDK and list companies. ```APIDOC ## SDK Example Usage ### Example ```typescript import { CodatSyncPayroll } from "@codat/sync-for-payroll"; const codatSyncPayroll = new CodatSyncPayroll({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatSyncPayroll.companies.list({ page: 1, pageSize: 100, query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee", orderBy: "-modifiedDate", }); // Handle the result console.log(result); } run(); ``` ``` -------------------------------- ### Get Integration Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/platform/docs/sdks/integrations/README.md Example usage of the `get` method from the Integrations SDK to retrieve integration details. ```APIDOC ## GET /integrations/{platformKey} ### Description Retrieves details for a specific integration using its platform key. ### Method GET ### Endpoint /integrations/{platformKey} ### Parameters #### Path Parameters - **platformKey** (string) - Required - The unique key of the platform integration. ### Request Example ```typescript import { CodatPlatform } from "@codat/platform"; const codatPlatform = new CodatPlatform({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatPlatform.integrations.get({ platformKey: "gbol", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The integration details. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Install Lending SDK Source: https://context7.com/codatio/client-sdk-typescript/llms.txt Install the Codat Lending SDK using npm. ```bash npm add @codat/lending ``` -------------------------------- ### Get Invoice - Oracle NetSuite Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/invoices/README.md Example usage of the `get` method for retrieving an invoice from Oracle NetSuite using the Codat Lending SDK. ```APIDOC ## GET /companies/{companyId}/data/invoices/{invoiceId} ### Description Retrieves a specific invoice for a given company. ### Method GET ### Endpoint /companies/{companyId}/data/invoices/{invoiceId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **invoiceId** (string) - Required - The unique identifier for the invoice. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.accountsReceivable.invoices.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", invoiceId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The invoice data. #### Response Example ```json { "value": { ... } } ``` ``` -------------------------------- ### Get Commerce Customer - Square Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/codatlendingcustomers/README.md Example usage of the `sales.customers.get` method for Square integration. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/commerce-customers/{customerId} ### Description Retrieves a specific commerce customer from a company's connection. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/commerce-customers/{customerId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for a company. - **connectionId** (string) - Required - The unique identifier for a specific connection. - **customerId** (string) - Required - The unique identifier for the customer. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.sales.customers.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", customerId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The customer data. #### Response Example ```json { "value": { "id": "13d946f0-c5d5-42bc-b092-97ece17923ab", "companyId": "8a210b68-6988-11ed-a1eb-0242ac120002", "connectionId": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "sourceModifiedDate": "2023-01-01T10:00:00Z", "customerName": "Acme Corp", "emailAddress": "contact@acmecorp.com", "phone1": "123-456-7890", "addresses": [ { "type": "Billing", "line1": "123 Main St", "city": "Anytown", "state": "CA", "postalCode": "90210", "country": "USA" } ], "currency": "USD", "createdOn": "2023-01-01T09:00:00Z" } } ``` ``` -------------------------------- ### Install Codat Lending SDK with Bun Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/README.md Install the Codat Lending SDK using the Bun package manager. Ensure you have Bun installed. ```bash bun add @codat/lending ``` -------------------------------- ### SDK Initialization with Custom Server URL Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/README.md This example shows how to initialize the Codat Lending SDK and override the default server URL with a custom one. ```APIDOC ## Initialize SDK with Custom Server URL ### Description Initializes the Codat Lending SDK, allowing for a custom server URL to be specified. ### Method `new CodatLending({ serverURL: string, authHeader: string })` ### Parameters #### Initialization Options - **serverURL** (string) - Required - The custom URL for the Codat API server. - **authHeader** (string) - Required - The authentication header, typically a base64 encoded API key. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ serverURL: "https://api.codat.io", authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); ``` ``` -------------------------------- ### Get Supplier - QuickBooks Online Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-expenses/docs/sdks/suppliers/README.md Example of how to get a supplier using the CodatSyncExpenses SDK for QuickBooks Online. ```APIDOC ## Get Supplier ### Description Retrieves a specific supplier's details for a given company. ### Method GET ### Endpoint /companies/{companyId}/data/suppliers/{supplierId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **supplierId** (string) - Required - The unique identifier for the supplier. ### Request Example ```typescript import { CodatSyncExpenses } from "@codat/sync-for-expenses"; const codatSyncExpenses = new CodatSyncExpenses({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatSyncExpenses.suppliers.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", supplierId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - Contains the supplier details. #### Response Example ```json { "value": { "id": "13d946f0-c5d5-42bc-b092-97ece17923ab", "supplierName": "Example Supplier", "addresses": [], "contactPeople": [], "email": "contact@example.com", "phone": "123-456-7890", "metadata": {}, "status": "Active", "modifiedDate": "2023-01-01T10:00:00Z", "createdDate": "2023-01-01T09:00:00Z" } } ``` ``` -------------------------------- ### Get Supplier (Exact UK Example) Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-expenses/docs/sdks/suppliers/README.md Example usage of the `suppliers.get` method for Exact (UK) integration. ```APIDOC ## GET /companies/{companyId}/data/suppliers/{supplierId} ### Description Retrieves a specific supplier's details for a given company. ### Method GET ### Endpoint /companies/{companyId}/data/suppliers/{supplierId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **supplierId** (string) - Required - The unique identifier for the supplier. ### Request Example ```typescript import { CodatSyncExpenses } from "@codat/sync-for-expenses"; const codatSyncExpenses = new CodatSyncExpenses({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatSyncExpenses.suppliers.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", supplierId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - Contains the supplier data. #### Response Example ```json { "value": { ... supplier details ... } } ``` ``` -------------------------------- ### Install Sync for Expenses SDK with Bun Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-expenses/README.md Install the SDK using Bun. This command is used to add the @codat/sync-for-expenses package to your project. ```bash bun add @codat/sync-for-expenses ``` -------------------------------- ### CommerceCompanyInfo Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdk/models/shared/commercecompanyinfo.md Demonstrates how to create an instance of CommerceCompanyInfo with various commercial details. ```typescript import { CommerceCompanyInfo, } from "@codat/lending/sdk/models/shared"; let value: CommerceCompanyInfo = { modifiedDate: "2022-10-23T00:00:00Z", sourceModifiedDate: "2022-10-23T00:00:00Z", companyName: "Codat", companyLegalName: "Codat Limited", phoneNumbers: [ { number: "+44 25691 154789", type: "Primary", }, ], webLinks: [ { type: "Website", url: "https://codat.io", }, ], registrationNumber: "10480375", baseCurrency: "GBP", accountBalances: [ { currency: "GBP", }, ], sourceUrls: { "url1": "https://connect.sandbox.com/v2/customers", "url2": "https://connect.sandbox.com/v2/disputes", }, createdDate: "2022-10-23T00:00:00Z", }; ``` -------------------------------- ### Get Profit and Loss Data Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/profitandloss/README.md This method retrieves the Profit and Loss statement for a given company. It allows specifying the period length and the number of periods to compare, along with a start month for the analysis. The examples demonstrate usage with different accounting platforms like Exact (UK), FreshBooks, and KashFlow. ```APIDOC ## GET /companies/{companyId}/data/financials/profitAndLoss ### Description Retrieves the Profit and Loss statement for a specified company, allowing for historical comparisons. ### Method GET ### Endpoint /companies/{companyId}/data/financials/profitAndLoss ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. #### Query Parameters - **periodLength** (integer) - Required - The length of each accounting period in months. - **periodsToCompare** (integer) - Required - The number of previous periods to compare against. - **startMonth** (string) - Required - The start date for the profit and loss analysis, in ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ). ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.financialStatements.profitAndLoss.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", periodLength: 4, periodsToCompare: 20, startMonth: "2022-10-23T00:00:00Z", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The Profit and Loss data. - **error** (object) - An error object if the request failed. #### Response Example ```json { "value": { ... }, "error": null } ``` ``` -------------------------------- ### Install Platform SDK with Bun Source: https://github.com/codatio/client-sdk-typescript/blob/main/platform/README.md Install the Codat Platform SDK using the Bun package manager. ```bash bun add @codat/platform ``` -------------------------------- ### Get Bank Accounts Create Model - FreeAgent Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/bank-feeds/docs/sdks/bankaccounts/README.md Example usage of `codatBankFeeds.bankAccounts.getCreateModel` for FreeAgent. Requires instantiation of `CodatBankFeeds` with authentication. ```typescript import { CodatBankFeeds } from "@codat/bank-feeds"; const codatBankFeeds = new CodatBankFeeds({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatBankFeeds.bankAccounts.getCreateModel({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }); console.log(result); } run(); ``` -------------------------------- ### Get Sales Product (Square Example) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/products/README.md Example of how to retrieve a specific sales product using the Codat Lending SDK with a Square integration. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/commerce-products/{productId} ### Description Retrieves a specific sales product from a connected commerce platform. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/commerce-products/{productId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **connectionId** (string) - Required - The unique identifier for the connection. - **productId** (string) - Required - The unique identifier for the product. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.sales.products.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", productId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The sales product data. #### Response Example ```json { "value": { "id": "13d946f0-c5d5-42bc-b092-97ece17923ab", "name": "Example Product", "description": "This is an example product.", "price": 19.99, "currency": "USD", "sku": "EX-PROD-001", "categories": ["Electronics", "Gadgets"], "lastUpdated": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Install Platform SDK Source: https://context7.com/codatio/client-sdk-typescript/llms.txt Install the Codat Platform SDK using npm. ```bash npm add @codat/platform ``` -------------------------------- ### Install Sync for Expenses SDK Source: https://context7.com/codatio/client-sdk-typescript/llms.txt Install the Codat Sync for Expenses SDK using npm. ```bash npm add @codat/sync-for-expenses ``` -------------------------------- ### Run an example script Source: https://github.com/codatio/client-sdk-typescript/blob/main/bank-feeds/examples/README.md Build the project and then execute an example TypeScript file using tsx. Ensure you have Node.js (v18 or higher) and npm installed. ```bash npm run build && npx tsx example.ts ``` -------------------------------- ### Get Accounting Payment (Exact UK) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/payments/README.md Example usage of the get method for retrieving a payment from Exact (UK) using the Codat Lending SDK. ```APIDOC ## GET /companies/{companyId}/data/payments/{paymentId} ### Description Retrieves a specific payment for a given company. ### Method GET ### Endpoint /companies/{companyId}/data/payments/{paymentId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **paymentId** (string) - Required - The unique identifier for the payment. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.accountsReceivable.payments.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", paymentId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Standalone Function ```typescript import { CodatLendingCore } from "@codat/lending/core.js"; import { accountsReceivablePaymentsGet } from "@codat/lending/funcs/accountsReceivablePaymentsGet.js"; const codatLending = new CodatLendingCore({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const res = await accountsReceivablePaymentsGet(codatLending, { companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", paymentId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("accountsReceivablePaymentsGet failed:", res.error); } } run(); ``` ``` -------------------------------- ### List Direct Costs (SDK Example) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/directcosts/README.md This snippet demonstrates how to list direct costs using the Codat Lending SDK. It shows initialization of the SDK client and calling the `list` method for direct costs. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/directCosts ### Description Retrieves a list of direct costs for a given company and connection. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/directCosts ### Parameters #### Path Parameters - **companyId** (string) - Required - The ID of the company. - **connectionId** (string) - Required - The ID of the connection. #### Query Parameters - **query** (string) - Optional - Query parameters for filtering results. - **orderBy** (string) - Optional - Field to order the results by. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.transactions.directCosts.list({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee", orderBy: "-modifiedDate", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (array) - An array of direct cost objects. ``` -------------------------------- ### Install Sync for Expenses SDK with PNPM Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-expenses/README.md Install the SDK using pnpm. This command adds the necessary package for integrating Codat's Expenses solution. ```bash pnpm add @codat/sync-for-expenses ``` -------------------------------- ### Get Sales Location (SDK) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/locations/README.md Example usage of the `get` method from the `sales.locations` module in the Codat Lending SDK to retrieve a specific sales location. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/commerce-locations/{locationId} ### Description Retrieves a specific sales location for a given company and connection. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/commerce-locations/{locationId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **connectionId** (string) - Required - The unique identifier for the connection. - **locationId** (string) - Required - The unique identifier for the location. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.sales.locations.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", locationId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The sales location data. ``` -------------------------------- ### Install Sync for Payables SDK with Bun Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-payables/README.md Install the SDK using the bun package manager. ```bash bun add @codat/sync-for-payables ``` -------------------------------- ### Get Create Payment Model - FreeAgent Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/codatlendingloanwritebackpayments/README.md Use this to get the expected data for creating a payment for a given company and connection. This example is specific to the FreeAgent integration. ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.loanWriteback.payments.getCreateModel({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }); console.log(result); } run(); ``` -------------------------------- ### Get Create Payment Model - Sage Intacct Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/codatlendingloanwritebackpayments/README.md Example usage of the `getCreateModel` method for loan writeback payments, specifically for Sage Intacct integration. ```APIDOC ## getCreateModel loanWriteback.payments ### Description Retrieves the model for creating a loan writeback payment. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/options/payments ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique ID of the company. - **connectionId** (string) - Required - The unique ID of the connection. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.loanWriteback.payments.getCreateModel({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The model for creating a loan writeback payment. ``` -------------------------------- ### Install Sync for Commerce SDK with Bun Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-commerce/README.md Install the Sync for Commerce SDK using the bun package manager. ```bash bun add @codat/sync-for-commerce ``` -------------------------------- ### Get Bill Credit Note (FreeAgent Example) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/billcreditnotes/README.md Example of how to retrieve a bill credit note for FreeAgent using the SDK. Instantiate `CodatLending` with your API key. ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.accountsPayable.billCreditNotes.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", billCreditNoteId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` -------------------------------- ### Install Codat Lending SDK with Yarn Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/README.md Install the Codat Lending SDK using the Yarn package manager. Ensure you have Node.js and Yarn installed. ```bash yarn add @codat/lending ``` -------------------------------- ### Install Bank Feeds SDK with Bun Source: https://github.com/codatio/client-sdk-typescript/blob/main/bank-feeds/README.md Install the Codat Bank Feeds SDK using the Bun package manager. ```bash bun add @codat/bank-feeds ``` -------------------------------- ### Get Accounting Transfer - QuickBooks Online Sandbox Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/transfers/README.md Example usage of the `get` method from the `transactions.transfers` module to retrieve accounting transfer data for QuickBooks Online Sandbox. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/transfers/{transferId} ### Description Retrieves a specific transfer for a given company and connection. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/transfers/{transferId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique ID of the company. - **connectionId** (string) - Required - The unique ID of the connection. - **transferId** (string) - Required - The unique ID of the transfer. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.transactions.transfers.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", transferId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The transfer data. #### Response Example ```json { "value": { "id": "13d946f0-c5d5-42bc-b092-97ece17923ab", "companyId": "8a210b68-6988-11ed-a1eb-0242ac120002", "connectionId": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "transferDate": "2023-01-01T00:00:00Z", "amount": 100.50, "currency": "USD", "fromAccount": { "id": "acc-123", "name": "Checking Account" }, "toAccount": { "id": "acc-456", "name": "Savings Account" }, "description": "Monthly transfer", "sourceModifiedDate": "2023-01-01T10:00:00Z", "codatModifiedDate": "2023-01-01T10:05:00Z" } } ``` ``` -------------------------------- ### Get Customer (KashFlow Example) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/customers/README.md This snippet demonstrates how to retrieve a specific customer's details using the Codat Lending SDK, with an example tailored for KashFlow integration. ```APIDOC ## GET /companies/{companyId}/data/customers/{customerId} ### Description Retrieves a specific customer's details from a company's accounting data. ### Method GET ### Endpoint /companies/{companyId}/data/customers/{customerId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **customerId** (string) - Required - The unique identifier for the customer. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.accountsReceivable.customers.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", customerId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Standalone Function Usage ```typescript import { CodatLendingCore } from "@codat/lending/core.js"; import { accountsReceivableCustomersGet } from "@codat/lending/funcs/accountsReceivableCustomersGet.js"; const codatLending = new CodatLendingCore({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const res = await accountsReceivableCustomersGet(codatLending, { companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", customerId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("accountsReceivableCustomersGet failed:", res.error); } } run(); ``` ``` -------------------------------- ### List Syncs using CodatSyncCommerce Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-commerce/docs/sdks/sync/README.md This example shows how to initialize the CodatSyncCommerce client and use the `sync.list` method to retrieve a list of syncs for a given company. ```APIDOC ## List Syncs ### Description Retrieves a list of syncs for a specified company. ### Method `sync.list(params: { companyId: string }): Promise>` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript import { CodatSyncCommerce } from "@codat/sync-for-commerce"; const codatSyncCommerce = new CodatSyncCommerce({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatSyncCommerce.sync.list({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", }); // Handle the result console.log(result); } run(); ``` ### Response #### Success Response (200) An array of sync objects. #### Response Example ```json [ { "id": "sync-id-1", "companyId": "8a210b68-6988-11ed-a1eb-0242ac120002", "createdDate": "2023-01-01T10:00:00Z", "syncStatus": "Completed" } ] ``` ``` -------------------------------- ### Get Accounting Bank Account - QuickBooks Online Sandbox Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/codatlendingaccounts/README.md Example usage of the `get` method from `codatLending.accountingBankData.accounts` to retrieve bank account data for a QuickBooks Online Sandbox connection. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/bankAccounts/{accountId} ### Description Retrieves a list of bank accounts for a given company and connection. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/bankAccounts/{accountId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique ID of the company. - **connectionId** (string) - Required - The unique ID of the connection. - **accountId** (string) - Required - The unique ID of the bank account. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.accountingBankData.accounts.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", accountId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The bank account data. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### ConnectionWebhookPayload Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/platform/docs/sdk/models/shared/connectionwebhookpayload.md Demonstrates how to instantiate and populate a ConnectionWebhookPayload object with sample data for company and connection details. ```typescript import { ConnectionWebhookPayload } from "@codat/platform/sdk/models/shared"; let value: ConnectionWebhookPayload = { referenceCompany: { id: "8a210b68-6988-11ed-a1eb-0242ac120002", name: "Codat Ltd.", description: "Requested early access to the new financing scheme.", }, connection: { id: "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", integrationId: "bf083d72-62c7-493e-aec9-81b4dbba7e2c", integrationKey: "dfxm", sourceId: "bdd831ce-eebd-4896-89a7-20e5ee8989ee", sourceType: "Banking", platformName: "Basiq", linkUrl: "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", status: "Linked", lastSync: "2022-10-27T10:22:43.6464237Z", created: "2022-10-27T09:53:29Z", }, }; ``` -------------------------------- ### Get Payment Method (Square) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/paymentmethods/README.md Example usage of the `codatLending.sales.paymentMethods.get` method for Square integration. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods/{paymentMethodId} ### Description Retrieves a specific payment method for a given company and connection. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods/{paymentMethodId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique identifier for the company. - **connectionId** (string) - Required - The unique identifier for the connection. - **paymentMethodId** (string) - Required - The unique identifier for the payment method. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.sales.paymentMethods.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", paymentMethodId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The payment method data. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Create Company - With Description Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/platform/docs/sdks/companies/README.md This example demonstrates creating a company with a specific description, useful for categorizing or providing context about the customer. ```typescript import { CodatPlatform } from "@codat/platform"; const codatPlatform = new CodatPlatform({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatPlatform.companies.create({ name: "Technicalium", description: "Technology services, including web and app design and development", }); console.log(result); } run(); ``` -------------------------------- ### Get Commerce Payment (Mollie) Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/docs/sdks/codatlendingpayments/README.md Example usage of the `sales.payments.get` method for Mollie integration. ```APIDOC ## GET /companies/{companyId}/connections/{connectionId}/data/commerce-payments/{paymentId} ### Description Retrieves a specific commerce payment. ### Method GET ### Endpoint /companies/{companyId}/connections/{connectionId}/data/commerce-payments/{paymentId} ### Parameters #### Path Parameters - **companyId** (string) - Required - The unique ID of the company. - **connectionId** (string) - Required - The unique ID of the connection. - **paymentId** (string) - Required - The unique ID of the payment. ### Request Example ```typescript import { CodatLending } from "@codat/lending"; const codatLending = new CodatLending({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatLending.sales.payments.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171", paymentId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` ### Response #### Success Response (200) - **value** (object) - The commerce payment data. #### Response Example ```json { "value": { // ... commerce payment details } } ``` ``` -------------------------------- ### ListCompaniesRequest Example Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-commerce/docs/sdk/models/operations/listcompaniesrequest.md Demonstrates how to instantiate a ListCompaniesRequest object with pagination, query, and ordering parameters. ```typescript import { ListCompaniesRequest } from "@codat/sync-for-commerce/sdk/models/operations"; let value: ListCompaniesRequest = { page: 1, pageSize: 100, query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee", orderBy: "-modifiedDate", }; ``` -------------------------------- ### Get Customer Data (Oracle NetSuite Example) Source: https://github.com/codatio/client-sdk-typescript/blob/main/sync-for-expenses/docs/sdks/customers/README.md Example of retrieving customer data for Oracle NetSuite using the SDK's object-oriented interface. Requires an authenticated `CodatSyncExpenses` instance. ```typescript import { CodatSyncExpenses } from "@codat/sync-for-expenses"; const codatSyncExpenses = new CodatSyncExpenses({ authHeader: "Basic BASE_64_ENCODED(API_KEY)", }); async function run() { const result = await codatSyncExpenses.customers.get({ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002", customerId: "13d946f0-c5d5-42bc-b092-97ece17923ab", }); console.log(result); } run(); ``` -------------------------------- ### Install Codat Lending SDK with PNPM Source: https://github.com/codatio/client-sdk-typescript/blob/main/lending/README.md Install the Codat Lending SDK using the pnpm package manager. Ensure you have Node.js and pnpm installed. ```bash pnpm add @codat/lending ```