@epilot/document-client 0.13.1-rc.2 → 0.13.1
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 +21 -0
- package/README.md +1 -1
- package/dist/definition.js +8 -1
- package/dist/openapi.d.ts +8 -38
- package/package.json +4 -3
- package/src/openapi.d.ts +478 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 epilot GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
package/dist/definition.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
(()=>{"use strict";var e={914: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(534));t.default=n.default},534: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: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 Variables 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"}}],"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"}}},"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":{"preview_url":{"description":"Pre-signed S3 GET URL for ICS preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-appointment-OR-001.ics"},"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}(914),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var openapi_json_1 = __importDefault(require("./openapi.json"));
|
|
7
|
+
exports.default = openapi_json_1.default;
|
|
8
|
+
//# sourceMappingURL=definition.js.map
|
package/dist/openapi.d.ts
CHANGED
|
@@ -94,32 +94,6 @@ declare namespace Components {
|
|
|
94
94
|
* A message explaining the progress
|
|
95
95
|
*/
|
|
96
96
|
message?: string;
|
|
97
|
-
ics_output?: {
|
|
98
|
-
/**
|
|
99
|
-
* Pre-signed S3 GET URL for ICS preview
|
|
100
|
-
* example:
|
|
101
|
-
* https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-appointment-OR-001.ics
|
|
102
|
-
*/
|
|
103
|
-
preview_url?: string;
|
|
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
97
|
pdf_output?: {
|
|
124
98
|
/**
|
|
125
99
|
* Pre-signed S3 GET URL for PDF preview
|
|
@@ -406,18 +380,16 @@ export interface OperationMethods {
|
|
|
406
380
|
/**
|
|
407
381
|
* generateDocumentV2 - generateDocumentV2
|
|
408
382
|
*
|
|
409
|
-
*
|
|
383
|
+
* Builds document generated from input document with variables.
|
|
410
384
|
*
|
|
411
|
-
* Supported document types
|
|
385
|
+
* Supported input document types:
|
|
412
386
|
* - .docx
|
|
413
|
-
* - .ics
|
|
414
387
|
*
|
|
415
|
-
* Supported document types
|
|
388
|
+
* Supported output document types:
|
|
416
389
|
* - .pdf
|
|
417
390
|
* - .docx but limited to only text based variables
|
|
418
|
-
* - .ics
|
|
419
391
|
*
|
|
420
|
-
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the
|
|
392
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
421
393
|
*
|
|
422
394
|
*/
|
|
423
395
|
'generateDocumentV2'(
|
|
@@ -449,18 +421,16 @@ export interface PathsDictionary {
|
|
|
449
421
|
/**
|
|
450
422
|
* generateDocumentV2 - generateDocumentV2
|
|
451
423
|
*
|
|
452
|
-
*
|
|
424
|
+
* Builds document generated from input document with variables.
|
|
453
425
|
*
|
|
454
|
-
* Supported document types
|
|
426
|
+
* Supported input document types:
|
|
455
427
|
* - .docx
|
|
456
|
-
* - .ics
|
|
457
428
|
*
|
|
458
|
-
* Supported document types
|
|
429
|
+
* Supported output document types:
|
|
459
430
|
* - .pdf
|
|
460
431
|
* - .docx but limited to only text based variables
|
|
461
|
-
* - .ics
|
|
462
432
|
*
|
|
463
|
-
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the
|
|
433
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
464
434
|
*
|
|
465
435
|
*/
|
|
466
436
|
'post'(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epilot/document-client",
|
|
3
|
-
"version": "0.13.1
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "API Client for epilot document API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/document.yaml",
|
|
12
12
|
"typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
|
|
13
13
|
"build": "tsc && npm run build:patch && npm run bundle-definition",
|
|
14
|
-
"build:patch": "sed -i
|
|
14
|
+
"build:patch": "sed -i '/^__exportStar.*openapi.*$/d' dist/index.js",
|
|
15
15
|
"build:watch": "npm run build && tsc -w",
|
|
16
16
|
"release-alpha": "npm version prerelease --preid alpha",
|
|
17
17
|
"lint": "../../node_modules/eslint/bin/eslint.js src"
|
|
@@ -54,5 +54,6 @@
|
|
|
54
54
|
"typescript": "^4.1.3",
|
|
55
55
|
"webpack": "^5.18.0",
|
|
56
56
|
"webpack-cli": "^4.4.0"
|
|
57
|
-
}
|
|
57
|
+
},
|
|
58
|
+
"gitHead": "cb7e6acc938eb178e531c19834ea8bd0d6445e6f"
|
|
58
59
|
}
|
package/src/openapi.d.ts
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
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
|
+
* Input document
|
|
16
|
+
*/
|
|
17
|
+
input_document: {
|
|
18
|
+
s3ref: S3Reference;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Output format of the document
|
|
22
|
+
*/
|
|
23
|
+
output_format: "pdf";
|
|
24
|
+
/**
|
|
25
|
+
* Filename of the output document (optional)
|
|
26
|
+
* example:
|
|
27
|
+
* converted.pdf
|
|
28
|
+
*/
|
|
29
|
+
output_filename?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ConvertDocumentResponse {
|
|
32
|
+
output_document?: {
|
|
33
|
+
/**
|
|
34
|
+
* Pre-signed URL for the converted document
|
|
35
|
+
* example:
|
|
36
|
+
* https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/converted.pdf
|
|
37
|
+
*/
|
|
38
|
+
preview_url?: string;
|
|
39
|
+
s3ref?: S3Reference;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface DocumentGenerationV2Request {
|
|
43
|
+
/**
|
|
44
|
+
* Input template document
|
|
45
|
+
*/
|
|
46
|
+
template_document: {
|
|
47
|
+
/**
|
|
48
|
+
* Document original filename
|
|
49
|
+
* example:
|
|
50
|
+
* my-template-{{order.order_number}}.docx
|
|
51
|
+
*/
|
|
52
|
+
filename?: string;
|
|
53
|
+
s3ref?: S3Reference;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Entity to use for variable context
|
|
57
|
+
* example:
|
|
58
|
+
* bcd0aab9-b544-42b0-8bfb-6d449d02eacc
|
|
59
|
+
*/
|
|
60
|
+
context_entity_id?: string; // uuid
|
|
61
|
+
/**
|
|
62
|
+
* User Id for variable context
|
|
63
|
+
* example:
|
|
64
|
+
* 100321
|
|
65
|
+
*/
|
|
66
|
+
user_id?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Language
|
|
69
|
+
* example:
|
|
70
|
+
* en
|
|
71
|
+
*/
|
|
72
|
+
language?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Custom values for variables in the template. Takes the higher precedence than others.
|
|
75
|
+
*/
|
|
76
|
+
variable_payload?: {
|
|
77
|
+
additionalProperties?: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Custom values for variables in the template. Takes the higher precedence than others.
|
|
81
|
+
*/
|
|
82
|
+
context_data?: {
|
|
83
|
+
additionalProperties?: string;
|
|
84
|
+
};
|
|
85
|
+
template_settings?: /* Template Settings for document generation */ TemplateSettings;
|
|
86
|
+
}
|
|
87
|
+
export interface DocumentGenerationV2Response {
|
|
88
|
+
job_id?: string; // uuid
|
|
89
|
+
/**
|
|
90
|
+
* Status of the job
|
|
91
|
+
*/
|
|
92
|
+
job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED";
|
|
93
|
+
/**
|
|
94
|
+
* A message explaining the progress
|
|
95
|
+
*/
|
|
96
|
+
message?: string;
|
|
97
|
+
pdf_output?: {
|
|
98
|
+
/**
|
|
99
|
+
* Pre-signed S3 GET URL for PDF preview
|
|
100
|
+
* example:
|
|
101
|
+
* https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf
|
|
102
|
+
*/
|
|
103
|
+
preview_url?: string;
|
|
104
|
+
/**
|
|
105
|
+
* example:
|
|
106
|
+
* {
|
|
107
|
+
* "s3ref": {
|
|
108
|
+
* "bucket": "document-api-preview-prod",
|
|
109
|
+
* "key": "preview/my-template.pdf"
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
*/
|
|
113
|
+
output_document?: {
|
|
114
|
+
/**
|
|
115
|
+
* Generated document filename for PDF
|
|
116
|
+
* example:
|
|
117
|
+
* my-template-OR-001.pdf
|
|
118
|
+
*/
|
|
119
|
+
filename?: string;
|
|
120
|
+
s3ref?: S3Reference;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
docx_output?: {
|
|
124
|
+
/**
|
|
125
|
+
* Pre-signed S3 GET URL for DOCX preview
|
|
126
|
+
* example:
|
|
127
|
+
* https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx
|
|
128
|
+
*/
|
|
129
|
+
preview_url?: string;
|
|
130
|
+
/**
|
|
131
|
+
* example:
|
|
132
|
+
* {
|
|
133
|
+
* "s3ref": {
|
|
134
|
+
* "bucket": "document-api-preview-prod",
|
|
135
|
+
* "key": "preview/my-template.docx"
|
|
136
|
+
* }
|
|
137
|
+
* }
|
|
138
|
+
*/
|
|
139
|
+
output_document?: {
|
|
140
|
+
/**
|
|
141
|
+
* Generated document filename for DOCX
|
|
142
|
+
* example:
|
|
143
|
+
* my-template-OR-001.docx
|
|
144
|
+
*/
|
|
145
|
+
filename?: string;
|
|
146
|
+
s3ref?: S3Reference;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
error_output?: ErrorOutput;
|
|
150
|
+
/**
|
|
151
|
+
* List of variables and its corresponding replaced values from the document template
|
|
152
|
+
*/
|
|
153
|
+
variable_payload?: {
|
|
154
|
+
additionalProperties?: string;
|
|
155
|
+
};
|
|
156
|
+
template_settings?: /* Template Settings for document generation */ TemplateSettings;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* DocxTemplater error detail
|
|
160
|
+
*/
|
|
161
|
+
export interface DocxTemplaterErrorDetail {
|
|
162
|
+
/**
|
|
163
|
+
* Id of the error
|
|
164
|
+
*/
|
|
165
|
+
id?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Context of the error
|
|
168
|
+
*/
|
|
169
|
+
context?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Explanation of the error
|
|
172
|
+
*/
|
|
173
|
+
explanation?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Error details for DocxTemplater error. This error will appear under 'PARSE_ERROR' error code.
|
|
177
|
+
* See https://docxtemplater.com/docs/errors/#error-schema for more details.
|
|
178
|
+
*
|
|
179
|
+
*/
|
|
180
|
+
export type DocxTemplaterErrorDetails = /* DocxTemplater error detail */ DocxTemplaterErrorDetail[];
|
|
181
|
+
/**
|
|
182
|
+
* Error codes for document generation:
|
|
183
|
+
* - PARSE_ERROR - Error while parsing the document. Normally related with a bad template using the wrong DocxTemplater syntax.
|
|
184
|
+
* - DOC_TO_PDF_CONVERT_ERROR - Error while converting the document to PDF. Normally related with a ConvertAPI failure.
|
|
185
|
+
* - INTERNAL_ERROR - Internal error. Please contact support.
|
|
186
|
+
* - INVALID_TEMPLATE_FORMAT - Invalid template format (only .docx is supported). This can happen due to a bad word file or an unsupported file extension.
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
export type ErrorCode = "PARSE_ERROR" | "DOC_TO_PDF_CONVERT_ERROR" | "INTERNAL_ERROR" | "INVALID_TEMPLATE_FORMAT";
|
|
190
|
+
export interface ErrorOutput {
|
|
191
|
+
/**
|
|
192
|
+
* Error message
|
|
193
|
+
*/
|
|
194
|
+
error_message?: string;
|
|
195
|
+
error_code?: /**
|
|
196
|
+
* Error codes for document generation:
|
|
197
|
+
* - PARSE_ERROR - Error while parsing the document. Normally related with a bad template using the wrong DocxTemplater syntax.
|
|
198
|
+
* - DOC_TO_PDF_CONVERT_ERROR - Error while converting the document to PDF. Normally related with a ConvertAPI failure.
|
|
199
|
+
* - INTERNAL_ERROR - Internal error. Please contact support.
|
|
200
|
+
* - INVALID_TEMPLATE_FORMAT - Invalid template format (only .docx is supported). This can happen due to a bad word file or an unsupported file extension.
|
|
201
|
+
*
|
|
202
|
+
*/
|
|
203
|
+
ErrorCode;
|
|
204
|
+
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 | /**
|
|
205
|
+
* Error details for DocxTemplater error. This error will appear under 'PARSE_ERROR' error code.
|
|
206
|
+
* See https://docxtemplater.com/docs/errors/#error-schema for more details.
|
|
207
|
+
*
|
|
208
|
+
*/
|
|
209
|
+
DocxTemplaterErrorDetails;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Internal error detail
|
|
213
|
+
*/
|
|
214
|
+
export interface InternalErrorDetail {
|
|
215
|
+
/**
|
|
216
|
+
* Name of the error
|
|
217
|
+
*/
|
|
218
|
+
name?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Error message
|
|
221
|
+
*/
|
|
222
|
+
message?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Stack trace
|
|
225
|
+
*/
|
|
226
|
+
stack?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Cause of the error
|
|
229
|
+
*/
|
|
230
|
+
cause?: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Error details for internal error. This error will appear under 'INTERNAL_ERROR' error code.
|
|
234
|
+
*/
|
|
235
|
+
export type InternalErrorDetails = {
|
|
236
|
+
items?: /* Internal error detail */ InternalErrorDetail;
|
|
237
|
+
}[];
|
|
238
|
+
export interface InvalidCustomVariableErrorDetail {
|
|
239
|
+
[name: string]: any;
|
|
240
|
+
/**
|
|
241
|
+
* Explanation for the error
|
|
242
|
+
*/
|
|
243
|
+
explanation?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Context for the error
|
|
246
|
+
*/
|
|
247
|
+
context?: {
|
|
248
|
+
/**
|
|
249
|
+
* List of invalid variables
|
|
250
|
+
*/
|
|
251
|
+
invalid_variables?: {
|
|
252
|
+
/**
|
|
253
|
+
* Variable name
|
|
254
|
+
*/
|
|
255
|
+
variable?: string;
|
|
256
|
+
/**
|
|
257
|
+
* Explanation for the error
|
|
258
|
+
*/
|
|
259
|
+
error?: string;
|
|
260
|
+
}[];
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Error details for invalid custom variables. This error will appear under 'PARSE_ERROR' error code.
|
|
265
|
+
*/
|
|
266
|
+
export type InvalidCustomVariableErrorDetails = InvalidCustomVariableErrorDetail[];
|
|
267
|
+
export interface S3Reference {
|
|
268
|
+
/**
|
|
269
|
+
* example:
|
|
270
|
+
* document-api-prod
|
|
271
|
+
*/
|
|
272
|
+
bucket: string;
|
|
273
|
+
/**
|
|
274
|
+
* example:
|
|
275
|
+
* uploads/my-template.pdf
|
|
276
|
+
*/
|
|
277
|
+
key: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Template Settings for document generation
|
|
281
|
+
*/
|
|
282
|
+
export interface TemplateSettings {
|
|
283
|
+
/**
|
|
284
|
+
* Custom margins for the document
|
|
285
|
+
*/
|
|
286
|
+
custom_margins?: {
|
|
287
|
+
/**
|
|
288
|
+
* Top margin in cm
|
|
289
|
+
* example:
|
|
290
|
+
* 2.54
|
|
291
|
+
*/
|
|
292
|
+
top?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Bottom margin in cm
|
|
295
|
+
* example:
|
|
296
|
+
* 2.54
|
|
297
|
+
*/
|
|
298
|
+
bottom?: number;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Suggested margins for the document
|
|
302
|
+
*/
|
|
303
|
+
suggested_margins?: {
|
|
304
|
+
/**
|
|
305
|
+
* Top margin in cm
|
|
306
|
+
* example:
|
|
307
|
+
* 2.54
|
|
308
|
+
*/
|
|
309
|
+
top?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Bottom margin in cm
|
|
312
|
+
* example:
|
|
313
|
+
* 2.54
|
|
314
|
+
*/
|
|
315
|
+
bottom?: number;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Display margin guidelines (applicable to partial generation only)
|
|
319
|
+
* example:
|
|
320
|
+
* true
|
|
321
|
+
*/
|
|
322
|
+
display_margin_guidelines?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Enable data table margin autofix
|
|
325
|
+
* example:
|
|
326
|
+
* false
|
|
327
|
+
*/
|
|
328
|
+
enable_data_table_margin_autofix?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* A flag that indicates whether the template has 1 or more data tables in it
|
|
331
|
+
* example:
|
|
332
|
+
* false
|
|
333
|
+
*/
|
|
334
|
+
template_with_datatable?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Enables the persistance of template settings
|
|
337
|
+
* example:
|
|
338
|
+
* false
|
|
339
|
+
*/
|
|
340
|
+
enabled_template_settings_persistence?: boolean;
|
|
341
|
+
/**
|
|
342
|
+
* An indication that the page margins are misconfigured
|
|
343
|
+
* example:
|
|
344
|
+
* false
|
|
345
|
+
*/
|
|
346
|
+
misconfigured_margins?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* The file entity id, used when persisting a new template version with updated settings
|
|
349
|
+
* example:
|
|
350
|
+
* 1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p
|
|
351
|
+
*/
|
|
352
|
+
file_entity_id?: string; // uuid
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
declare namespace Paths {
|
|
357
|
+
namespace ConvertDocument {
|
|
358
|
+
export type RequestBody = Components.Schemas.ConvertDocumentRequest;
|
|
359
|
+
namespace Responses {
|
|
360
|
+
export type $200 = Components.Schemas.ConvertDocumentResponse;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
namespace GenerateDocumentV2 {
|
|
364
|
+
namespace Parameters {
|
|
365
|
+
export type JobId = string;
|
|
366
|
+
export type Mode = "partial_generation" | "full_generation";
|
|
367
|
+
}
|
|
368
|
+
export interface QueryParameters {
|
|
369
|
+
job_id?: Parameters.JobId;
|
|
370
|
+
mode?: Parameters.Mode;
|
|
371
|
+
}
|
|
372
|
+
export type RequestBody = Components.Schemas.DocumentGenerationV2Request;
|
|
373
|
+
namespace Responses {
|
|
374
|
+
export type $200 = Components.Schemas.DocumentGenerationV2Response;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface OperationMethods {
|
|
380
|
+
/**
|
|
381
|
+
* generateDocumentV2 - generateDocumentV2
|
|
382
|
+
*
|
|
383
|
+
* Builds document generated from input document with variables.
|
|
384
|
+
*
|
|
385
|
+
* Supported input document types:
|
|
386
|
+
* - .docx
|
|
387
|
+
*
|
|
388
|
+
* Supported output document types:
|
|
389
|
+
* - .pdf
|
|
390
|
+
* - .docx but limited to only text based variables
|
|
391
|
+
*
|
|
392
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
393
|
+
*
|
|
394
|
+
*/
|
|
395
|
+
'generateDocumentV2'(
|
|
396
|
+
parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
|
|
397
|
+
data?: Paths.GenerateDocumentV2.RequestBody,
|
|
398
|
+
config?: AxiosRequestConfig
|
|
399
|
+
): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
|
|
400
|
+
/**
|
|
401
|
+
* convertDocument - convertDocument
|
|
402
|
+
*
|
|
403
|
+
* Converts a document to a different format.
|
|
404
|
+
*
|
|
405
|
+
* Supported input document types:
|
|
406
|
+
* - .docx
|
|
407
|
+
*
|
|
408
|
+
* Supported output document types:
|
|
409
|
+
* - .pdf
|
|
410
|
+
*
|
|
411
|
+
*/
|
|
412
|
+
'convertDocument'(
|
|
413
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
414
|
+
data?: Paths.ConvertDocument.RequestBody,
|
|
415
|
+
config?: AxiosRequestConfig
|
|
416
|
+
): OperationResponse<Paths.ConvertDocument.Responses.$200>
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface PathsDictionary {
|
|
420
|
+
['/v2/documents:generate']: {
|
|
421
|
+
/**
|
|
422
|
+
* generateDocumentV2 - generateDocumentV2
|
|
423
|
+
*
|
|
424
|
+
* Builds document generated from input document with variables.
|
|
425
|
+
*
|
|
426
|
+
* Supported input document types:
|
|
427
|
+
* - .docx
|
|
428
|
+
*
|
|
429
|
+
* Supported output document types:
|
|
430
|
+
* - .pdf
|
|
431
|
+
* - .docx but limited to only text based variables
|
|
432
|
+
*
|
|
433
|
+
* Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
|
|
434
|
+
*
|
|
435
|
+
*/
|
|
436
|
+
'post'(
|
|
437
|
+
parameters?: Parameters<Paths.GenerateDocumentV2.QueryParameters> | null,
|
|
438
|
+
data?: Paths.GenerateDocumentV2.RequestBody,
|
|
439
|
+
config?: AxiosRequestConfig
|
|
440
|
+
): OperationResponse<Paths.GenerateDocumentV2.Responses.$200>
|
|
441
|
+
}
|
|
442
|
+
['/v2/documents:convert']: {
|
|
443
|
+
/**
|
|
444
|
+
* convertDocument - convertDocument
|
|
445
|
+
*
|
|
446
|
+
* Converts a document to a different format.
|
|
447
|
+
*
|
|
448
|
+
* Supported input document types:
|
|
449
|
+
* - .docx
|
|
450
|
+
*
|
|
451
|
+
* Supported output document types:
|
|
452
|
+
* - .pdf
|
|
453
|
+
*
|
|
454
|
+
*/
|
|
455
|
+
'post'(
|
|
456
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
457
|
+
data?: Paths.ConvertDocument.RequestBody,
|
|
458
|
+
config?: AxiosRequestConfig
|
|
459
|
+
): OperationResponse<Paths.ConvertDocument.Responses.$200>
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
|
|
464
|
+
|
|
465
|
+
export type ConvertDocumentRequest = Components.Schemas.ConvertDocumentRequest;
|
|
466
|
+
export type ConvertDocumentResponse = Components.Schemas.ConvertDocumentResponse;
|
|
467
|
+
export type DocumentGenerationV2Request = Components.Schemas.DocumentGenerationV2Request;
|
|
468
|
+
export type DocumentGenerationV2Response = Components.Schemas.DocumentGenerationV2Response;
|
|
469
|
+
export type DocxTemplaterErrorDetail = Components.Schemas.DocxTemplaterErrorDetail;
|
|
470
|
+
export type DocxTemplaterErrorDetails = Components.Schemas.DocxTemplaterErrorDetails;
|
|
471
|
+
export type ErrorCode = Components.Schemas.ErrorCode;
|
|
472
|
+
export type ErrorOutput = Components.Schemas.ErrorOutput;
|
|
473
|
+
export type InternalErrorDetail = Components.Schemas.InternalErrorDetail;
|
|
474
|
+
export type InternalErrorDetails = Components.Schemas.InternalErrorDetails;
|
|
475
|
+
export type InvalidCustomVariableErrorDetail = Components.Schemas.InvalidCustomVariableErrorDetail;
|
|
476
|
+
export type InvalidCustomVariableErrorDetails = Components.Schemas.InvalidCustomVariableErrorDetails;
|
|
477
|
+
export type S3Reference = Components.Schemas.S3Reference;
|
|
478
|
+
export type TemplateSettings = Components.Schemas.TemplateSettings;
|