@epilot/document-client 0.16.2 → 1.0.0-rc.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  API Client for epilot Document API.
4
4
 
5
- Uses [`openapi-client-axios`](https://github.com/openapistack/openapi-client-axios)
5
+ Uses [`openapi-client-axios`](https://github.com/anttiviljami/openapi-client-axios)
6
6
 
7
7
  ## Getting Started
8
8
 
@@ -1 +1 @@
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: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}(914),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
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":"Builds document generated from input document with variables.\\n\\nSupported input document types:\\n- .docx\\n\\nSupported output document types:\\n- .pdf\\n- .docx but limited to only text based variables\\n\\nUses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the 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}}},"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},"variable_payload":{"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"},"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})})();
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './client';
2
- export * from './openapi';
2
+ export type { Client, Components, Paths, PathsDictionary, OperationMethods } from './openapi';
3
3
  export type { OpenAPIClient, OpenAPIClientAxios, Document } from 'openapi-client-axios';
package/dist/openapi.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  /* eslint-disable */
2
-
3
2
  import type {
4
3
  OpenAPIClient,
5
4
  Parameters,
6
5
  UnknownParamsObject,
7
6
  OperationResponse,
8
7
  AxiosRequestConfig,
9
- } from 'openapi-client-axios';
8
+ } from 'openapi-client-axios';
10
9
 
11
10
  declare namespace Components {
12
11
  namespace Schemas {
@@ -64,24 +63,12 @@ declare namespace Components {
64
63
  * 100321
65
64
  */
66
65
  user_id?: string;
67
- /**
68
- * Language
69
- * example:
70
- * en
71
- */
72
- language?: string;
73
66
  /**
74
67
  * Custom values for variables in the template. Takes the higher precedence than others.
75
68
  */
76
69
  variable_payload?: {
77
70
  additionalProperties?: string;
78
71
  };
79
- /**
80
- * Custom values for variables in the template. Takes the higher precedence than others.
81
- */
82
- context_data?: {
83
- additionalProperties?: string;
84
- };
85
72
  template_settings?: /* Template Settings for document generation */ TemplateSettings;
86
73
  }
87
74
  export interface DocumentGenerationV2Response {
@@ -94,26 +81,6 @@ declare namespace Components {
94
81
  * A message explaining the progress
95
82
  */
96
83
  message?: string;
97
- ics_output?: {
98
- /**
99
- * example:
100
- * {
101
- * "s3ref": {
102
- * "bucket": "document-api-preview-prod",
103
- * "key": "preview/my-appointment.ics"
104
- * }
105
- * }
106
- */
107
- output_document?: {
108
- /**
109
- * Generated document filename for ICS
110
- * example:
111
- * my-appointment-OR-001.ics
112
- */
113
- filename?: string;
114
- s3ref?: S3Reference;
115
- };
116
- };
117
84
  pdf_output?: {
118
85
  /**
119
86
  * Pre-signed S3 GET URL for PDF preview
@@ -175,76 +142,6 @@ declare namespace Components {
175
142
  };
176
143
  template_settings?: /* Template Settings for document generation */ TemplateSettings;
177
144
  }
178
- export interface DocumentMetaRequest {
179
- /**
180
- * Input template document
181
- */
182
- template_document?: {
183
- s3ref?: S3Reference;
184
- };
185
- }
186
- export interface DocumentMetaResponse {
187
- /**
188
- * Page margins for the document
189
- */
190
- page_margins?: {
191
- /**
192
- * Top margin in cm
193
- * example:
194
- * 2.54
195
- */
196
- top?: number;
197
- /**
198
- * Bottom margin in cm
199
- * example:
200
- * 2.54
201
- */
202
- bottom?: number;
203
- /**
204
- * Left margin in cm
205
- * example:
206
- * 2.54
207
- */
208
- left?: number;
209
- /**
210
- * Right margin in cm
211
- * example:
212
- * 2.54
213
- */
214
- right?: number;
215
- /**
216
- * Header margin in cm
217
- * example:
218
- * 2.54
219
- */
220
- header?: number;
221
- /**
222
- * Footer margin in cm
223
- * example:
224
- * 2.54
225
- */
226
- footer?: number;
227
- };
228
- /**
229
- * List of variables in the document
230
- * example:
231
- * [
232
- * "order.billing_contact.0.salutation",
233
- * "order.billing_contact.0.title",
234
- * "order_table",
235
- * "stayHardStatic",
236
- * "opportunity[attribute_name]",
237
- * "opportunity[\"attribute_name\"]",
238
- * "opportunity.[attribute_name]",
239
- * "attribute_name",
240
- * "opportunities.0.attribute_name",
241
- * "opportunities[0].attribute_name",
242
- * "contact.opportunities[0].attribute_name",
243
- * "opportunities[Primary].attribute_name"
244
- * ]
245
- */
246
- variables?: string[];
247
- }
248
145
  /**
249
146
  * DocxTemplater error detail
250
147
  */
@@ -387,23 +284,6 @@ declare namespace Components {
387
284
  */
388
285
  bottom?: number;
389
286
  };
390
- /**
391
- * Suggested margins for the document
392
- */
393
- suggested_margins?: {
394
- /**
395
- * Top margin in cm
396
- * example:
397
- * 2.54
398
- */
399
- top?: number;
400
- /**
401
- * Bottom margin in cm
402
- * example:
403
- * 2.54
404
- */
405
- bottom?: number;
406
- };
407
287
  /**
408
288
  * Display margin guidelines (applicable to partial generation only)
409
289
  * example:
@@ -454,59 +334,32 @@ declare namespace Paths {
454
334
  namespace Parameters {
455
335
  export type JobId = string;
456
336
  export type Mode = "partial_generation" | "full_generation";
457
- export type PreviewMode = "open" | "download";
458
337
  }
459
338
  export interface QueryParameters {
460
339
  job_id?: Parameters.JobId;
461
340
  mode?: Parameters.Mode;
462
- preview_mode?: Parameters.PreviewMode;
463
341
  }
464
342
  export type RequestBody = Components.Schemas.DocumentGenerationV2Request;
465
343
  namespace Responses {
466
344
  export type $200 = Components.Schemas.DocumentGenerationV2Response;
467
345
  }
468
346
  }
469
- namespace GetTemplateMeta {
470
- export type RequestBody = Components.Schemas.DocumentMetaRequest;
471
- namespace Responses {
472
- export type $200 = Components.Schemas.DocumentMetaResponse;
473
- export type $400 = Components.Schemas.ErrorOutput;
474
- export type $403 = Components.Schemas.ErrorOutput;
475
- export type $415 = Components.Schemas.ErrorOutput;
476
- }
477
- }
478
347
  }
479
348
 
480
349
  export interface OperationMethods {
481
- /**
482
- * getTemplateMeta - getTemplateMeta
483
- *
484
- * Get metadata for a document template
485
- *
486
- * Supported input document types:
487
- * - .docx
488
- *
489
- */
490
- 'getTemplateMeta'(
491
- parameters?: Parameters<UnknownParamsObject> | null,
492
- data?: Paths.GetTemplateMeta.RequestBody,
493
- config?: AxiosRequestConfig
494
- ): OperationResponse<Paths.GetTemplateMeta.Responses.$200>
495
350
  /**
496
351
  * generateDocumentV2 - generateDocumentV2
497
352
  *
498
- * Generates documents from templates with variables.
353
+ * Builds document generated from input document with variables.
499
354
  *
500
- * Supported document types as input:
355
+ * Supported input document types:
501
356
  * - .docx
502
- * - .ics
503
357
  *
504
- * Supported document types as output:
358
+ * Supported output document types:
505
359
  * - .pdf
506
360
  * - .docx but limited to only text based variables
507
- * - .ics
508
361
  *
509
- * Uses [Template Variable API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
362
+ * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
510
363
  *
511
364
  */
512
365
  'generateDocumentV2'(
@@ -534,38 +387,20 @@ export interface OperationMethods {
534
387
  }
535
388
 
536
389
  export interface PathsDictionary {
537
- ['/v2/documents:meta']: {
538
- /**
539
- * getTemplateMeta - getTemplateMeta
540
- *
541
- * Get metadata for a document template
542
- *
543
- * Supported input document types:
544
- * - .docx
545
- *
546
- */
547
- 'post'(
548
- parameters?: Parameters<UnknownParamsObject> | null,
549
- data?: Paths.GetTemplateMeta.RequestBody,
550
- config?: AxiosRequestConfig
551
- ): OperationResponse<Paths.GetTemplateMeta.Responses.$200>
552
- }
553
390
  ['/v2/documents:generate']: {
554
391
  /**
555
392
  * generateDocumentV2 - generateDocumentV2
556
393
  *
557
- * Generates documents from templates with variables.
394
+ * Builds document generated from input document with variables.
558
395
  *
559
- * Supported document types as input:
396
+ * Supported input document types:
560
397
  * - .docx
561
- * - .ics
562
398
  *
563
- * Supported document types as output:
399
+ * Supported output document types:
564
400
  * - .pdf
565
401
  * - .docx but limited to only text based variables
566
- * - .ics
567
402
  *
568
- * Uses [Template Variable API](https://docs.epilot.io/api/template-variables) to replace variables in the input document.
403
+ * Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
569
404
  *
570
405
  */
571
406
  'post'(
@@ -596,20 +431,3 @@ export interface PathsDictionary {
596
431
  }
597
432
 
598
433
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
599
-
600
- export type ConvertDocumentRequest = Components.Schemas.ConvertDocumentRequest;
601
- export type ConvertDocumentResponse = Components.Schemas.ConvertDocumentResponse;
602
- export type DocumentGenerationV2Request = Components.Schemas.DocumentGenerationV2Request;
603
- export type DocumentGenerationV2Response = Components.Schemas.DocumentGenerationV2Response;
604
- export type DocumentMetaRequest = Components.Schemas.DocumentMetaRequest;
605
- export type DocumentMetaResponse = Components.Schemas.DocumentMetaResponse;
606
- export type DocxTemplaterErrorDetail = Components.Schemas.DocxTemplaterErrorDetail;
607
- export type DocxTemplaterErrorDetails = Components.Schemas.DocxTemplaterErrorDetails;
608
- export type ErrorCode = Components.Schemas.ErrorCode;
609
- export type ErrorOutput = Components.Schemas.ErrorOutput;
610
- export type InternalErrorDetail = Components.Schemas.InternalErrorDetail;
611
- export type InternalErrorDetails = Components.Schemas.InternalErrorDetails;
612
- export type InvalidCustomVariableErrorDetail = Components.Schemas.InvalidCustomVariableErrorDetail;
613
- export type InvalidCustomVariableErrorDetails = Components.Schemas.InvalidCustomVariableErrorDetails;
614
- export type S3Reference = Components.Schemas.S3Reference;
615
- export type TemplateSettings = Components.Schemas.TemplateSettings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/document-client",
3
- "version": "0.16.2",
3
+ "version": "1.0.0-rc.1",
4
4
  "description": "API Client for epilot document API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,10 +9,8 @@
9
9
  "typescript": "tsc",
10
10
  "bundle-definition": "webpack",
11
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",
12
+ "typegen": "echo '/* eslint-disable */' > src/openapi.d.ts && typegen ./src/openapi.json >> src/openapi.d.ts",
13
+ "build": "tsc && npm run bundle-definition",
16
14
  "build:watch": "npm run build && tsc -w",
17
15
  "release-alpha": "npm version prerelease --preid alpha",
18
16
  "lint": "../../node_modules/eslint/bin/eslint.js src"
@@ -48,7 +46,8 @@
48
46
  "copy-webpack-plugin": "^7.0.0",
49
47
  "jest": "^26.6.3",
50
48
  "json-loader": "^0.5.7",
51
- "openapicmd": "^2.6.0",
49
+ "openapi-client-axios-typegen": "^7.4.1",
50
+ "openapicmd": "^2.1.0",
52
51
  "ts-jest": "^26.5.0",
53
52
  "ts-loader": "^8.0.14",
54
53
  "ts-node": "^10.9.1",