Skip to content

Latest commit

 

History

History
568 lines (427 loc) · 40.2 KB

README.md

File metadata and controls

568 lines (427 loc) · 40.2 KB

Fields

(documents.fields)

Overview

Available Operations

get

Returns a single field. If you want to retrieve all the fields for a document, use the "Get Document" endpoint.

Example Usage

import { Documenso } from "@documenso/sdk-typescript";

const documenso = new Documenso({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const result = await documenso.documents.fields.get({
    fieldId: 8629.15,
  });

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

run();

Standalone function

The standalone function version of this method:

import { DocumensoCore } from "@documenso/sdk-typescript/core.js";
import { documentsFieldsGet } from "@documenso/sdk-typescript/funcs/documentsFieldsGet.js";

// Use `DocumensoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const documenso = new DocumensoCore({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsFieldsGet(documenso, {
    fieldId: 8629.15,
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FieldGetDocumentFieldRequest ✔️ 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.FieldGetDocumentFieldResponseBody>

Errors

Error Type Status Code Content Type
errors.FieldGetDocumentFieldResponseBody 400 application/json
errors.FieldGetDocumentFieldDocumentsFieldsResponseBody 404 application/json
errors.FieldGetDocumentFieldDocumentsFieldsResponseResponseBody 500 application/json
errors.APIError 4XX, 5XX */*

create

Create a single field for a document.

Example Usage

import { Documenso } from "@documenso/sdk-typescript";

const documenso = new Documenso({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const result = await documenso.documents.fields.create({
    documentId: 4865.89,
    field: {
      type: "NUMBER",
      recipientId: 4174.58,
      pageNumber: 1343.65,
      pageX: 690.25,
      pageY: 7964.74,
      width: 9510.62,
      height: 0.86,
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { DocumensoCore } from "@documenso/sdk-typescript/core.js";
import { documentsFieldsCreate } from "@documenso/sdk-typescript/funcs/documentsFieldsCreate.js";

// Use `DocumensoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const documenso = new DocumensoCore({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsFieldsCreate(documenso, {
    documentId: 4865.89,
    field: {
      type: "NUMBER",
      recipientId: 4174.58,
      pageNumber: 1343.65,
      pageX: 690.25,
      pageY: 7964.74,
      width: 9510.62,
      height: 0.86,
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FieldCreateDocumentFieldRequestBody ✔️ 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.FieldCreateDocumentFieldResponseBody>

Errors

Error Type Status Code Content Type
errors.FieldCreateDocumentFieldResponseBody 400 application/json
errors.FieldCreateDocumentFieldDocumentsFieldsResponseBody 500 application/json
errors.APIError 4XX, 5XX */*

createMany

Create multiple fields for a document.

Example Usage

import { Documenso } from "@documenso/sdk-typescript";

const documenso = new Documenso({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const result = await documenso.documents.fields.createMany({
    documentId: 5158.41,
    fields: [
      {
        type: "CHECKBOX",
        recipientId: 2516.72,
        pageNumber: 2304.17,
        pageX: 7760.32,
        pageY: 3376.66,
        width: 3566.94,
        height: 2768.94,
      },
      {
        type: "NUMBER",
        recipientId: 5689.64,
        pageNumber: 6483.69,
        pageX: 7271.79,
        pageY: 1891.56,
        width: 7263.21,
        height: 5043.41,
      },
    ],
  });

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

run();

Standalone function

The standalone function version of this method:

import { DocumensoCore } from "@documenso/sdk-typescript/core.js";
import { documentsFieldsCreateMany } from "@documenso/sdk-typescript/funcs/documentsFieldsCreateMany.js";

// Use `DocumensoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const documenso = new DocumensoCore({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsFieldsCreateMany(documenso, {
    documentId: 5158.41,
    fields: [
      {
        type: "CHECKBOX",
        recipientId: 2516.72,
        pageNumber: 2304.17,
        pageX: 7760.32,
        pageY: 3376.66,
        width: 3566.94,
        height: 2768.94,
      },
      {
        type: "NUMBER",
        recipientId: 5689.64,
        pageNumber: 6483.69,
        pageX: 7271.79,
        pageY: 1891.56,
        width: 7263.21,
        height: 5043.41,
      },
    ],
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FieldCreateDocumentFieldsRequestBody ✔️ 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.FieldCreateDocumentFieldsResponseBody>

Errors

Error Type Status Code Content Type
errors.FieldCreateDocumentFieldsResponseBody 400 application/json
errors.FieldCreateDocumentFieldsDocumentsFieldsResponseBody 500 application/json
errors.APIError 4XX, 5XX */*

update

Update a single field for a document.

Example Usage

import { Documenso } from "@documenso/sdk-typescript";

const documenso = new Documenso({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const result = await documenso.documents.fields.update({
    documentId: 8574.78,
    field: {
      type: "TEXT",
      id: 3446.2,
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { DocumensoCore } from "@documenso/sdk-typescript/core.js";
import { documentsFieldsUpdate } from "@documenso/sdk-typescript/funcs/documentsFieldsUpdate.js";

// Use `DocumensoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const documenso = new DocumensoCore({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsFieldsUpdate(documenso, {
    documentId: 8574.78,
    field: {
      type: "TEXT",
      id: 3446.2,
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FieldUpdateDocumentFieldRequestBody ✔️ 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.FieldUpdateDocumentFieldResponseBody>

Errors

Error Type Status Code Content Type
errors.FieldUpdateDocumentFieldResponseBody 400 application/json
errors.FieldUpdateDocumentFieldDocumentsFieldsResponseBody 500 application/json
errors.APIError 4XX, 5XX */*

updateMany

Update multiple fields for a document.

Example Usage

import { Documenso } from "@documenso/sdk-typescript";

const documenso = new Documenso({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const result = await documenso.documents.fields.updateMany({
    documentId: 4057.69,
    fields: [
      {
        type: "DATE",
        id: 8982.15,
      },
      {
        type: "NAME",
        id: 310.19,
      },
    ],
  });

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

run();

Standalone function

The standalone function version of this method:

import { DocumensoCore } from "@documenso/sdk-typescript/core.js";
import { documentsFieldsUpdateMany } from "@documenso/sdk-typescript/funcs/documentsFieldsUpdateMany.js";

// Use `DocumensoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const documenso = new DocumensoCore({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsFieldsUpdateMany(documenso, {
    documentId: 4057.69,
    fields: [
      {
        type: "DATE",
        id: 8982.15,
      },
      {
        type: "NAME",
        id: 310.19,
      },
    ],
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FieldUpdateDocumentFieldsRequestBody ✔️ 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.FieldUpdateDocumentFieldsResponseBody>

Errors

Error Type Status Code Content Type
errors.FieldUpdateDocumentFieldsResponseBody 400 application/json
errors.FieldUpdateDocumentFieldsDocumentsFieldsResponseBody 500 application/json
errors.APIError 4XX, 5XX */*

delete

Delete document field

Example Usage

import { Documenso } from "@documenso/sdk-typescript";

const documenso = new Documenso({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const result = await documenso.documents.fields.delete({
    fieldId: 5459.07,
  });

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

run();

Standalone function

The standalone function version of this method:

import { DocumensoCore } from "@documenso/sdk-typescript/core.js";
import { documentsFieldsDelete } from "@documenso/sdk-typescript/funcs/documentsFieldsDelete.js";

// Use `DocumensoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const documenso = new DocumensoCore({
  apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsFieldsDelete(documenso, {
    fieldId: 5459.07,
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FieldDeleteDocumentFieldRequestBody ✔️ 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.FieldDeleteDocumentFieldResponseBody>

Errors

Error Type Status Code Content Type
errors.FieldDeleteDocumentFieldResponseBody 400 application/json
errors.FieldDeleteDocumentFieldDocumentsFieldsResponseBody 500 application/json
errors.APIError 4XX, 5XX */*