const apiToken: string = "SEU TOKEN";
const deParaTemplateName: DeParaTemplateBuilder = deParaTemplateBuilder()
.de("{{NOME COMPLETO}}")
.para("{{Full Name}}")
.build();
const deParaTemplateCpf: DeParaTemplateBuilder = deParaTemplateBuilder()
.de("{{NÚMERO DO CPF}}")
.para("{{Social Security Number}}")
.build();
const deParaTemplateEndereco: DeParaTemplateBuilder = deParaTemplateBuilder()
.de("{{ENDEREÇO COMPLETO}}")
.para("{{Full address}}")
.build();
let deParaTemplates: DeParaTemplatesBuilder[] = [];
deParaTemplates.push(deParaTemplateName, deParaTemplateCpf, deParaTemplateEndereco);
const docFromTemplate: DocFomTemplateBuilder = new DocFromTemplateBuilder()
.withSandbox(false)
.withPrimaryColor("#000000")
.withSignerName("My Signer for Template")
.withTemplateId("SEU TEMPLATE ID")
.withData(deParaTemplates)
.build();
async function exempleCreateDocFromTemplate() {
try {
docResponse: DocResponse = await new DocRequests(apiToken).createDocFromTemplate(docFromTemplate);
jsonDocResponse: string = new JsonConverter().docAsyncResponseToJson(docResponse);
console.log(jsonDocResponse);
} catch(Err) {
console.log(Err);
}
}
import { DeParaTemplateBuilder } from "sdk-node-typescript-zapsign/src/body/doc/builders/DeParaTemplateBuilder";
import DocRequests from "sdk-node-typescript-zapsign/src/docs/DocRequests";
import { JsonConverter } from "sdk-node-typescript-zapsign/src/services/JsonConverter";
import { DocFromTemplate } from "sdk-node-typescript-zapsign/src/body/doc/builders/DocFromTemplate";
const apiToken: string = "SEU TOKEN";
const deParaTemplateName: DeParaTemplateBuilder = deParaTemplateBuilder()
.de("{{NOME COMPLETO}}")
.para("{{Full Name}}")
.build();
const deParaTemplateCpf: DeParaTemplateBuilder = deParaTemplateBuilder()
.de("{{NÚMERO DO CPF}}")
.para("{{Social Security Number}}")
.build();
const deParaTemplateEndereco: DeParaTemplateBuilder = deParaTemplateBuilder()
.de("{{ENDEREÇO COMPLETO}}")
.para("{{Full address}}")
.build();
let deParaTemplates: DeParaTemplatesBuilder[] = [];
deParaTemplates.push(deParaTemplateName, deParaTemplateCpf, deParaTemplateEndereco);
const docFromTemplate: DocFomTemplateBuilder = new DocFromTemplateBuilder()
.withSandbox(false)
.withPrimaryColor("#000000")
.withSignerName("My Signer for Template")
.withTemplateId("SEU TEMPLATE ID")
.withData(deParaTemplates)
.build();
async function exempleCreateDocFromTemplate() {
try {
docResponse: DocResponse = await new DocRequests(apiToken).createDocFromTemplate(docFromTemplate);
jsonDocResponse: string = new JsonConverter().docAsyncResponseToJson(docResponse);
console.log(jsonDocResponse);
} catch(Err) {
console.log(Err);
}
}