Skip to content

Latest commit

 

History

History
580 lines (416 loc) · 44.8 KB

README.md

File metadata and controls

580 lines (416 loc) · 44.8 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.TemplateFindTemplatesResponseBody>

Errors

Error Type Status Code Content Type
errors.TemplateFindTemplatesResponseBody 400 application/json
errors.TemplateFindTemplatesTemplatesResponseBody 404 application/json
errors.TemplateFindTemplatesTemplatesResponseResponseBody 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.TemplateGetTemplateByIdResponseBody>

Errors

Error Type Status Code Content Type
errors.TemplateGetTemplateByIdResponseBody 400 application/json
errors.TemplateGetTemplateByIdTemplatesResponseBody 404 application/json
errors.TemplateGetTemplateByIdTemplatesResponseResponseBody 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.TemplateUpdateTemplateRequestBody ✔️ 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.TemplateUpdateTemplateResponseBody>

Errors

Error Type Status Code Content Type
errors.TemplateUpdateTemplateResponseBody 400 application/json
errors.TemplateUpdateTemplateTemplatesResponseBody 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.TemplateDuplicateTemplateRequestBody ✔️ 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.TemplateDuplicateTemplateResponseBody>

Errors

Error Type Status Code Content Type
errors.TemplateDuplicateTemplateResponseBody 400 application/json
errors.TemplateDuplicateTemplateTemplatesResponseBody 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.TemplateDeleteTemplateRequestBody ✔️ 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.TemplateDeleteTemplateResponseBody>

Errors

Error Type Status Code Content Type
errors.TemplateDeleteTemplateResponseBody 400 application/json
errors.TemplateDeleteTemplateTemplatesResponseBody 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.TemplateCreateDocumentFromTemplateRequestBody ✔️ 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.TemplateCreateDocumentFromTemplateResponseBody>

Errors

Error Type Status Code Content Type
errors.TemplateCreateDocumentFromTemplateResponseBody 400 application/json
errors.TemplateCreateDocumentFromTemplateTemplatesResponseBody 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.TemplateMoveTemplateToTeamRequestBody ✔️ 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.TemplateMoveTemplateToTeamResponseBody>

Errors

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