@epilot/document-client 0.19.1 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2025 epilot GmbH
3
+ Copyright (c) 2026 epilot GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/client.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { Client } from './openapi';
1
+ import type { Client } from './openapi';
2
2
  export declare const getClient: () => Client;
3
3
  export declare const createClient: () => Client;
@@ -1 +1 @@
1
- (()=>{"use strict";var e={757:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(871));t.default=n.default},871:e=>{e.exports=JSON.parse('{"openapi":"3.0.2","info":{"title":"Document API","version":"1.0.0","description":"A document generation API that allows you to generate documents from templates with variables.\\n\\n[Feature Documentation](https://docs.epilot.io/docs/files/document-generation)\\n"},"tags":[{"name":"Documents","description":"Document Generation"}],"security":[{"EpilotAuth":[]}],"paths":{"/v2/documents:meta":{"post":{"operationId":"getTemplateMeta","summary":"getTemplateMeta","description":"Get metadata for a document template\\n\\nSupported input document types:\\n- .docx\\n","tags":["Documents"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentMetaRequest"}}}},"responses":{"200":{"description":"Document metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentMetaResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOutput"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOutput"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOutput"}}}}}}},"/v2/documents:generate":{"post":{"operationId":"generateDocumentV2","summary":"generateDocumentV2","description":"Generates documents from templates with variables.\\n\\nSupported document types as input:\\n- .docx\\n- .ics\\n\\nSupported document types as output:\\n- .pdf\\n- .docx but limited to only text based variables\\n- .ics\\n\\nUses [Template Variable API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.\\n","parameters":[{"in":"query","name":"job_id","description":"Job ID for tracking the status of document generation action","schema":{"type":"string"}},{"in":"query","name":"mode","description":"Type of mode used for document generation flow:\\n- partial_generation will have a intermediate step for users to validate and replace the variable values before generating the final document.\\n- full_generation, goes through all the steps for the full generation of final document\\n","schema":{"type":"string","enum":["partial_generation","full_generation"],"default":"full_generation"}},{"in":"query","name":"preview_mode","description":"Type of mode used for document generation preview:\\n- open - preview_url provides a link to open the file in a browser\\n- download - preview_url provides a link to download the file\\n","schema":{"type":"string","enum":["open","download"],"default":"open"}}],"tags":["Documents"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentGenerationV2Request"}}}},"responses":{"200":{"description":"Generated document output","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentGenerationV2Response"}}}}}}},"/v2/documents:convert":{"post":{"operationId":"convertDocument","summary":"convertDocument","description":"Converts a document to a different format.\\n\\nSupported input document types:\\n- .docx\\n\\nSupported output document types:\\n- .pdf\\n","tags":["Documents"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConvertDocumentRequest"}}}},"responses":{"200":{"description":"Conversion job output","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConvertDocumentResponse"}}}}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Authorization header with epilot OAuth2 bearer token","bearerFormat":"JWT"}},"schemas":{"S3Reference":{"type":"object","properties":{"bucket":{"type":"string","example":"document-api-prod"},"key":{"type":"string","example":"uploads/my-template.pdf"}},"required":["bucket","key"]},"ErrorOutput":{"type":"object","properties":{"error_message":{"description":"Error message","type":"string"},"error_code":{"$ref":"#/components/schemas/ErrorCode"},"error_details":{"anyOf":[{"$ref":"#/components/schemas/InvalidCustomVariableErrorDetails"},{"$ref":"#/components/schemas/InternalErrorDetails"},{"$ref":"#/components/schemas/DocxTemplaterErrorDetails"}]}}},"InvalidCustomVariableErrorDetails":{"description":"Error details for invalid custom variables. This error will appear under \'PARSE_ERROR\' error code.","type":"array","items":{"$ref":"#/components/schemas/InvalidCustomVariableErrorDetail"}},"InvalidCustomVariableErrorDetail":{"type":"object","additionalProperties":true,"properties":{"explanation":{"description":"Explanation for the error","type":"string"},"context":{"description":"Context for the error","type":"object","properties":{"invalid_variables":{"description":"List of invalid variables","type":"array","items":{"type":"object","description":"Invalid variable","properties":{"variable":{"description":"Variable name","type":"string"},"error":{"description":"Explanation for the error","type":"string"}}}}}}}},"InternalErrorDetails":{"description":"Error details for internal error. This error will appear under \'INTERNAL_ERROR\' error code.","type":"array","items":{"type":"object","properties":{"items":{"$ref":"#/components/schemas/InternalErrorDetail"}}}},"InternalErrorDetail":{"type":"object","description":"Internal error detail","properties":{"name":{"description":"Name of the error","type":"string"},"message":{"description":"Error message","type":"string"},"stack":{"description":"Stack trace","type":"string"},"cause":{"description":"Cause of the error","type":"string"}}},"DocxTemplaterErrorDetails":{"description":"Error details for DocxTemplater error. This error will appear under \'PARSE_ERROR\' error code.\\nSee https://docxtemplater.com/docs/errors/#error-schema for more details.\\n","type":"array","items":{"$ref":"#/components/schemas/DocxTemplaterErrorDetail"}},"DocxTemplaterErrorDetail":{"type":"object","description":"DocxTemplater error detail","properties":{"id":{"description":"Id of the error","type":"string"},"context":{"description":"Context of the error","type":"string"},"explanation":{"description":"Explanation of the error","type":"string"}}},"ErrorCode":{"description":"Error codes for document generation:\\n- PARSE_ERROR - Error while parsing the document. Normally related with a bad template using the wrong DocxTemplater syntax.\\n- DOC_TO_PDF_CONVERT_ERROR - Error while converting the document to PDF. Normally related with a ConvertAPI failure.\\n- INTERNAL_ERROR - Internal error. Please contact support.\\n- INVALID_TEMPLATE_FORMAT - Invalid template format (only .docx is supported). This can happen due to a bad word file or an unsupported file extension.\\n","type":"string","enum":["PARSE_ERROR","DOC_TO_PDF_CONVERT_ERROR","INTERNAL_ERROR","INVALID_TEMPLATE_FORMAT"]},"TemplateSettings":{"type":"object","description":"Template Settings for document generation","properties":{"custom_margins":{"description":"Custom margins for the document","type":"object","properties":{"top":{"description":"Top margin in cm","type":"number","example":2.54},"bottom":{"description":"Bottom margin in cm","type":"number","example":2.54}}},"suggested_margins":{"description":"Suggested margins for the document","type":"object","properties":{"top":{"description":"Top margin in cm","type":"number","example":2.54},"bottom":{"description":"Bottom margin in cm","type":"number","example":2.54}}},"display_margin_guidelines":{"description":"Display margin guidelines (applicable to partial generation only)","type":"boolean","example":true},"enable_data_table_margin_autofix":{"description":"Enable data table margin autofix","type":"boolean","example":false},"template_with_datatable":{"description":"A flag that indicates whether the template has 1 or more data tables in it","type":"boolean","example":false},"enabled_template_settings_persistence":{"description":"Enables the persistance of template settings","type":"boolean","example":false},"misconfigured_margins":{"description":"An indication that the page margins are misconfigured","type":"boolean","example":false},"file_entity_id":{"description":"The file entity id, used when persisting a new template version with updated settings","type":"string","format":"uuid","example":"1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p"}}},"DocumentMetaRequest":{"type":"object","properties":{"template_document":{"description":"Input template document","type":"object","properties":{"s3ref":{"$ref":"#/components/schemas/S3Reference"}}}}},"DocumentMetaResponse":{"type":"object","properties":{"page_margins":{"description":"Page margins for the document","type":"object","properties":{"top":{"description":"Top margin in cm","type":"number","example":2.54},"bottom":{"description":"Bottom margin in cm","type":"number","example":2.54},"left":{"description":"Left margin in cm","type":"number","example":2.54},"right":{"description":"Right margin in cm","type":"number","example":2.54},"header":{"description":"Header margin in cm","type":"number","example":2.54},"footer":{"description":"Footer margin in cm","type":"number","example":2.54}}},"variables":{"description":"List of variables in the document","type":"array","items":{"type":"string"},"example":["order.billing_contact.0.salutation","order.billing_contact.0.title","order_table","stayHardStatic","opportunity[attribute_name]","opportunity[\\"attribute_name\\"]","opportunity.[attribute_name]","attribute_name","opportunities.0.attribute_name","opportunities[0].attribute_name","contact.opportunities[0].attribute_name","opportunities[Primary].attribute_name"]}}},"DocumentGenerationV2Request":{"type":"object","properties":{"template_document":{"description":"Input template document","type":"object","properties":{"filename":{"type":"string","description":"Document original filename","example":"my-template-{{order.order_number}}.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}}},"context_entity_id":{"type":"string","format":"uuid","description":"Entity to use for variable context","example":"bcd0aab9-b544-42b0-8bfb-6d449d02eacc"},"user_id":{"type":"string","description":"User Id for variable context","example":100321},"language":{"type":"string","description":"Language","example":"en"},"variable_payload":{"description":"Custom values for variables in the template. Takes the higher precedence than others.","type":"object","properties":{"additionalProperties":{"type":"string"}}},"context_data":{"description":"Custom values for variables in the template. Takes the higher precedence than others.","type":"object","properties":{"additionalProperties":{"type":"string"}}},"template_settings":{"$ref":"#/components/schemas/TemplateSettings"}},"required":["template_document"]},"DocumentGenerationV2Response":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid"},"job_status":{"description":"Status of the job","type":"string","enum":["STARTED","PROCESSING","SUCCESS","FAILED"]},"message":{"description":"A message explaining the progress","type":"string"},"ics_output":{"type":"object","properties":{"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for ICS","type":"string","example":"my-appointment-OR-001.ics"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-appointment.ics"}}}}},"pdf_output":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for PDF preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for PDF","type":"string","example":"my-template-OR-001.pdf"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.pdf"}}}}},"docx_output":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for DOCX preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for DOCX","type":"string","example":"my-template-OR-001.docx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.docx"}}}}},"error_output":{"$ref":"#/components/schemas/ErrorOutput"},"variable_payload":{"description":"List of variables and its corresponding replaced values from the document template","type":"object","properties":{"additionalProperties":{"type":"string"}}},"template_settings":{"$ref":"#/components/schemas/TemplateSettings"}}},"ConvertDocumentRequest":{"type":"object","properties":{"input_document":{"description":"Input document","type":"object","properties":{"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"required":["s3ref"]},"output_format":{"description":"Output format of the document","type":"string","enum":["pdf"]},"output_filename":{"description":"Filename of the output document (optional)","type":"string","example":"converted.pdf"}},"required":["input_document","output_format"]},"ConvertDocumentResponse":{"type":"object","properties":{"output_document":{"type":"object","properties":{"preview_url":{"description":"Pre-signed URL for the converted document","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/converted.pdf"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}}}}}}},"servers":[{"url":"https://document.sls.epilot.io"}]}')}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(757),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={438(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=r(o(466));t.default=n.default},466(e){e.exports=JSON.parse('{"openapi":"3.0.2","info":{"title":"","version":""},"paths":{"/v2/documents:meta":{"post":{"operationId":"getTemplateMeta","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v2/documents:generate":{"post":{"operationId":"generateDocumentV2","parameters":[{"in":"query","name":"job_id"},{"in":"query","name":"mode"},{"in":"query","name":"preview_mode"}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v2/documents:convert":{"post":{"operationId":"convertDocument","requestBody":{"content":{"application/json":{}}},"responses":{}}}},"components":{},"servers":[{"url":"https://document.sls.epilot.io"}]}')}},t={},o=function o(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,o),s.exports}(438),r=exports;for(var n in o)r[n]=o[n];o.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
package/dist/openapi.d.ts CHANGED
@@ -11,6 +11,12 @@ import type {
11
11
  declare namespace Components {
12
12
  namespace Schemas {
13
13
  export interface ConvertDocumentRequest {
14
+ /**
15
+ * Language
16
+ * example:
17
+ * de
18
+ */
19
+ language?: string;
14
20
  /**
15
21
  * Input document
16
22
  */
@@ -67,7 +73,7 @@ declare namespace Components {
67
73
  /**
68
74
  * Language
69
75
  * example:
70
- * en
76
+ * de
71
77
  */
72
78
  language?: string;
73
79
  /**
@@ -166,6 +172,32 @@ declare namespace Components {
166
172
  s3ref?: S3Reference;
167
173
  };
168
174
  };
175
+ xlsx_output?: {
176
+ /**
177
+ * Pre-signed S3 GET URL for XLSX preview
178
+ * example:
179
+ * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.xlsx
180
+ */
181
+ preview_url?: string;
182
+ /**
183
+ * example:
184
+ * {
185
+ * "s3ref": {
186
+ * "bucket": "document-api-preview-prod",
187
+ * "key": "preview/my-template.xlsx"
188
+ * }
189
+ * }
190
+ */
191
+ output_document?: {
192
+ /**
193
+ * Generated document filename for XLSX
194
+ * example:
195
+ * my-template-OR-001.xlsx
196
+ */
197
+ filename?: string;
198
+ s3ref?: S3Reference;
199
+ };
200
+ };
169
201
  error_output?: ErrorOutput;
170
202
  /**
171
203
  * List of variables and its corresponding replaced values from the document template
@@ -477,6 +509,7 @@ declare namespace Paths {
477
509
  }
478
510
  }
479
511
 
512
+
480
513
  export interface OperationMethods {
481
514
  /**
482
515
  * getTemplateMeta - getTemplateMeta
@@ -506,7 +539,7 @@ export interface OperationMethods {
506
539
  * - .docx but limited to only text based variables
507
540
  * - .ics
508
541
  *
509
- * Uses [Template Variable API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
542
+ * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
510
543
  *
511
544
  */
512
545
  'generateDocumentV2'(
@@ -565,7 +598,7 @@ export interface PathsDictionary {
565
598
  * - .docx but limited to only text based variables
566
599
  * - .ics
567
600
  *
568
- * Uses [Template Variable API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
601
+ * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
569
602
  *
570
603
  */
571
604
  'post'(
@@ -597,6 +630,7 @@ export interface PathsDictionary {
597
630
 
598
631
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
599
632
 
633
+
600
634
  export type ConvertDocumentRequest = Components.Schemas.ConvertDocumentRequest;
601
635
  export type ConvertDocumentResponse = Components.Schemas.ConvertDocumentResponse;
602
636
  export type DocumentGenerationV2Request = Components.Schemas.DocumentGenerationV2Request;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/document-client",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "API Client for epilot document API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "keywords": [],
19
19
  "author": "epilot GmbH",
20
- "license": "UNLICENSED",
20
+ "license": "MIT",
21
21
  "private": false,
22
22
  "peerDependencies": {
23
23
  "axios": "^1.0.0 || >=0.25.0 <1.0.0"
@@ -31,13 +31,10 @@
31
31
  "util": "^0.12.3"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/jest": "^26.0.20",
35
34
  "axios": "^1.11.0",
36
35
  "copy-webpack-plugin": "^7.0.0",
37
- "jest": "^29.6.2",
38
36
  "json-loader": "^0.5.7",
39
- "openapicmd": "^2.7.0",
40
- "ts-jest": "^29.4.1",
37
+ "openapicmd": "^2.9.2",
41
38
  "ts-loader": "^8.0.14",
42
39
  "ts-node": "^10.9.1",
43
40
  "typescript": "^4.1.3",
@@ -45,16 +42,16 @@
45
42
  "webpack-cli": "^4.4.0"
46
43
  },
47
44
  "scripts": {
48
- "test": "jest",
45
+ "test": "vitest",
49
46
  "typescript": "tsc",
50
47
  "bundle-definition": "webpack",
51
48
  "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/document.yaml",
52
49
  "openapi:local": "node ../../scripts/update-openapi.js ../../../document-api/lambda/ApiHandlerFunction/openapi.yml",
53
- "typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
50
+ "typegen": "openapi typegen src/openapi.json --client > src/openapi.d.ts",
54
51
  "build": "tsc && npm run build:patch && npm run bundle-definition",
55
52
  "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
56
53
  "build:watch": "npm run build && tsc -w",
57
54
  "release-alpha": "npm version prerelease --preid alpha",
58
- "lint": "pnpm exec eslint src"
55
+ "lint": "biome check src"
59
56
  }
60
57
  }
package/src/openapi.d.ts DELETED
@@ -1,649 +0,0 @@
1
- /* eslint-disable */
2
-
3
- import type {
4
- OpenAPIClient,
5
- Parameters,
6
- UnknownParamsObject,
7
- OperationResponse,
8
- AxiosRequestConfig,
9
- } from 'openapi-client-axios';
10
-
11
- declare namespace Components {
12
- namespace Schemas {
13
- export interface ConvertDocumentRequest {
14
- /**
15
- * Language
16
- * example:
17
- * de
18
- */
19
- language?: string;
20
- /**
21
- * Input document
22
- */
23
- input_document: {
24
- s3ref: S3Reference;
25
- };
26
- /**
27
- * Output format of the document
28
- */
29
- output_format: "pdf";
30
- /**
31
- * Filename of the output document (optional)
32
- * example:
33
- * converted.pdf
34
- */
35
- output_filename?: string;
36
- }
37
- export interface ConvertDocumentResponse {
38
- output_document?: {
39
- /**
40
- * Pre-signed URL for the converted document
41
- * example:
42
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/converted.pdf
43
- */
44
- preview_url?: string;
45
- s3ref?: S3Reference;
46
- };
47
- }
48
- export interface DocumentGenerationV2Request {
49
- /**
50
- * Input template document
51
- */
52
- template_document: {
53
- /**
54
- * Document original filename
55
- * example:
56
- * my-template-{{order.order_number}}.docx
57
- */
58
- filename?: string;
59
- s3ref?: S3Reference;
60
- };
61
- /**
62
- * Entity to use for variable context
63
- * example:
64
- * bcd0aab9-b544-42b0-8bfb-6d449d02eacc
65
- */
66
- context_entity_id?: string; // uuid
67
- /**
68
- * User Id for variable context
69
- * example:
70
- * 100321
71
- */
72
- user_id?: string;
73
- /**
74
- * Language
75
- * example:
76
- * de
77
- */
78
- language?: string;
79
- /**
80
- * Custom values for variables in the template. Takes the higher precedence than others.
81
- */
82
- variable_payload?: {
83
- additionalProperties?: string;
84
- };
85
- /**
86
- * Custom values for variables in the template. Takes the higher precedence than others.
87
- */
88
- context_data?: {
89
- additionalProperties?: string;
90
- };
91
- template_settings?: /* Template Settings for document generation */ TemplateSettings;
92
- }
93
- export interface DocumentGenerationV2Response {
94
- job_id?: string; // uuid
95
- /**
96
- * Status of the job
97
- */
98
- job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED";
99
- /**
100
- * A message explaining the progress
101
- */
102
- message?: string;
103
- ics_output?: {
104
- /**
105
- * example:
106
- * {
107
- * "s3ref": {
108
- * "bucket": "document-api-preview-prod",
109
- * "key": "preview/my-appointment.ics"
110
- * }
111
- * }
112
- */
113
- output_document?: {
114
- /**
115
- * Generated document filename for ICS
116
- * example:
117
- * my-appointment-OR-001.ics
118
- */
119
- filename?: string;
120
- s3ref?: S3Reference;
121
- };
122
- };
123
- pdf_output?: {
124
- /**
125
- * Pre-signed S3 GET URL for PDF preview
126
- * example:
127
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
128
- */
129
- preview_url?: string;
130
- /**
131
- * example:
132
- * {
133
- * "s3ref": {
134
- * "bucket": "document-api-preview-prod",
135
- * "key": "preview/my-template.pdf"
136
- * }
137
- * }
138
- */
139
- output_document?: {
140
- /**
141
- * Generated document filename for PDF
142
- * example:
143
- * my-template-OR-001.pdf
144
- */
145
- filename?: string;
146
- s3ref?: S3Reference;
147
- };
148
- };
149
- docx_output?: {
150
- /**
151
- * Pre-signed S3 GET URL for DOCX preview
152
- * example:
153
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx
154
- */
155
- preview_url?: string;
156
- /**
157
- * example:
158
- * {
159
- * "s3ref": {
160
- * "bucket": "document-api-preview-prod",
161
- * "key": "preview/my-template.docx"
162
- * }
163
- * }
164
- */
165
- output_document?: {
166
- /**
167
- * Generated document filename for DOCX
168
- * example:
169
- * my-template-OR-001.docx
170
- */
171
- filename?: string;
172
- s3ref?: S3Reference;
173
- };
174
- };
175
- xlsx_output?: {
176
- /**
177
- * Pre-signed S3 GET URL for XLSX preview
178
- * example:
179
- * https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.xlsx
180
- */
181
- preview_url?: string;
182
- /**
183
- * example:
184
- * {
185
- * "s3ref": {
186
- * "bucket": "document-api-preview-prod",
187
- * "key": "preview/my-template.xlsx"
188
- * }
189
- * }
190
- */
191
- output_document?: {
192
- /**
193
- * Generated document filename for XLSX
194
- * example:
195
- * my-template-OR-001.xlsx
196
- */
197
- filename?: string;
198
- s3ref?: S3Reference;
199
- };
200
- };
201
- error_output?: ErrorOutput;
202
- /**
203
- * List of variables and its corresponding replaced values from the document template
204
- */
205
- variable_payload?: {
206
- additionalProperties?: string;
207
- };
208
- template_settings?: /* Template Settings for document generation */ TemplateSettings;
209
- }
210
- export interface DocumentMetaRequest {
211
- /**
212
- * Input template document
213
- */
214
- template_document?: {
215
- s3ref?: S3Reference;
216
- };
217
- }
218
- export interface DocumentMetaResponse {
219
- /**
220
- * Page margins for the document
221
- */
222
- page_margins?: {
223
- /**
224
- * Top margin in cm
225
- * example:
226
- * 2.54
227
- */
228
- top?: number;
229
- /**
230
- * Bottom margin in cm
231
- * example:
232
- * 2.54
233
- */
234
- bottom?: number;
235
- /**
236
- * Left margin in cm
237
- * example:
238
- * 2.54
239
- */
240
- left?: number;
241
- /**
242
- * Right margin in cm
243
- * example:
244
- * 2.54
245
- */
246
- right?: number;
247
- /**
248
- * Header margin in cm
249
- * example:
250
- * 2.54
251
- */
252
- header?: number;
253
- /**
254
- * Footer margin in cm
255
- * example:
256
- * 2.54
257
- */
258
- footer?: number;
259
- };
260
- /**
261
- * List of variables in the document
262
- * example:
263
- * [
264
- * "order.billing_contact.0.salutation",
265
- * "order.billing_contact.0.title",
266
- * "order_table",
267
- * "stayHardStatic",
268
- * "opportunity[attribute_name]",
269
- * "opportunity[\"attribute_name\"]",
270
- * "opportunity.[attribute_name]",
271
- * "attribute_name",
272
- * "opportunities.0.attribute_name",
273
- * "opportunities[0].attribute_name",
274
- * "contact.opportunities[0].attribute_name",
275
- * "opportunities[Primary].attribute_name"
276
- * ]
277
- */
278
- variables?: string[];
279
- }
280
- /**
281
- * DocxTemplater error detail
282
- */
283
- export interface DocxTemplaterErrorDetail {
284
- /**
285
- * Id of the error
286
- */
287
- id?: string;
288
- /**
289
- * Context of the error
290
- */
291
- context?: string;
292
- /**
293
- * Explanation of the error
294
- */
295
- explanation?: string;
296
- }
297
- /**
298
- * Error details for DocxTemplater error. This error will appear under 'PARSE_ERROR' error code.
299
- * See https://docxtemplater.com/docs/errors/#error-schema for more details.
300
- *
301
- */
302
- export type DocxTemplaterErrorDetails = /* DocxTemplater error detail */ DocxTemplaterErrorDetail[];
303
- /**
304
- * Error codes for document generation:
305
- * - PARSE_ERROR - Error while parsing the document. Normally related with a bad template using the wrong DocxTemplater syntax.
306
- * - DOC_TO_PDF_CONVERT_ERROR - Error while converting the document to PDF. Normally related with a ConvertAPI failure.
307
- * - INTERNAL_ERROR - Internal error. Please contact support.
308
- * - INVALID_TEMPLATE_FORMAT - Invalid template format (only .docx is supported). This can happen due to a bad word file or an unsupported file extension.
309
- *
310
- */
311
- export type ErrorCode = "PARSE_ERROR" | "DOC_TO_PDF_CONVERT_ERROR" | "INTERNAL_ERROR" | "INVALID_TEMPLATE_FORMAT";
312
- export interface ErrorOutput {
313
- /**
314
- * Error message
315
- */
316
- error_message?: string;
317
- error_code?: /**
318
- * Error codes for document generation:
319
- * - PARSE_ERROR - Error while parsing the document. Normally related with a bad template using the wrong DocxTemplater syntax.
320
- * - DOC_TO_PDF_CONVERT_ERROR - Error while converting the document to PDF. Normally related with a ConvertAPI failure.
321
- * - INTERNAL_ERROR - Internal error. Please contact support.
322
- * - INVALID_TEMPLATE_FORMAT - Invalid template format (only .docx is supported). This can happen due to a bad word file or an unsupported file extension.
323
- *
324
- */
325
- ErrorCode;
326
- error_details?: /* Error details for invalid custom variables. This error will appear under 'PARSE_ERROR' error code. */ InvalidCustomVariableErrorDetails | /* Error details for internal error. This error will appear under 'INTERNAL_ERROR' error code. */ InternalErrorDetails | /**
327
- * Error details for DocxTemplater error. This error will appear under 'PARSE_ERROR' error code.
328
- * See https://docxtemplater.com/docs/errors/#error-schema for more details.
329
- *
330
- */
331
- DocxTemplaterErrorDetails;
332
- }
333
- /**
334
- * Internal error detail
335
- */
336
- export interface InternalErrorDetail {
337
- /**
338
- * Name of the error
339
- */
340
- name?: string;
341
- /**
342
- * Error message
343
- */
344
- message?: string;
345
- /**
346
- * Stack trace
347
- */
348
- stack?: string;
349
- /**
350
- * Cause of the error
351
- */
352
- cause?: string;
353
- }
354
- /**
355
- * Error details for internal error. This error will appear under 'INTERNAL_ERROR' error code.
356
- */
357
- export type InternalErrorDetails = {
358
- items?: /* Internal error detail */ InternalErrorDetail;
359
- }[];
360
- export interface InvalidCustomVariableErrorDetail {
361
- [name: string]: any;
362
- /**
363
- * Explanation for the error
364
- */
365
- explanation?: string;
366
- /**
367
- * Context for the error
368
- */
369
- context?: {
370
- /**
371
- * List of invalid variables
372
- */
373
- invalid_variables?: {
374
- /**
375
- * Variable name
376
- */
377
- variable?: string;
378
- /**
379
- * Explanation for the error
380
- */
381
- error?: string;
382
- }[];
383
- };
384
- }
385
- /**
386
- * Error details for invalid custom variables. This error will appear under 'PARSE_ERROR' error code.
387
- */
388
- export type InvalidCustomVariableErrorDetails = InvalidCustomVariableErrorDetail[];
389
- export interface S3Reference {
390
- /**
391
- * example:
392
- * document-api-prod
393
- */
394
- bucket: string;
395
- /**
396
- * example:
397
- * uploads/my-template.pdf
398
- */
399
- key: string;
400
- }
401
- /**
402
- * Template Settings for document generation
403
- */
404
- export interface TemplateSettings {
405
- /**
406
- * Custom margins for the document
407
- */
408
- custom_margins?: {
409
- /**
410
- * Top margin in cm
411
- * example:
412
- * 2.54
413
- */
414
- top?: number;
415
- /**
416
- * Bottom margin in cm
417
- * example:
418
- * 2.54
419
- */
420
- bottom?: number;
421
- };
422
- /**
423
- * Suggested margins for the document
424
- */
425
- suggested_margins?: {
426
- /**
427
- * Top margin in cm
428
- * example:
429
- * 2.54
430
- */
431
- top?: number;
432
- /**
433
- * Bottom margin in cm
434
- * example:
435
- * 2.54
436
- */
437
- bottom?: number;
438
- };
439
- /**
440
- * Display margin guidelines (applicable to partial generation only)
441
- * example:
442
- * true
443
- */
444
- display_margin_guidelines?: boolean;
445
- /**
446
- * Enable data table margin autofix
447
- * example:
448
- * false
449
- */
450
- enable_data_table_margin_autofix?: boolean;
451
- /**
452
- * A flag that indicates whether the template has 1 or more data tables in it
453
- * example:
454
- * false
455
- */
456
- template_with_datatable?: boolean;
457
- /**
458
- * Enables the persistance of template settings
459
- * example:
460
- * false
461
- */
462
- enabled_template_settings_persistence?: boolean;
463
- /**
464
- * An indication that the page margins are misconfigured
465
- * example:
466
- * false
467
- */
468
- misconfigured_margins?: boolean;
469
- /**
470
- * The file entity id, used when persisting a new template version with updated settings
471
- * example:
472
- * 1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p
473
- */
474
- file_entity_id?: string; // uuid
475
- }
476
- }
477
- }
478
- declare namespace Paths {
479
- namespace ConvertDocument {
480
- export type RequestBody = Components.Schemas.ConvertDocumentRequest;
481
- namespace Responses {
482
- export type $200 = Components.Schemas.ConvertDocumentResponse;
483
- }
484
- }
485
- namespace GenerateDocumentV2 {
486
- namespace Parameters {
487
- export type JobId = string;
488
- export type Mode = "partial_generation" | "full_generation";
489
- export type PreviewMode = "open" | "download";
490
- }
491
- export interface QueryParameters {
492
- job_id?: Parameters.JobId;
493
- mode?: Parameters.Mode;
494
- preview_mode?: Parameters.PreviewMode;
495
- }
496
- export type RequestBody = Components.Schemas.DocumentGenerationV2Request;
497
- namespace Responses {
498
- export type $200 = Components.Schemas.DocumentGenerationV2Response;
499
- }
500
- }
501
- namespace GetTemplateMeta {
502
- export type RequestBody = Components.Schemas.DocumentMetaRequest;
503
- namespace Responses {
504
- export type $200 = Components.Schemas.DocumentMetaResponse;
505
- export type $400 = Components.Schemas.ErrorOutput;
506
- export type $403 = Components.Schemas.ErrorOutput;
507
- export type $415 = Components.Schemas.ErrorOutput;
508
- }
509
- }
510
- }
511
-
512
-
513
- export interface OperationMethods {
514
- /**
515
- * getTemplateMeta - getTemplateMeta
516
- *
517
- * Get metadata for a document template
518
- *
519
- * Supported input document types:
520
- * - .docx
521
- *
522
- */
523
- 'getTemplateMeta'(
524
- parameters?: Parameters<UnknownParamsObject> | null,
525
- data?: Paths.GetTemplateMeta.RequestBody,
526
- config?: AxiosRequestConfig
527
- ): OperationResponse<Paths.GetTemplateMeta.Responses.$200>
528
- /**
529
- * generateDocumentV2 - generateDocumentV2
530
- *
531
- * Generates documents from templates with variables.
532
- *
533
- * Supported document types as input:
534
- * - .docx
535
- * - .ics
536
- *
537
- * Supported document types as output:
538
- * - .pdf
539
- * - .docx but limited to only text based variables
540
- * - .ics
541
- *
542
- * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
543
- *
544
- */
545
- 'generateDocumentV2'(
546
- parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
547
- data?: Paths.GenerateDocumentV2.RequestBody,
548
- config?: AxiosRequestConfig
549
- ): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
550
- /**
551
- * convertDocument - convertDocument
552
- *
553
- * Converts a document to a different format.
554
- *
555
- * Supported input document types:
556
- * - .docx
557
- *
558
- * Supported output document types:
559
- * - .pdf
560
- *
561
- */
562
- 'convertDocument'(
563
- parameters?: Parameters<UnknownParamsObject> | null,
564
- data?: Paths.ConvertDocument.RequestBody,
565
- config?: AxiosRequestConfig
566
- ): OperationResponse<Paths.ConvertDocument.Responses.$200>
567
- }
568
-
569
- export interface PathsDictionary {
570
- ['/v2/documents:meta']: {
571
- /**
572
- * getTemplateMeta - getTemplateMeta
573
- *
574
- * Get metadata for a document template
575
- *
576
- * Supported input document types:
577
- * - .docx
578
- *
579
- */
580
- 'post'(
581
- parameters?: Parameters<UnknownParamsObject> | null,
582
- data?: Paths.GetTemplateMeta.RequestBody,
583
- config?: AxiosRequestConfig
584
- ): OperationResponse<Paths.GetTemplateMeta.Responses.$200>
585
- }
586
- ['/v2/documents:generate']: {
587
- /**
588
- * generateDocumentV2 - generateDocumentV2
589
- *
590
- * Generates documents from templates with variables.
591
- *
592
- * Supported document types as input:
593
- * - .docx
594
- * - .ics
595
- *
596
- * Supported document types as output:
597
- * - .pdf
598
- * - .docx but limited to only text based variables
599
- * - .ics
600
- *
601
- * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
602
- *
603
- */
604
- 'post'(
605
- parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
606
- data?: Paths.GenerateDocumentV2.RequestBody,
607
- config?: AxiosRequestConfig
608
- ): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
609
- }
610
- ['/v2/documents:convert']: {
611
- /**
612
- * convertDocument - convertDocument
613
- *
614
- * Converts a document to a different format.
615
- *
616
- * Supported input document types:
617
- * - .docx
618
- *
619
- * Supported output document types:
620
- * - .pdf
621
- *
622
- */
623
- 'post'(
624
- parameters?: Parameters<UnknownParamsObject> | null,
625
- data?: Paths.ConvertDocument.RequestBody,
626
- config?: AxiosRequestConfig
627
- ): OperationResponse<Paths.ConvertDocument.Responses.$200>
628
- }
629
- }
630
-
631
- export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
632
-
633
-
634
- export type ConvertDocumentRequest = Components.Schemas.ConvertDocumentRequest;
635
- export type ConvertDocumentResponse = Components.Schemas.ConvertDocumentResponse;
636
- export type DocumentGenerationV2Request = Components.Schemas.DocumentGenerationV2Request;
637
- export type DocumentGenerationV2Response = Components.Schemas.DocumentGenerationV2Response;
638
- export type DocumentMetaRequest = Components.Schemas.DocumentMetaRequest;
639
- export type DocumentMetaResponse = Components.Schemas.DocumentMetaResponse;
640
- export type DocxTemplaterErrorDetail = Components.Schemas.DocxTemplaterErrorDetail;
641
- export type DocxTemplaterErrorDetails = Components.Schemas.DocxTemplaterErrorDetails;
642
- export type ErrorCode = Components.Schemas.ErrorCode;
643
- export type ErrorOutput = Components.Schemas.ErrorOutput;
644
- export type InternalErrorDetail = Components.Schemas.InternalErrorDetail;
645
- export type InternalErrorDetails = Components.Schemas.InternalErrorDetails;
646
- export type InvalidCustomVariableErrorDetail = Components.Schemas.InvalidCustomVariableErrorDetail;
647
- export type InvalidCustomVariableErrorDetails = Components.Schemas.InvalidCustomVariableErrorDetails;
648
- export type S3Reference = Components.Schemas.S3Reference;
649
- export type TemplateSettings = Components.Schemas.TemplateSettings;