Skip to content

Latest commit

 

History

History
580 lines (416 loc) · 44.2 KB

README.md

File metadata and controls

580 lines (416 loc) · 44.2 KB

Templates

(templates)

Overview

Available Operations

find

Find templates based on a search criteria

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.templates.find({});

  // 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 { templatesFind } from "@documenso/sdk-typescript/funcs/templatesFind.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 templatesFind(documenso, {});

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.TemplateFindTemplatesBadRequestError 400 application/json
errors.TemplateFindTemplatesNotFoundError 404 application/json
errors.TemplateFindTemplatesInternalServerError 500 application/json
errors.APIError 4XX, 5XX */*

get

Get template

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.templates.get({
    templateId: 7003.47,
  });

  // 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 { templatesGet } from "@documenso/sdk-typescript/funcs/templatesGet.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 templatesGet(documenso, {
    templateId: 7003.47,
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.TemplateGetTemplateByIdBadRequestError 400 application/json
errors.TemplateGetTemplateByIdNotFoundError 404 application/json
errors.TemplateGetTemplateByIdInternalServerError 500 application/json
errors.APIError 4XX, 5XX */*

update

Update template

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.templates.update({
    templateId: 8574.78,
  });

  // 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 { templatesUpdate } from "@documenso/sdk-typescript/funcs/templatesUpdate.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 templatesUpdate(documenso, {
    templateId: 8574.78,
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

duplicate

Duplicate template

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.templates.duplicate({
    templateId: 3523.11,
  });

  // 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 { templatesDuplicate } from "@documenso/sdk-typescript/funcs/templatesDuplicate.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 templatesDuplicate(documenso, {
    templateId: 3523.11,
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

delete

Delete template

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.templates.delete({
    templateId: 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 { templatesDelete } from "@documenso/sdk-typescript/funcs/templatesDelete.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 templatesDelete(documenso, {
    templateId: 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.TemplateDeleteTemplateRequest ✔️ 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.TemplateDeleteTemplateResponse>

Errors

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

use

Use the template to create 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.templates.use({
    templateId: 6626.9,
    recipients: [
      {
        id: 6473.53,
        email: "[email protected]",
      },
      {
        id: 3772.31,
        email: "[email protected]",
      },
    ],
  });

  // 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 { templatesUse } from "@documenso/sdk-typescript/funcs/templatesUse.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 templatesUse(documenso, {
    templateId: 6626.9,
    recipients: [
      {
        id: 6473.53,
        email: "[email protected]",
      },
      {
        id: 3772.31,
        email: "[email protected]",
      },
    ],
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

moveToTeam

Move a template to a team

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.templates.moveToTeam({
    templateId: 8301.72,
    teamId: 6724.78,
  });

  // 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 { templatesMoveToTeam } from "@documenso/sdk-typescript/funcs/templatesMoveToTeam.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 templatesMoveToTeam(documenso, {
    templateId: 8301.72,
    teamId: 6724.78,
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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