Skip to content

Latest commit

 

History

History
893 lines (775 loc) · 42.7 KB

README.md

File metadata and controls

893 lines (775 loc) · 42.7 KB

InvoiceItems

(accounting.invoiceItems)

Overview

Available Operations

  • list - List Invoice Items
  • create - Create Invoice Item
  • get - Get Invoice Item
  • update - Update Invoice Item
  • delete - Delete Invoice Item

list

List Invoice Items

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.invoiceItems.list({
    serviceId: "salesforce",
    filter: {
      name: "Widgets Large",
      type: "service",
    },
    passThrough: {
      "search": "San Francisco",
    },
    fields: "id,updated_at",
  });

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingInvoiceItemsList } from "@apideck/unify/funcs/accountingInvoiceItemsList.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingInvoiceItemsList(apideck, {
    serviceId: "salesforce",
    filter: {
      name: "Widgets Large",
      type: "service",
    },
    passThrough: {
      "search": "San Francisco",
    },
    fields: "id,updated_at",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingInvoiceItemsAllRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.AccountingInvoiceItemsAllResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

create

Create Invoice Item

Example Usage

import { Apideck } from "@apideck/unify";
import { RFCDate } from "@apideck/unify/types";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.invoiceItems.create({
    serviceId: "salesforce",
    invoiceItem: {
      name: "Model Y",
      description: "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
      code: "120-C",
      sold: true,
      purchased: true,
      tracked: true,
      taxable: true,
      inventoryDate: new RFCDate("2020-10-30"),
      type: "inventory",
      salesDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      purchaseDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      quantity: 1,
      unitPrice: 27500.5,
      assetAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      incomeAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      expenseAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
      ],
      active: true,
      rowVersion: "1-12345",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingInvoiceItemsCreate } from "@apideck/unify/funcs/accountingInvoiceItemsCreate.js";
import { RFCDate } from "@apideck/unify/types";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingInvoiceItemsCreate(apideck, {
    serviceId: "salesforce",
    invoiceItem: {
      name: "Model Y",
      description: "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
      code: "120-C",
      sold: true,
      purchased: true,
      tracked: true,
      taxable: true,
      inventoryDate: new RFCDate("2020-10-30"),
      type: "inventory",
      salesDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      purchaseDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      quantity: 1,
      unitPrice: 27500.5,
      assetAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      incomeAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      expenseAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
      ],
      active: true,
      rowVersion: "1-12345",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingInvoiceItemsAddRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.AccountingInvoiceItemsAddResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

get

Get Invoice Item

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.invoiceItems.get({
    id: "<id>",
    serviceId: "salesforce",
    fields: "id,updated_at",
    filter: {
      type: "service",
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingInvoiceItemsGet } from "@apideck/unify/funcs/accountingInvoiceItemsGet.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingInvoiceItemsGet(apideck, {
    id: "<id>",
    serviceId: "salesforce",
    fields: "id,updated_at",
    filter: {
      type: "service",
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingInvoiceItemsOneRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.AccountingInvoiceItemsOneResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

update

Update Invoice Item

Example Usage

import { Apideck } from "@apideck/unify";
import { RFCDate } from "@apideck/unify/types";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.invoiceItems.update({
    id: "<id>",
    serviceId: "salesforce",
    invoiceItem: {
      name: "Model Y",
      description: "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
      code: "120-C",
      sold: true,
      purchased: true,
      tracked: true,
      taxable: true,
      inventoryDate: new RFCDate("2020-10-30"),
      type: "inventory",
      salesDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      purchaseDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      quantity: 1,
      unitPrice: 27500.5,
      assetAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      incomeAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      expenseAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
      ],
      active: true,
      rowVersion: "1-12345",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingInvoiceItemsUpdate } from "@apideck/unify/funcs/accountingInvoiceItemsUpdate.js";
import { RFCDate } from "@apideck/unify/types";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingInvoiceItemsUpdate(apideck, {
    id: "<id>",
    serviceId: "salesforce",
    invoiceItem: {
      name: "Model Y",
      description: "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
      code: "120-C",
      sold: true,
      purchased: true,
      tracked: true,
      taxable: true,
      inventoryDate: new RFCDate("2020-10-30"),
      type: "inventory",
      salesDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      purchaseDetails: {
        unitPrice: 27500.5,
        unitOfMeasure: "pc.",
        taxInclusive: true,
        taxRate: {
          id: "123456",
          rate: 10,
        },
      },
      quantity: 1,
      unitPrice: 27500.5,
      assetAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      incomeAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      expenseAccount: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
      ],
      active: true,
      rowVersion: "1-12345",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingInvoiceItemsUpdateRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.AccountingInvoiceItemsUpdateResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

delete

Delete Invoice Item

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.invoiceItems.delete({
    id: "<id>",
    serviceId: "salesforce",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingInvoiceItemsDelete } from "@apideck/unify/funcs/accountingInvoiceItemsDelete.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingInvoiceItemsDelete(apideck, {
    id: "<id>",
    serviceId: "salesforce",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingInvoiceItemsDeleteRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.AccountingInvoiceItemsDeleteResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*