Skip to content

Latest commit

 

History

History
281 lines (199 loc) · 15.7 KB

File metadata and controls

281 lines (199 loc) · 15.7 KB

Companies

(companies)

Overview

Create and manage your Codat companies.

Available Operations

create

Use the Create company endpoint to create a new company that represents your customer in Codat.

A company represents a business sharing access to their data. Each company can have multiple connections to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.

If forbidden characters (see name pattern) are present in the request, a company will be created with the forbidden characters removed. For example, Company (Codat[1]) with be created as Company Codat1.

Example Usage

import { CodatBankFeeds } from "@codat/bank-feeds";

async function run() {
  const sdk = new CodatBankFeeds({
    security: {
      authHeader: "Basic BASE_64_ENCODED(API_KEY)",
    },
  });

  const res = await sdk.companies.create({
    description: "Requested early access to the new financing scheme.",
    groups: [
      {
        id: "60d2fa12-8a04-11ee-b9d1-0242ac120002",
      },
    ],
    name: "Bank of Dave",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request shared.CompanyRequestBody ✔️ The request object to use for the request.
retries utils.RetryConfig Configuration to override the default retry behavior of the client.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.CreateCompanyResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

delete

The Delete company endpoint permanently deletes a company, its connections and any cached data. This operation is irreversible.

A company represents a business sharing access to their data. Each company can have multiple connections to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.

Example Usage

import { CodatBankFeeds } from "@codat/bank-feeds";

async function run() {
  const sdk = new CodatBankFeeds({
    security: {
      authHeader: "Basic BASE_64_ENCODED(API_KEY)",
    },
  });

  const res = await sdk.companies.delete({
    companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteCompanyRequest ✔️ The request object to use for the request.
retries utils.RetryConfig Configuration to override the default retry behavior of the client.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.DeleteCompanyResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

get

The Get company endpoint returns a single company for a given companyId.

A company represents a business sharing access to their data. Each company can have multiple connections to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.

Example Usage

import { CodatBankFeeds } from "@codat/bank-feeds";

async function run() {
  const sdk = new CodatBankFeeds({
    security: {
      authHeader: "Basic BASE_64_ENCODED(API_KEY)",
    },
  });

  const res = await sdk.companies.get({
    companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetCompanyRequest ✔️ The request object to use for the request.
retries utils.RetryConfig Configuration to override the default retry behavior of the client.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.GetCompanyResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

list

The List companies endpoint returns a list of [companies] associated to your instances.

A company represents a business sharing access to their data. Each company can have multiple connections to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.

Example Usage

import { CodatBankFeeds } from "@codat/bank-feeds";

async function run() {
  const sdk = new CodatBankFeeds({
    security: {
      authHeader: "Basic BASE_64_ENCODED(API_KEY)",
    },
  });

  const res = await sdk.companies.list({
    orderBy: "-modifiedDate",
    page: 1,
    pageSize: 100,
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListCompaniesRequest ✔️ The request object to use for the request.
retries utils.RetryConfig Configuration to override the default retry behavior of the client.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.ListCompaniesResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

update

Use the Update company endpoint to update both the name and description of the company. If you use groups to manage a set of companies, use the Add company or Remove company endpoints to add or remove a company from a group.

A company represents a business sharing access to their data. Each company can have multiple connections to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.

Example Usage

import { CodatBankFeeds } from "@codat/bank-feeds";

async function run() {
  const sdk = new CodatBankFeeds({
    security: {
      authHeader: "Basic BASE_64_ENCODED(API_KEY)",
    },
  });

  const res = await sdk.companies.update({
    companyRequestBody: {
      description: "Requested early access to the new financing scheme.",
      groups: [
        {
          id: "60d2fa12-8a04-11ee-b9d1-0242ac120002",
        },
      ],
      name: "Bank of Dave",
    },
    companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateCompanyRequest ✔️ The request object to use for the request.
retries utils.RetryConfig Configuration to override the default retry behavior of the client.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.UpdateCompanyResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /