@epilot/document-client 0.19.0 → 0.19.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/dist/definition.js +1 -1
- package/dist/openapi.d.ts +3 -37
- package/package.json +16 -16
- package/src/openapi.d.ts +649 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 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/dist/definition.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={330: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 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"}},{"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":"de"},"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"}}}}},"xlsx_output":{"type":"object","properties":{"preview_url":{"description":"Pre-signed S3 GET URL for XLSX preview","type":"string","example":"https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.xlsx"},"output_document":{"type":"object","properties":{"filename":{"description":"Generated document filename for XLSX","type":"string","example":"my-template-OR-001.xlsx"},"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"example":{"s3ref":{"bucket":"document-api-preview-prod","key":"preview/my-template.xlsx"}}}}},"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":{"language":{"type":"string","description":"Language","example":"de"},"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}(330),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
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})})();
|
package/dist/openapi.d.ts
CHANGED
|
@@ -11,12 +11,6 @@ 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;
|
|
20
14
|
/**
|
|
21
15
|
* Input document
|
|
22
16
|
*/
|
|
@@ -73,7 +67,7 @@ declare namespace Components {
|
|
|
73
67
|
/**
|
|
74
68
|
* Language
|
|
75
69
|
* example:
|
|
76
|
-
*
|
|
70
|
+
* en
|
|
77
71
|
*/
|
|
78
72
|
language?: string;
|
|
79
73
|
/**
|
|
@@ -172,32 +166,6 @@ declare namespace Components {
|
|
|
172
166
|
s3ref?: S3Reference;
|
|
173
167
|
};
|
|
174
168
|
};
|
|
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
169
|
error_output?: ErrorOutput;
|
|
202
170
|
/**
|
|
203
171
|
* List of variables and its corresponding replaced values from the document template
|
|
@@ -509,7 +477,6 @@ declare namespace Paths {
|
|
|
509
477
|
}
|
|
510
478
|
}
|
|
511
479
|
|
|
512
|
-
|
|
513
480
|
export interface OperationMethods {
|
|
514
481
|
/**
|
|
515
482
|
* getTemplateMeta - getTemplateMeta
|
|
@@ -539,7 +506,7 @@ export interface OperationMethods {
|
|
|
539
506
|
* - .docx but limited to only text based variables
|
|
540
507
|
* - .ics
|
|
541
508
|
*
|
|
542
|
-
* Uses [Template
|
|
509
|
+
* Uses [Template Variable API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
|
|
543
510
|
*
|
|
544
511
|
*/
|
|
545
512
|
'generateDocumentV2'(
|
|
@@ -598,7 +565,7 @@ export interface PathsDictionary {
|
|
|
598
565
|
* - .docx but limited to only text based variables
|
|
599
566
|
* - .ics
|
|
600
567
|
*
|
|
601
|
-
* Uses [Template
|
|
568
|
+
* Uses [Template Variable API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
|
|
602
569
|
*
|
|
603
570
|
*/
|
|
604
571
|
'post'(
|
|
@@ -630,7 +597,6 @@ export interface PathsDictionary {
|
|
|
630
597
|
|
|
631
598
|
export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
|
|
632
599
|
|
|
633
|
-
|
|
634
600
|
export type ConvertDocumentRequest = Components.Schemas.ConvertDocumentRequest;
|
|
635
601
|
export type ConvertDocumentResponse = Components.Schemas.ConvertDocumentResponse;
|
|
636
602
|
export type DocumentGenerationV2Request = Components.Schemas.DocumentGenerationV2Request;
|
package/package.json
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epilot/document-client",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "API Client for epilot document API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "jest",
|
|
9
|
-
"typescript": "tsc",
|
|
10
|
-
"bundle-definition": "webpack",
|
|
11
|
-
"openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/document.yaml",
|
|
12
|
-
"openapi:local": "node ../../scripts/update-openapi.js ../../../document-api/lambda/ApiHandlerFunction/openapi.yml",
|
|
13
|
-
"typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
|
|
14
|
-
"build": "tsc && npm run build:patch && npm run bundle-definition",
|
|
15
|
-
"build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
|
|
16
|
-
"build:watch": "npm run build && tsc -w",
|
|
17
|
-
"release-alpha": "npm version prerelease --preid alpha",
|
|
18
|
-
"lint": "pnpm exec eslint src"
|
|
19
|
-
},
|
|
20
7
|
"files": [
|
|
21
8
|
"*.js",
|
|
22
9
|
"*.d.ts",
|
|
@@ -38,7 +25,7 @@
|
|
|
38
25
|
"dependencies": {
|
|
39
26
|
"buffer": "^6.0.3",
|
|
40
27
|
"https-browserify": "^1.0.0",
|
|
41
|
-
"openapi-client-axios": "^7.
|
|
28
|
+
"openapi-client-axios": "^7.8.0",
|
|
42
29
|
"stream-http": "^3.1.1",
|
|
43
30
|
"url": "^0.11.0",
|
|
44
31
|
"util": "^0.12.3"
|
|
@@ -56,5 +43,18 @@
|
|
|
56
43
|
"typescript": "^4.1.3",
|
|
57
44
|
"webpack": "^5.18.0",
|
|
58
45
|
"webpack-cli": "^4.4.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "jest",
|
|
49
|
+
"typescript": "tsc",
|
|
50
|
+
"bundle-definition": "webpack",
|
|
51
|
+
"openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/document.yaml",
|
|
52
|
+
"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",
|
|
54
|
+
"build": "tsc && npm run build:patch && npm run bundle-definition",
|
|
55
|
+
"build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
|
|
56
|
+
"build:watch": "npm run build && tsc -w",
|
|
57
|
+
"release-alpha": "npm version prerelease --preid alpha",
|
|
58
|
+
"lint": "pnpm exec eslint src"
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
}
|
package/src/openapi.d.ts
ADDED
|
@@ -0,0 +1,649 @@
|
|
|
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;
|