pdf_generator_api_client 4.0.25
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.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +519 -0
- data/Rakefile +10 -0
- data/docs/AccessibilityOption.md +15 -0
- data/docs/AddWatermarkRequest.md +49 -0
- data/docs/AssetsApi.md +77 -0
- data/docs/AsyncOutputParam.md +15 -0
- data/docs/CallbackParam.md +20 -0
- data/docs/Component.md +34 -0
- data/docs/ConversionApi.md +217 -0
- data/docs/ConvertHTML2PDFRequest.md +26 -0
- data/docs/ConvertPDF2ImageRequest.md +32 -0
- data/docs/ConvertURL2PDFRequest.md +26 -0
- data/docs/CopyTemplateRequest.md +18 -0
- data/docs/CreateEInvoiceRequest.md +22 -0
- data/docs/CreateFacturXEInvoiceRequest.md +26 -0
- data/docs/CreateFacturXEInvoiceRequestTemplate.md +22 -0
- data/docs/CreateWorkspaceRequest.md +18 -0
- data/docs/DataBatchInner.md +20 -0
- data/docs/Document.md +26 -0
- data/docs/DocumentsApi.md +646 -0
- data/docs/EInvoicesApi.md +284 -0
- data/docs/EncryptAndDecryptBase64.md +26 -0
- data/docs/EncryptAndDecryptUrl.md +26 -0
- data/docs/EncryptDocumentRequest.md +49 -0
- data/docs/ExtractFormFieldsRequest.md +49 -0
- data/docs/FillFormFieldsRequest.md +49 -0
- data/docs/FormActionDownload.md +18 -0
- data/docs/FormActionSend.md +18 -0
- data/docs/FormActionSendSendDocument.md +20 -0
- data/docs/FormActionSendSendDocumentHeadersInner.md +20 -0
- data/docs/FormActionStore.md +18 -0
- data/docs/FormConfiguration.md +22 -0
- data/docs/FormConfigurationNew.md +26 -0
- data/docs/FormConfigurationNewActionsInner.md +22 -0
- data/docs/FormFieldsBase64.md +20 -0
- data/docs/FormFieldsInner.md +24 -0
- data/docs/FormFieldsUrl.md +20 -0
- data/docs/FormFillBase64.md +24 -0
- data/docs/FormFillUrl.md +24 -0
- data/docs/FormatParam.md +15 -0
- data/docs/FormsApi.md +639 -0
- data/docs/GenerateDocumentAsynchronousRequest.md +32 -0
- data/docs/GenerateDocumentBatchAsynchronousRequest.md +30 -0
- data/docs/GenerateDocumentBatchRequest.md +28 -0
- data/docs/GenerateDocumentRequest.md +30 -0
- data/docs/GenerateQRCode201Response.md +20 -0
- data/docs/GenerateQRCode201ResponseMeta.md +20 -0
- data/docs/GenerateQRCodeRequest.md +26 -0
- data/docs/GetStatus200Response.md +28 -0
- data/docs/GetTemplateLibrary200Response.md +18 -0
- data/docs/GetTemplateVersion422Response.md +18 -0
- data/docs/ImportFormBase64.md +20 -0
- data/docs/ImportFormRequest.md +49 -0
- data/docs/ImportFormUrl.md +20 -0
- data/docs/ImportTemplateBase64.md +20 -0
- data/docs/ImportTemplateRequest.md +49 -0
- data/docs/ImportTemplateUrl.md +20 -0
- data/docs/ImportTemplateUrlTemplate.md +18 -0
- data/docs/InlineObject.md +20 -0
- data/docs/InlineObject1.md +18 -0
- data/docs/InlineObject10.md +20 -0
- data/docs/InlineObject10Meta.md +24 -0
- data/docs/InlineObject11.md +20 -0
- data/docs/InlineObject11Meta.md +26 -0
- data/docs/InlineObject12.md +20 -0
- data/docs/InlineObject12Meta.md +28 -0
- data/docs/InlineObject12MetaStats.md +20 -0
- data/docs/InlineObject13.md +20 -0
- data/docs/InlineObject14.md +18 -0
- data/docs/InlineObject14ResponseValue.md +46 -0
- data/docs/InlineObject14ResponseValueDefault.md +51 -0
- data/docs/InlineObject14ResponseValueValue.md +51 -0
- data/docs/InlineObject15.md +20 -0
- data/docs/InlineObject16.md +20 -0
- data/docs/InlineObject17.md +18 -0
- data/docs/InlineObject18.md +20 -0
- data/docs/InlineObject18Meta.md +18 -0
- data/docs/InlineObject19.md +18 -0
- data/docs/InlineObject1Response.md +18 -0
- data/docs/InlineObject2.md +18 -0
- data/docs/InlineObject20.md +18 -0
- data/docs/InlineObject20Response.md +18 -0
- data/docs/InlineObject21.md +18 -0
- data/docs/InlineObject22.md +18 -0
- data/docs/InlineObject23.md +18 -0
- data/docs/InlineObject24.md +18 -0
- data/docs/InlineObject25.md +20 -0
- data/docs/InlineObject26.md +18 -0
- data/docs/InlineObject27.md +18 -0
- data/docs/InlineObject3.md +18 -0
- data/docs/InlineObject4.md +20 -0
- data/docs/InlineObject5.md +20 -0
- data/docs/InlineObject6.md +20 -0
- data/docs/InlineObject7.md +18 -0
- data/docs/InlineObject7Response.md +18 -0
- data/docs/InlineObject8.md +18 -0
- data/docs/InlineObject9.md +20 -0
- data/docs/InlineObject9Meta.md +26 -0
- data/docs/InlineObjectMeta.md +20 -0
- data/docs/KeyFieldParam.md +15 -0
- data/docs/MakeAccessibleBase64.md +26 -0
- data/docs/MakeAccessibleRequest.md +49 -0
- data/docs/MakeAccessibleUrl.md +26 -0
- data/docs/MetadataParam.md +20 -0
- data/docs/MiscApi.md +74 -0
- data/docs/OpenEditorRequest.md +20 -0
- data/docs/OpenEditorRequestData.md +49 -0
- data/docs/OptimizeBase64.md +22 -0
- data/docs/OptimizeDocumentRequest.md +49 -0
- data/docs/OptimizeUrl.md +22 -0
- data/docs/OutputParam.md +15 -0
- data/docs/PaginationMeta.md +22 -0
- data/docs/PromoteTemplateVersion200Response.md +18 -0
- data/docs/PublicTemplateLibraryItem.md +26 -0
- data/docs/ServicesApi.md +497 -0
- data/docs/StatusParam.md +15 -0
- data/docs/StoreDocumentRequest.md +24 -0
- data/docs/Template.md +28 -0
- data/docs/TemplateDefinition.md +32 -0
- data/docs/TemplateDefinitionDataSettings.md +20 -0
- data/docs/TemplateDefinitionEditor.md +18 -0
- data/docs/TemplateDefinitionNew.md +34 -0
- data/docs/TemplateDefinitionNewDataSettings.md +22 -0
- data/docs/TemplateDefinitionNewEditor.md +18 -0
- data/docs/TemplateDefinitionNewLayout.md +34 -0
- data/docs/TemplateDefinitionNewLayoutMargins.md +24 -0
- data/docs/TemplateDefinitionNewLayoutRepeatLayout.md +22 -0
- data/docs/TemplateDefinitionNewPagesInner.md +32 -0
- data/docs/TemplateDefinitionNewPagesInnerMargins.md +20 -0
- data/docs/TemplateDefinitionPagesInner.md +24 -0
- data/docs/TemplateLibraryApi.md +139 -0
- data/docs/TemplateParam.md +22 -0
- data/docs/TemplateParamData.md +49 -0
- data/docs/TemplateParamId.md +49 -0
- data/docs/TemplateVersion.md +36 -0
- data/docs/TemplateVersionCollection.md +20 -0
- data/docs/TemplateVersionCollectionMeta.md +22 -0
- data/docs/TemplateVersionsApi.md +298 -0
- data/docs/TemplatesApi.md +791 -0
- data/docs/WatermarkBase64.md +24 -0
- data/docs/WatermarkFileUrlWatermark.md +20 -0
- data/docs/WatermarkImage.md +26 -0
- data/docs/WatermarkImageContentBase64.md +24 -0
- data/docs/WatermarkImageContentUrl.md +24 -0
- data/docs/WatermarkPosition.md +15 -0
- data/docs/WatermarkText.md +28 -0
- data/docs/Workspace.md +24 -0
- data/docs/WorkspacesApi.md +292 -0
- data/git_push.sh +57 -0
- data/lib/pdf_generator_api_client/api/assets_api.rb +90 -0
- data/lib/pdf_generator_api_client/api/conversion_api.rb +226 -0
- data/lib/pdf_generator_api_client/api/documents_api.rb +623 -0
- data/lib/pdf_generator_api_client/api/e_invoices_api.rb +283 -0
- data/lib/pdf_generator_api_client/api/forms_api.rb +604 -0
- data/lib/pdf_generator_api_client/api/misc_api.rb +79 -0
- data/lib/pdf_generator_api_client/api/services_api.rb +498 -0
- data/lib/pdf_generator_api_client/api/template_library_api.rb +145 -0
- data/lib/pdf_generator_api_client/api/template_versions_api.rb +298 -0
- data/lib/pdf_generator_api_client/api/templates_api.rb +766 -0
- data/lib/pdf_generator_api_client/api/workspaces_api.rb +275 -0
- data/lib/pdf_generator_api_client/api_client.rb +393 -0
- data/lib/pdf_generator_api_client/api_error.rb +58 -0
- data/lib/pdf_generator_api_client/configuration.rb +309 -0
- data/lib/pdf_generator_api_client/models/accessibility_option.rb +47 -0
- data/lib/pdf_generator_api_client/models/add_watermark_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/async_output_param.rb +41 -0
- data/lib/pdf_generator_api_client/models/callback_param.rb +232 -0
- data/lib/pdf_generator_api_client/models/component.rb +336 -0
- data/lib/pdf_generator_api_client/models/convert_html2_pdf_request.rb +324 -0
- data/lib/pdf_generator_api_client/models/convert_pdf2_image_request.rb +422 -0
- data/lib/pdf_generator_api_client/models/convert_url2_pdf_request.rb +324 -0
- data/lib/pdf_generator_api_client/models/copy_template_request.rb +221 -0
- data/lib/pdf_generator_api_client/models/create_e_invoice_request.rb +308 -0
- data/lib/pdf_generator_api_client/models/create_factur_xe_invoice_request.rb +315 -0
- data/lib/pdf_generator_api_client/models/create_factur_xe_invoice_request_template.rb +242 -0
- data/lib/pdf_generator_api_client/models/create_workspace_request.rb +221 -0
- data/lib/pdf_generator_api_client/models/data_batch_inner.rb +231 -0
- data/lib/pdf_generator_api_client/models/document.rb +261 -0
- data/lib/pdf_generator_api_client/models/encrypt_and_decrypt_base64.rb +331 -0
- data/lib/pdf_generator_api_client/models/encrypt_and_decrypt_url.rb +331 -0
- data/lib/pdf_generator_api_client/models/encrypt_document_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/extract_form_fields_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/fill_form_fields_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/form_action_download.rb +221 -0
- data/lib/pdf_generator_api_client/models/form_action_send.rb +221 -0
- data/lib/pdf_generator_api_client/models/form_action_send_send_document.rb +250 -0
- data/lib/pdf_generator_api_client/models/form_action_send_send_document_headers_inner.rb +283 -0
- data/lib/pdf_generator_api_client/models/form_action_store.rb +221 -0
- data/lib/pdf_generator_api_client/models/form_configuration.rb +290 -0
- data/lib/pdf_generator_api_client/models/form_configuration_new.rb +264 -0
- data/lib/pdf_generator_api_client/models/form_configuration_new_actions_inner.rb +105 -0
- data/lib/pdf_generator_api_client/models/form_fields_base64.rb +271 -0
- data/lib/pdf_generator_api_client/models/form_fields_inner.rb +286 -0
- data/lib/pdf_generator_api_client/models/form_fields_url.rb +271 -0
- data/lib/pdf_generator_api_client/models/form_fill_base64.rb +321 -0
- data/lib/pdf_generator_api_client/models/form_fill_url.rb +321 -0
- data/lib/pdf_generator_api_client/models/format_param.rb +40 -0
- data/lib/pdf_generator_api_client/models/generate_document_asynchronous_request.rb +318 -0
- data/lib/pdf_generator_api_client/models/generate_document_batch_asynchronous_request.rb +308 -0
- data/lib/pdf_generator_api_client/models/generate_document_batch_request.rb +299 -0
- data/lib/pdf_generator_api_client/models/generate_document_request.rb +309 -0
- data/lib/pdf_generator_api_client/models/generate_qr_code201_response.rb +230 -0
- data/lib/pdf_generator_api_client/models/generate_qr_code201_response_meta.rb +231 -0
- data/lib/pdf_generator_api_client/models/generate_qr_code_request.rb +316 -0
- data/lib/pdf_generator_api_client/models/get_status200_response.rb +299 -0
- data/lib/pdf_generator_api_client/models/get_template_library200_response.rb +222 -0
- data/lib/pdf_generator_api_client/models/get_template_version422_response.rb +220 -0
- data/lib/pdf_generator_api_client/models/import_form_base64.rb +247 -0
- data/lib/pdf_generator_api_client/models/import_form_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/import_form_url.rb +247 -0
- data/lib/pdf_generator_api_client/models/import_template_base64.rb +264 -0
- data/lib/pdf_generator_api_client/models/import_template_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/import_template_url.rb +264 -0
- data/lib/pdf_generator_api_client/models/import_template_url_template.rb +238 -0
- data/lib/pdf_generator_api_client/models/inline_object.rb +230 -0
- data/lib/pdf_generator_api_client/models/inline_object1.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object10.rb +232 -0
- data/lib/pdf_generator_api_client/models/inline_object10_meta.rb +251 -0
- data/lib/pdf_generator_api_client/models/inline_object11.rb +230 -0
- data/lib/pdf_generator_api_client/models/inline_object11_meta.rb +261 -0
- data/lib/pdf_generator_api_client/models/inline_object12.rb +230 -0
- data/lib/pdf_generator_api_client/models/inline_object12_meta.rb +270 -0
- data/lib/pdf_generator_api_client/models/inline_object12_meta_stats.rb +231 -0
- data/lib/pdf_generator_api_client/models/inline_object13.rb +265 -0
- data/lib/pdf_generator_api_client/models/inline_object14.rb +223 -0
- data/lib/pdf_generator_api_client/models/inline_object14_response_value.rb +401 -0
- data/lib/pdf_generator_api_client/models/inline_object14_response_value_default.rb +107 -0
- data/lib/pdf_generator_api_client/models/inline_object14_response_value_value.rb +107 -0
- data/lib/pdf_generator_api_client/models/inline_object15.rb +231 -0
- data/lib/pdf_generator_api_client/models/inline_object16.rb +229 -0
- data/lib/pdf_generator_api_client/models/inline_object17.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object18.rb +230 -0
- data/lib/pdf_generator_api_client/models/inline_object18_meta.rb +221 -0
- data/lib/pdf_generator_api_client/models/inline_object19.rb +221 -0
- data/lib/pdf_generator_api_client/models/inline_object1_response.rb +223 -0
- data/lib/pdf_generator_api_client/models/inline_object2.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object20.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object20_response.rb +221 -0
- data/lib/pdf_generator_api_client/models/inline_object21.rb +255 -0
- data/lib/pdf_generator_api_client/models/inline_object22.rb +255 -0
- data/lib/pdf_generator_api_client/models/inline_object23.rb +255 -0
- data/lib/pdf_generator_api_client/models/inline_object24.rb +255 -0
- data/lib/pdf_generator_api_client/models/inline_object25.rb +231 -0
- data/lib/pdf_generator_api_client/models/inline_object26.rb +221 -0
- data/lib/pdf_generator_api_client/models/inline_object27.rb +221 -0
- data/lib/pdf_generator_api_client/models/inline_object3.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object4.rb +231 -0
- data/lib/pdf_generator_api_client/models/inline_object5.rb +231 -0
- data/lib/pdf_generator_api_client/models/inline_object6.rb +231 -0
- data/lib/pdf_generator_api_client/models/inline_object7.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object7_response.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object8.rb +220 -0
- data/lib/pdf_generator_api_client/models/inline_object9.rb +230 -0
- data/lib/pdf_generator_api_client/models/inline_object9_meta.rb +261 -0
- data/lib/pdf_generator_api_client/models/inline_object_meta.rb +231 -0
- data/lib/pdf_generator_api_client/models/key_field_param.rb +40 -0
- data/lib/pdf_generator_api_client/models/make_accessible_base64.rb +315 -0
- data/lib/pdf_generator_api_client/models/make_accessible_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/make_accessible_url.rb +315 -0
- data/lib/pdf_generator_api_client/models/metadata_param.rb +236 -0
- data/lib/pdf_generator_api_client/models/open_editor_request.rb +264 -0
- data/lib/pdf_generator_api_client/models/open_editor_request_data.rb +106 -0
- data/lib/pdf_generator_api_client/models/optimize_base64.rb +294 -0
- data/lib/pdf_generator_api_client/models/optimize_document_request.rb +105 -0
- data/lib/pdf_generator_api_client/models/optimize_url.rb +294 -0
- data/lib/pdf_generator_api_client/models/output_param.rb +42 -0
- data/lib/pdf_generator_api_client/models/pagination_meta.rb +239 -0
- data/lib/pdf_generator_api_client/models/promote_template_version200_response.rb +220 -0
- data/lib/pdf_generator_api_client/models/public_template_library_item.rb +265 -0
- data/lib/pdf_generator_api_client/models/status_param.rb +40 -0
- data/lib/pdf_generator_api_client/models/store_document_request.rb +289 -0
- data/lib/pdf_generator_api_client/models/template.rb +274 -0
- data/lib/pdf_generator_api_client/models/template_definition.rb +292 -0
- data/lib/pdf_generator_api_client/models/template_definition_data_settings.rb +234 -0
- data/lib/pdf_generator_api_client/models/template_definition_editor.rb +221 -0
- data/lib/pdf_generator_api_client/models/template_definition_new.rb +324 -0
- data/lib/pdf_generator_api_client/models/template_definition_new_data_settings.rb +245 -0
- data/lib/pdf_generator_api_client/models/template_definition_new_editor.rb +221 -0
- data/lib/pdf_generator_api_client/models/template_definition_new_layout.rb +377 -0
- data/lib/pdf_generator_api_client/models/template_definition_new_layout_margins.rb +248 -0
- data/lib/pdf_generator_api_client/models/template_definition_new_layout_repeat_layout.rb +276 -0
- data/lib/pdf_generator_api_client/models/template_definition_new_pages_inner.rb +295 -0
- data/lib/pdf_generator_api_client/models/template_definition_new_pages_inner_margins.rb +231 -0
- data/lib/pdf_generator_api_client/models/template_definition_pages_inner.rb +251 -0
- data/lib/pdf_generator_api_client/models/template_param.rb +240 -0
- data/lib/pdf_generator_api_client/models/template_param_data.rb +105 -0
- data/lib/pdf_generator_api_client/models/template_param_id.rb +106 -0
- data/lib/pdf_generator_api_client/models/template_version.rb +301 -0
- data/lib/pdf_generator_api_client/models/template_version_collection.rb +231 -0
- data/lib/pdf_generator_api_client/models/template_version_collection_meta.rb +238 -0
- data/lib/pdf_generator_api_client/models/watermark_base64.rb +320 -0
- data/lib/pdf_generator_api_client/models/watermark_file_url_watermark.rb +229 -0
- data/lib/pdf_generator_api_client/models/watermark_image.rb +104 -0
- data/lib/pdf_generator_api_client/models/watermark_image_content_base64.rb +351 -0
- data/lib/pdf_generator_api_client/models/watermark_image_content_url.rb +351 -0
- data/lib/pdf_generator_api_client/models/watermark_position.rb +47 -0
- data/lib/pdf_generator_api_client/models/watermark_text.rb +403 -0
- data/lib/pdf_generator_api_client/models/workspace.rb +250 -0
- data/lib/pdf_generator_api_client/version.rb +15 -0
- data/lib/pdf_generator_api_client.rb +185 -0
- data/pdf_generator_api_client.gemspec +39 -0
- data/spec/api/assets_api_spec.rb +47 -0
- data/spec/api/conversion_api_spec.rb +71 -0
- data/spec/api/documents_api_spec.rb +147 -0
- data/spec/api/e_invoices_api_spec.rb +82 -0
- data/spec/api/forms_api_spec.rb +144 -0
- data/spec/api/misc_api_spec.rb +46 -0
- data/spec/api/services_api_spec.rb +119 -0
- data/spec/api/template_library_api_spec.rb +59 -0
- data/spec/api/template_versions_api_spec.rb +88 -0
- data/spec/api/templates_api_spec.rb +173 -0
- data/spec/api/workspaces_api_spec.rb +84 -0
- data/spec/models/accessibility_option_spec.rb +30 -0
- data/spec/models/add_watermark_request_spec.rb +32 -0
- data/spec/models/async_output_param_spec.rb +30 -0
- data/spec/models/callback_param_spec.rb +42 -0
- data/spec/models/component_spec.rb +88 -0
- data/spec/models/convert_html2_pdf_request_spec.rb +72 -0
- data/spec/models/convert_pdf2_image_request_spec.rb +86 -0
- data/spec/models/convert_url2_pdf_request_spec.rb +72 -0
- data/spec/models/copy_template_request_spec.rb +36 -0
- data/spec/models/create_e_invoice_request_spec.rb +56 -0
- data/spec/models/create_factur_xe_invoice_request_spec.rb +64 -0
- data/spec/models/create_factur_xe_invoice_request_template_spec.rb +48 -0
- data/spec/models/create_workspace_request_spec.rb +36 -0
- data/spec/models/data_batch_inner_spec.rb +42 -0
- data/spec/models/document_spec.rb +60 -0
- data/spec/models/encrypt_and_decrypt_base64_spec.rb +64 -0
- data/spec/models/encrypt_and_decrypt_url_spec.rb +64 -0
- data/spec/models/encrypt_document_request_spec.rb +32 -0
- data/spec/models/extract_form_fields_request_spec.rb +32 -0
- data/spec/models/fill_form_fields_request_spec.rb +32 -0
- data/spec/models/form_action_download_spec.rb +36 -0
- data/spec/models/form_action_send_send_document_headers_inner_spec.rb +42 -0
- data/spec/models/form_action_send_send_document_spec.rb +42 -0
- data/spec/models/form_action_send_spec.rb +36 -0
- data/spec/models/form_action_store_spec.rb +36 -0
- data/spec/models/form_configuration_new_actions_inner_spec.rb +21 -0
- data/spec/models/form_configuration_new_spec.rb +60 -0
- data/spec/models/form_configuration_spec.rb +48 -0
- data/spec/models/form_fields_base64_spec.rb +42 -0
- data/spec/models/form_fields_inner_spec.rb +58 -0
- data/spec/models/form_fields_url_spec.rb +42 -0
- data/spec/models/form_fill_base64_spec.rb +58 -0
- data/spec/models/form_fill_url_spec.rb +58 -0
- data/spec/models/format_param_spec.rb +30 -0
- data/spec/models/generate_document_asynchronous_request_spec.rb +78 -0
- data/spec/models/generate_document_batch_asynchronous_request_spec.rb +72 -0
- data/spec/models/generate_document_batch_request_spec.rb +66 -0
- data/spec/models/generate_document_request_spec.rb +72 -0
- data/spec/models/generate_qr_code201_response_meta_spec.rb +42 -0
- data/spec/models/generate_qr_code201_response_spec.rb +42 -0
- data/spec/models/generate_qr_code_request_spec.rb +64 -0
- data/spec/models/get_status200_response_spec.rb +66 -0
- data/spec/models/get_template_library200_response_spec.rb +36 -0
- data/spec/models/get_template_version422_response_spec.rb +36 -0
- data/spec/models/import_form_base64_spec.rb +42 -0
- data/spec/models/import_form_request_spec.rb +32 -0
- data/spec/models/import_form_url_spec.rb +42 -0
- data/spec/models/import_template_base64_spec.rb +42 -0
- data/spec/models/import_template_request_spec.rb +32 -0
- data/spec/models/import_template_url_spec.rb +42 -0
- data/spec/models/import_template_url_template_spec.rb +36 -0
- data/spec/models/inline_object10_meta_spec.rb +54 -0
- data/spec/models/inline_object10_spec.rb +42 -0
- data/spec/models/inline_object11_meta_spec.rb +60 -0
- data/spec/models/inline_object11_spec.rb +42 -0
- data/spec/models/inline_object12_meta_spec.rb +66 -0
- data/spec/models/inline_object12_meta_stats_spec.rb +42 -0
- data/spec/models/inline_object12_spec.rb +42 -0
- data/spec/models/inline_object13_spec.rb +46 -0
- data/spec/models/inline_object14_response_value_default_spec.rb +32 -0
- data/spec/models/inline_object14_response_value_spec.rb +124 -0
- data/spec/models/inline_object14_response_value_value_spec.rb +32 -0
- data/spec/models/inline_object14_spec.rb +36 -0
- data/spec/models/inline_object15_spec.rb +42 -0
- data/spec/models/inline_object16_spec.rb +42 -0
- data/spec/models/inline_object17_spec.rb +36 -0
- data/spec/models/inline_object18_meta_spec.rb +36 -0
- data/spec/models/inline_object18_spec.rb +42 -0
- data/spec/models/inline_object19_spec.rb +36 -0
- data/spec/models/inline_object1_response_spec.rb +36 -0
- data/spec/models/inline_object1_spec.rb +36 -0
- data/spec/models/inline_object20_response_spec.rb +36 -0
- data/spec/models/inline_object20_spec.rb +36 -0
- data/spec/models/inline_object21_spec.rb +40 -0
- data/spec/models/inline_object22_spec.rb +40 -0
- data/spec/models/inline_object23_spec.rb +40 -0
- data/spec/models/inline_object24_spec.rb +40 -0
- data/spec/models/inline_object25_spec.rb +42 -0
- data/spec/models/inline_object26_spec.rb +36 -0
- data/spec/models/inline_object27_spec.rb +36 -0
- data/spec/models/inline_object2_spec.rb +36 -0
- data/spec/models/inline_object3_spec.rb +36 -0
- data/spec/models/inline_object4_spec.rb +42 -0
- data/spec/models/inline_object5_spec.rb +42 -0
- data/spec/models/inline_object6_spec.rb +42 -0
- data/spec/models/inline_object7_response_spec.rb +36 -0
- data/spec/models/inline_object7_spec.rb +36 -0
- data/spec/models/inline_object8_spec.rb +36 -0
- data/spec/models/inline_object9_meta_spec.rb +60 -0
- data/spec/models/inline_object9_spec.rb +42 -0
- data/spec/models/inline_object_meta_spec.rb +42 -0
- data/spec/models/inline_object_spec.rb +42 -0
- data/spec/models/key_field_param_spec.rb +30 -0
- data/spec/models/make_accessible_base64_spec.rb +64 -0
- data/spec/models/make_accessible_request_spec.rb +32 -0
- data/spec/models/make_accessible_url_spec.rb +64 -0
- data/spec/models/metadata_param_spec.rb +42 -0
- data/spec/models/open_editor_request_data_spec.rb +32 -0
- data/spec/models/open_editor_request_spec.rb +46 -0
- data/spec/models/optimize_base64_spec.rb +52 -0
- data/spec/models/optimize_document_request_spec.rb +32 -0
- data/spec/models/optimize_url_spec.rb +52 -0
- data/spec/models/output_param_spec.rb +30 -0
- data/spec/models/pagination_meta_spec.rb +48 -0
- data/spec/models/promote_template_version200_response_spec.rb +36 -0
- data/spec/models/public_template_library_item_spec.rb +60 -0
- data/spec/models/status_param_spec.rb +30 -0
- data/spec/models/store_document_request_spec.rb +58 -0
- data/spec/models/template_definition_data_settings_spec.rb +42 -0
- data/spec/models/template_definition_editor_spec.rb +36 -0
- data/spec/models/template_definition_new_data_settings_spec.rb +48 -0
- data/spec/models/template_definition_new_editor_spec.rb +36 -0
- data/spec/models/template_definition_new_layout_margins_spec.rb +54 -0
- data/spec/models/template_definition_new_layout_repeat_layout_spec.rb +52 -0
- data/spec/models/template_definition_new_layout_spec.rb +100 -0
- data/spec/models/template_definition_new_pages_inner_margins_spec.rb +42 -0
- data/spec/models/template_definition_new_pages_inner_spec.rb +78 -0
- data/spec/models/template_definition_new_spec.rb +84 -0
- data/spec/models/template_definition_pages_inner_spec.rb +54 -0
- data/spec/models/template_definition_spec.rb +78 -0
- data/spec/models/template_param_data_spec.rb +32 -0
- data/spec/models/template_param_id_spec.rb +32 -0
- data/spec/models/template_param_spec.rb +48 -0
- data/spec/models/template_spec.rb +66 -0
- data/spec/models/template_version_collection_meta_spec.rb +48 -0
- data/spec/models/template_version_collection_spec.rb +42 -0
- data/spec/models/template_version_spec.rb +90 -0
- data/spec/models/watermark_base64_spec.rb +58 -0
- data/spec/models/watermark_file_url_watermark_spec.rb +42 -0
- data/spec/models/watermark_image_content_base64_spec.rb +54 -0
- data/spec/models/watermark_image_content_url_spec.rb +54 -0
- data/spec/models/watermark_image_spec.rb +21 -0
- data/spec/models/watermark_position_spec.rb +30 -0
- data/spec/models/watermark_text_spec.rb +66 -0
- data/spec/models/workspace_spec.rb +54 -0
- data/spec/spec_helper.rb +111 -0
- metadata +679 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#PDF Generator API
|
|
3
|
+
|
|
4
|
+
## Introduction [PDF Generator API](https://pdfgeneratorapi.com) allows you easily generate transactional PDF documents and reduce the development and support costs by enabling your users to create and manage their document templates using a browser-based drag-and-drop document editor. The PDF Generator API features a web API architecture, allowing you to code in the language of your choice. This API supports the JSON media type, and uses UTF-8 character encoding. ## Base URL The base URL for all the API endpoints is `https://us1.pdfgeneratorapi.com/api/v4` For example * `https://us1.pdfgeneratorapi.com/api/v4/templates` * `https://us1.pdfgeneratorapi.com/api/v4/workspaces` * `https://us1.pdfgeneratorapi.com/api/v4/templates/123123` ## Editor PDF Generator API comes with a powerful drag & drop editor that allows to create any kind of document templates, from barcode labels to invoices, quotes and reports. You can find tutorials and videos from our [Support Portal](https://support.pdfgeneratorapi.com). * [Component specification](https://support.pdfgeneratorapi.com/en/category/components-1ffseaj/) * [Expression Language documentation](https://support.pdfgeneratorapi.com/en/category/expression-language-q203pa/) * [Frequently asked questions and answers](https://support.pdfgeneratorapi.com/en/category/qanda-1ov519d/) ## Definitions ### Organization Organization is a group of workspaces owned by your account. ### Workspace Workspace contains templates. Each workspace has access to their own templates and organization default templates. ### Master Workspace Master Workspace is the main/default workspace of your Organization. The Master Workspace identifier is the email you signed up with. ### Default Template Default template is a template that is available for all workspaces by default. You can set the template access type under Page Setup. If template has \"Organization\" access then your users can use them from the \"New\" menu in the Editor. ### Data Field Data Field is a placeholder for the specific data in your JSON data set. In this example JSON you can access the buyer name using Data Field `{paymentDetails::buyerName}`. The separator between depth levels is :: (two colons). When designing the template you don’t have to know every Data Field, our editor automatically extracts all the available fields from your data set and provides an easy way to insert them into the template. ``` { \"documentNumber\": 1, \"paymentDetails\": { \"method\": \"Credit Card\", \"buyerName\": \"John Smith\" }, \"items\": [ { \"id\": 1, \"name\": \"Item one\" } ] } ``` ## Rate limiting Our API endpoints use IP-based rate limiting and allow you to make up to 2 requests per second and 60 requests per minute. If you make more requests, you will receive a response with HTTP code 429. Response headers contain additional values: | Header | Description | |--------|--------------------------------| | X-RateLimit-Limit | Maximum requests per minute | | X-RateLimit-Remaining | The requests remaining in the current minute | | Retry-After | How many seconds you need to wait until you are allowed to make requests | * * * * * # Libraries and SDKs ## Postman Collection We have created a [Postman Collection](https://www.postman.com/pdfgeneratorapi/workspace/pdf-generator-api-public-workspace/overview) so you can easily test all the API endpoints without developing and code. ## Client Libraries All our Client Libraries are auto-generated using [OpenAPI Generator](https://openapi-generator.tech/) which uses the OpenAPI v3 specification to automatically generate a client library in specific programming language. * [PHP Client](https://github.com/pdfgeneratorapi/php-client) * [Java Client](https://github.com/pdfgeneratorapi/java-client) * [Ruby Client](https://github.com/pdfgeneratorapi/ruby-client) * [Python Client](https://github.com/pdfgeneratorapi/python-client) * [Javascript Client](https://github.com/pdfgeneratorapi/javascript-client) We have validated the generated libraries, but let us know if you find any anomalies in the client code. ## Model Context Protocol (MCP) Server Integrate document generation directly into your AI agents and LLM applications using our official Model Context Protocol (MCP) Server. The MCP server provides a standardized interface that allows AI assistants (like Claude Desktop and other MCP-compatible clients) to securely interact with the PDF Generator API. With it, your AI applications can automatically fetch workspaces, retrieve templates, merge data, and generate PDF documents on the fly. [Get PDF Generator API MCP Server](https://github.com/pdfgeneratorapi/mcp-server) * * * * * # Authentication The PDF Generator API uses __JSON Web Tokens (JWT)__ to authenticate all API requests. These tokens offer a method to establish secure server-to-server authentication by transferring a compact JSON object with a signed payload of your account’s API Key and Secret. When authenticating to the PDF Generator API, a JWT should be generated uniquely by a __server-side application__ and included as a __Bearer Token__ in the header of each request. <SecurityDefinitions /> ## Accessing your API Key and Secret You can find your __API Key__ and __API Secret__ from the __Account Settings__ page after you login to PDF Generator API [here](https://pdfgeneratorapi.com/login). ## Creating a JWT JSON Web Tokens are composed of three sections: a header, a payload (containing a claim set), and a signature. The header and payload are JSON objects, which are serialized to UTF-8 bytes, then encoded using base64url encoding. The JWT's header, payload, and signature are concatenated with periods (.). As a result, a JWT typically takes the following form: ``` {Base64url encoded header}.{Base64url encoded payload}.{Base64url encoded signature} ``` We recommend and support libraries provided on [jwt.io](https://jwt.io/). While other libraries can create JWT, these recommended libraries are the most robust. ### Header Property `alg` defines which signing algorithm is being used. PDF Generator API users HS256. Property `typ` defines the type of token and it is always JWT. ``` { \"alg\": \"HS256\", \"typ\": \"JWT\" } ``` ### Payload The second part of the token is the payload, which contains the claims or the pieces of information being passed about the user and any metadata required. It is mandatory to specify the following claims: * issuer (`iss`): Your API key * subject (`sub`): Workspace identifier * expiration time (`exp`): Timestamp (unix epoch time) until the token is valid. It is highly recommended to set the exp timestamp for a short period, i.e. a matter of seconds. This way, if a token is intercepted or shared, the token will only be valid for a short period of time. ``` { \"iss\": \"ad54aaff89ffdfeff178bb8a8f359b29fcb20edb56250b9f584aa2cb0162ed4a\", \"sub\": \"demo.example@actualreports.com\", \"exp\": 1586112639 } ``` ### Payload for Partners Our partners can send their unique identifier (provided by us) in JWT's partner_id claim. If the `partner_id` value is specified in the JWT, the organization making the request is automatically connected to the partner account. * Partner ID (`partner_id`): Unique identifier provide by PDF Generator API team ``` { \"iss\": \"ad54aaff89ffdfeff178bb8a8f359b29fcb20edb56250b9f584aa2cb0162ed4a\", \"sub\": \"demo.example@actualreports.com\", \"partner_id\": \"my-partner-identifier\", \"exp\": 1586112639 } ``` ### Signature To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. The signature is used to verify the message wasn't changed along the way, and, in the case of tokens signed with a private key, it can also verify that the sender of the JWT is who it says it is. ``` HMACSHA256( base64UrlEncode(header) + \".\" + base64UrlEncode(payload), API_SECRET) ``` ### Putting all together The output is three Base64-URL strings separated by dots. The following shows a JWT that has the previous header and payload encoded, and it is signed with a secret. ``` eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhZDU0YWFmZjg5ZmZkZmVmZjE3OGJiOGE4ZjM1OWIyOWZjYjIwZWRiNTYyNTBiOWY1ODRhYTJjYjAxNjJlZDRhIiwic3ViIjoiZGVtby5leGFtcGxlQGFjdHVhbHJlcG9ydHMuY29tIn0.SxO-H7UYYYsclS8RGWO1qf0z1cB1m73wF9FLl9RCc1Q // Base64 encoded header: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 // Base64 encoded payload: eyJpc3MiOiJhZDU0YWFmZjg5ZmZkZmVmZjE3OGJiOGE4ZjM1OWIyOWZjYjIwZWRiNTYyNTBiOWY1ODRhYTJjYjAxNjJlZDRhIiwic3ViIjoiZGVtby5leGFtcGxlQGFjdHVhbHJlcG9ydHMuY29tIn0 // Signature: SxO-H7UYYYsclS8RGWO1qf0z1cB1m73wF9FLl9RCc1Q ``` ## Temporary JWTs You can create a temporary token in [Account Settings](https://pdfgeneratorapi.com/account/organization) page after you login to PDF Generator API. The generated token uses your email address as the subject (`sub`) value and is valid for __15 minutes__. You can also use [jwt.io](https://jwt.io/) to generate test tokens for your API calls. These test tokens should never be used in production applications. * * * * * # Error codes | Code | Description | |--------|--------------------------------| | 401 | Unauthorized | | 402 | Payment Required | | 403 | Forbidden | | 404 | Not Found | | 422 | Unprocessable Entity | | 429 | Too Many Requests | | 500 | Internal Server Error | ## 401 Unauthorized | Description | |-------------------------------------------------------------------------| | Authentication failed: request expired | | Authentication failed: workspace missing | | Authentication failed: key missing | | Authentication failed: property 'iss' (issuer) missing in JWT | | Authentication failed: property 'sub' (subject) missing in JWT | | Authentication failed: property 'exp' (expiration time) missing in JWT | | Authentication failed: incorrect signature | ## 402 Payment Required | Description | |-------------------------------------------------------------------------| | Your account is suspended, please upgrade your account | ## 403 Forbidden | Description | |-------------------------------------------------------------------------| | Your account has exceeded the monthly document generation limit. | | Access not granted: You cannot delete master workspace via API | | Access not granted: Template is not accessible by this organization | | Your session has expired, please close and reopen the editor. | ## 404 Entity not found | Description | |-------------------------------------------------------------------------| | Entity not found | | Resource not found | | None of the templates is available for the workspace. | ## 422 Unprocessable Entity | Description | |-------------------------------------------------------------------------| | Unable to parse JSON, please check formatting | | Required parameter missing | | Required parameter missing: template definition not defined | | Required parameter missing: template not defined | ## 429 Too Many Requests | Description | |-------------------------------------------------------------------------| | You can make up to 2 requests per second and 60 requests per minute. | * * * * *
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 4.0.25
|
|
7
|
+
Contact: support@pdfgeneratorapi.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.14.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'logger'
|
|
16
|
+
require 'tempfile'
|
|
17
|
+
require 'time'
|
|
18
|
+
require 'typhoeus'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
module PDFGeneratorAPI
|
|
22
|
+
class ApiClient
|
|
23
|
+
# The Configuration object holding settings to be used in the API client.
|
|
24
|
+
attr_accessor :config
|
|
25
|
+
|
|
26
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
|
27
|
+
#
|
|
28
|
+
# @return [Hash]
|
|
29
|
+
attr_accessor :default_headers
|
|
30
|
+
|
|
31
|
+
# Initializes the ApiClient
|
|
32
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
|
33
|
+
def initialize(config = Configuration.default)
|
|
34
|
+
@config = config
|
|
35
|
+
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
|
36
|
+
@default_headers = {
|
|
37
|
+
'Content-Type' => 'application/json',
|
|
38
|
+
'User-Agent' => @user_agent
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.default
|
|
43
|
+
@@default ||= ApiClient.new
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Call an API with given options.
|
|
47
|
+
#
|
|
48
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
|
49
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
|
50
|
+
def call_api(http_method, path, opts = {})
|
|
51
|
+
request = build_request(http_method, path, opts)
|
|
52
|
+
tempfile = nil
|
|
53
|
+
(download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
|
|
54
|
+
response = request.run
|
|
55
|
+
|
|
56
|
+
if @config.debugging
|
|
57
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
unless response.success?
|
|
61
|
+
if response.timed_out?
|
|
62
|
+
fail ApiError.new('Connection timed out')
|
|
63
|
+
elsif response.code == 0
|
|
64
|
+
# Errors from libcurl will be made visible here
|
|
65
|
+
fail ApiError.new(:code => 0,
|
|
66
|
+
:message => response.return_message)
|
|
67
|
+
else
|
|
68
|
+
fail ApiError.new(:code => response.code,
|
|
69
|
+
:response_headers => response.headers,
|
|
70
|
+
:response_body => response.body),
|
|
71
|
+
response.status_message
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if opts[:return_type] == 'File'
|
|
76
|
+
data = tempfile
|
|
77
|
+
elsif opts[:return_type]
|
|
78
|
+
data = deserialize(response, opts[:return_type])
|
|
79
|
+
else
|
|
80
|
+
data = nil
|
|
81
|
+
end
|
|
82
|
+
return data, response.code, response.headers
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Builds the HTTP request
|
|
86
|
+
#
|
|
87
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
|
88
|
+
# @param [String] path URL path (e.g. /account/new)
|
|
89
|
+
# @option opts [Hash] :header_params Header parameters
|
|
90
|
+
# @option opts [Hash] :query_params Query parameters
|
|
91
|
+
# @option opts [Hash] :form_params Query parameters
|
|
92
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
|
93
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
|
94
|
+
def build_request(http_method, path, opts = {})
|
|
95
|
+
url = build_request_url(path, opts)
|
|
96
|
+
http_method = http_method.to_sym.downcase
|
|
97
|
+
|
|
98
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
|
99
|
+
query_params = opts[:query_params] || {}
|
|
100
|
+
form_params = opts[:form_params] || {}
|
|
101
|
+
follow_location = opts[:follow_location] || true
|
|
102
|
+
|
|
103
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
|
104
|
+
|
|
105
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
|
106
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
|
107
|
+
|
|
108
|
+
req_opts = {
|
|
109
|
+
:method => http_method,
|
|
110
|
+
:headers => header_params,
|
|
111
|
+
:params => query_params,
|
|
112
|
+
:params_encoding => @config.params_encoding,
|
|
113
|
+
:timeout => @config.timeout,
|
|
114
|
+
:ssl_verifypeer => @config.verify_ssl,
|
|
115
|
+
:ssl_verifyhost => _verify_ssl_host,
|
|
116
|
+
:sslcert => @config.cert_file,
|
|
117
|
+
:sslkey => @config.key_file,
|
|
118
|
+
:verbose => @config.debugging,
|
|
119
|
+
:followlocation => follow_location
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# set custom cert, if provided
|
|
123
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
|
124
|
+
|
|
125
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
|
126
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
|
127
|
+
req_opts.update :body => req_body
|
|
128
|
+
if @config.debugging
|
|
129
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
Typhoeus::Request.new(url, req_opts)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Builds the HTTP request body
|
|
137
|
+
#
|
|
138
|
+
# @param [Hash] header_params Header parameters
|
|
139
|
+
# @param [Hash] form_params Query parameters
|
|
140
|
+
# @param [Object] body HTTP body (JSON/XML)
|
|
141
|
+
# @return [String] HTTP body data in the form of string
|
|
142
|
+
def build_request_body(header_params, form_params, body)
|
|
143
|
+
# http form
|
|
144
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
|
145
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
|
146
|
+
data = {}
|
|
147
|
+
form_params.each do |key, value|
|
|
148
|
+
case value
|
|
149
|
+
when ::File, ::Array, nil
|
|
150
|
+
# let typhoeus handle File, Array and nil parameters
|
|
151
|
+
data[key] = value
|
|
152
|
+
else
|
|
153
|
+
data[key] = value.to_s
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
elsif body
|
|
157
|
+
data = body.is_a?(String) ? body : body.to_json
|
|
158
|
+
else
|
|
159
|
+
data = nil
|
|
160
|
+
end
|
|
161
|
+
data
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
|
165
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
|
166
|
+
# The response body is written to the file in chunks in order to handle files which
|
|
167
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
|
168
|
+
# process can use.
|
|
169
|
+
#
|
|
170
|
+
# @see Configuration#temp_folder_path
|
|
171
|
+
#
|
|
172
|
+
# @return [Tempfile] the tempfile generated
|
|
173
|
+
def download_file(request)
|
|
174
|
+
tempfile = nil
|
|
175
|
+
encoding = nil
|
|
176
|
+
request.on_headers do |response|
|
|
177
|
+
content_disposition = response.headers['Content-Disposition']
|
|
178
|
+
if content_disposition && content_disposition =~ /filename=/i
|
|
179
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
180
|
+
prefix = sanitize_filename(filename)
|
|
181
|
+
else
|
|
182
|
+
prefix = 'download-'
|
|
183
|
+
end
|
|
184
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
185
|
+
encoding = response.body.encoding
|
|
186
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
187
|
+
end
|
|
188
|
+
request.on_body do |chunk|
|
|
189
|
+
chunk.force_encoding(encoding)
|
|
190
|
+
tempfile.write(chunk)
|
|
191
|
+
end
|
|
192
|
+
request.on_complete do
|
|
193
|
+
if !tempfile
|
|
194
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
|
195
|
+
end
|
|
196
|
+
tempfile.close
|
|
197
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
198
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
199
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
200
|
+
"explicitly with `tempfile.delete`"
|
|
201
|
+
yield tempfile if block_given?
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Check if the given MIME is a JSON MIME.
|
|
206
|
+
# JSON MIME examples:
|
|
207
|
+
# application/json
|
|
208
|
+
# application/json; charset=UTF8
|
|
209
|
+
# APPLICATION/JSON
|
|
210
|
+
# */*
|
|
211
|
+
# @param [String] mime MIME
|
|
212
|
+
# @return [Boolean] True if the MIME is application/json
|
|
213
|
+
def json_mime?(mime)
|
|
214
|
+
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Deserialize the response to the given return type.
|
|
218
|
+
#
|
|
219
|
+
# @param [Response] response HTTP response
|
|
220
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
|
221
|
+
def deserialize(response, return_type)
|
|
222
|
+
body = response.body
|
|
223
|
+
return nil if body.nil? || body.empty?
|
|
224
|
+
|
|
225
|
+
# return response body directly for String return type
|
|
226
|
+
return body.to_s if return_type == 'String'
|
|
227
|
+
|
|
228
|
+
# ensuring a default content type
|
|
229
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
|
230
|
+
|
|
231
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
|
232
|
+
|
|
233
|
+
begin
|
|
234
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
|
235
|
+
rescue JSON::ParserError => e
|
|
236
|
+
if %w(String Date Time).include?(return_type)
|
|
237
|
+
data = body
|
|
238
|
+
else
|
|
239
|
+
raise e
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
convert_to_type data, return_type
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Convert data to the given return type.
|
|
247
|
+
# @param [Object] data Data to be converted
|
|
248
|
+
# @param [String] return_type Return type
|
|
249
|
+
# @return [Mixed] Data in a particular type
|
|
250
|
+
def convert_to_type(data, return_type)
|
|
251
|
+
return nil if data.nil?
|
|
252
|
+
case return_type
|
|
253
|
+
when 'String'
|
|
254
|
+
data.to_s
|
|
255
|
+
when 'Integer'
|
|
256
|
+
data.to_i
|
|
257
|
+
when 'Float'
|
|
258
|
+
data.to_f
|
|
259
|
+
when 'Boolean'
|
|
260
|
+
data == true
|
|
261
|
+
when 'Time'
|
|
262
|
+
# parse date time (expecting ISO 8601 format)
|
|
263
|
+
Time.parse data
|
|
264
|
+
when 'Date'
|
|
265
|
+
# parse date time (expecting ISO 8601 format)
|
|
266
|
+
Date.parse data
|
|
267
|
+
when 'Object'
|
|
268
|
+
# generic object (usually a Hash), return directly
|
|
269
|
+
data
|
|
270
|
+
when /\AArray<(.+)>\z/
|
|
271
|
+
# e.g. Array<Pet>
|
|
272
|
+
sub_type = $1
|
|
273
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
|
274
|
+
when /\AHash\<String, (.+)\>\z/
|
|
275
|
+
# e.g. Hash<String, Integer>
|
|
276
|
+
sub_type = $1
|
|
277
|
+
{}.tap do |hash|
|
|
278
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
|
279
|
+
end
|
|
280
|
+
else
|
|
281
|
+
# models (e.g. Pet) or oneOf
|
|
282
|
+
klass = PDFGeneratorAPI.const_get(return_type)
|
|
283
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Sanitize filename by removing path.
|
|
288
|
+
# e.g. ../../sun.gif becomes sun.gif
|
|
289
|
+
#
|
|
290
|
+
# @param [String] filename the filename to be sanitized
|
|
291
|
+
# @return [String] the sanitized filename
|
|
292
|
+
def sanitize_filename(filename)
|
|
293
|
+
filename.split(/[\/\\]/).last
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def build_request_url(path, opts = {})
|
|
297
|
+
# Add leading and trailing slashes to path
|
|
298
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
|
299
|
+
@config.base_url(opts[:operation]) + path
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Update header and query params based on authentication settings.
|
|
303
|
+
#
|
|
304
|
+
# @param [Hash] header_params Header parameters
|
|
305
|
+
# @param [Hash] query_params Query parameters
|
|
306
|
+
# @param [String] auth_names Authentication scheme name
|
|
307
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
|
308
|
+
Array(auth_names).each do |auth_name|
|
|
309
|
+
auth_setting = @config.auth_settings[auth_name]
|
|
310
|
+
next unless auth_setting
|
|
311
|
+
case auth_setting[:in]
|
|
312
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
|
313
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
|
314
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Sets user agent in HTTP header
|
|
320
|
+
#
|
|
321
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
|
322
|
+
def user_agent=(user_agent)
|
|
323
|
+
@user_agent = user_agent
|
|
324
|
+
@default_headers['User-Agent'] = @user_agent
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
# Return Accept header based on an array of accepts provided.
|
|
328
|
+
# @param [Array] accepts array for Accept
|
|
329
|
+
# @return [String] the Accept header (e.g. application/json)
|
|
330
|
+
def select_header_accept(accepts)
|
|
331
|
+
return nil if accepts.nil? || accepts.empty?
|
|
332
|
+
# use JSON when present, otherwise use all of the provided
|
|
333
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
|
334
|
+
json_accept || accepts.join(',')
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Return Content-Type header based on an array of content types provided.
|
|
338
|
+
# @param [Array] content_types array for Content-Type
|
|
339
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
|
340
|
+
def select_header_content_type(content_types)
|
|
341
|
+
# return nil by default
|
|
342
|
+
return if content_types.nil? || content_types.empty?
|
|
343
|
+
# use JSON when present, otherwise use the first one
|
|
344
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
|
345
|
+
json_content_type || content_types.first
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
|
349
|
+
# @param [Object] model object to be converted into JSON string
|
|
350
|
+
# @return [String] JSON string representation of the object
|
|
351
|
+
def object_to_http_body(model)
|
|
352
|
+
return model if model.nil? || model.is_a?(String)
|
|
353
|
+
local_body = nil
|
|
354
|
+
if model.is_a?(Array)
|
|
355
|
+
local_body = model.map { |m| object_to_hash(m) }
|
|
356
|
+
else
|
|
357
|
+
local_body = object_to_hash(model)
|
|
358
|
+
end
|
|
359
|
+
local_body.to_json
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Convert object(non-array) to hash.
|
|
363
|
+
# @param [Object] obj object to be converted into JSON string
|
|
364
|
+
# @return [String] JSON string representation of the object
|
|
365
|
+
def object_to_hash(obj)
|
|
366
|
+
if obj.respond_to?(:to_hash)
|
|
367
|
+
obj.to_hash
|
|
368
|
+
else
|
|
369
|
+
obj
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# Build parameter value according to the given collection format.
|
|
374
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
|
375
|
+
def build_collection_param(param, collection_format)
|
|
376
|
+
case collection_format
|
|
377
|
+
when :csv
|
|
378
|
+
param.join(',')
|
|
379
|
+
when :ssv
|
|
380
|
+
param.join(' ')
|
|
381
|
+
when :tsv
|
|
382
|
+
param.join("\t")
|
|
383
|
+
when :pipes
|
|
384
|
+
param.join('|')
|
|
385
|
+
when :multi
|
|
386
|
+
# return the array directly as typhoeus will handle it as expected
|
|
387
|
+
param
|
|
388
|
+
else
|
|
389
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#PDF Generator API
|
|
3
|
+
|
|
4
|
+
## Introduction [PDF Generator API](https://pdfgeneratorapi.com) allows you easily generate transactional PDF documents and reduce the development and support costs by enabling your users to create and manage their document templates using a browser-based drag-and-drop document editor. The PDF Generator API features a web API architecture, allowing you to code in the language of your choice. This API supports the JSON media type, and uses UTF-8 character encoding. ## Base URL The base URL for all the API endpoints is `https://us1.pdfgeneratorapi.com/api/v4` For example * `https://us1.pdfgeneratorapi.com/api/v4/templates` * `https://us1.pdfgeneratorapi.com/api/v4/workspaces` * `https://us1.pdfgeneratorapi.com/api/v4/templates/123123` ## Editor PDF Generator API comes with a powerful drag & drop editor that allows to create any kind of document templates, from barcode labels to invoices, quotes and reports. You can find tutorials and videos from our [Support Portal](https://support.pdfgeneratorapi.com). * [Component specification](https://support.pdfgeneratorapi.com/en/category/components-1ffseaj/) * [Expression Language documentation](https://support.pdfgeneratorapi.com/en/category/expression-language-q203pa/) * [Frequently asked questions and answers](https://support.pdfgeneratorapi.com/en/category/qanda-1ov519d/) ## Definitions ### Organization Organization is a group of workspaces owned by your account. ### Workspace Workspace contains templates. Each workspace has access to their own templates and organization default templates. ### Master Workspace Master Workspace is the main/default workspace of your Organization. The Master Workspace identifier is the email you signed up with. ### Default Template Default template is a template that is available for all workspaces by default. You can set the template access type under Page Setup. If template has \"Organization\" access then your users can use them from the \"New\" menu in the Editor. ### Data Field Data Field is a placeholder for the specific data in your JSON data set. In this example JSON you can access the buyer name using Data Field `{paymentDetails::buyerName}`. The separator between depth levels is :: (two colons). When designing the template you don’t have to know every Data Field, our editor automatically extracts all the available fields from your data set and provides an easy way to insert them into the template. ``` { \"documentNumber\": 1, \"paymentDetails\": { \"method\": \"Credit Card\", \"buyerName\": \"John Smith\" }, \"items\": [ { \"id\": 1, \"name\": \"Item one\" } ] } ``` ## Rate limiting Our API endpoints use IP-based rate limiting and allow you to make up to 2 requests per second and 60 requests per minute. If you make more requests, you will receive a response with HTTP code 429. Response headers contain additional values: | Header | Description | |--------|--------------------------------| | X-RateLimit-Limit | Maximum requests per minute | | X-RateLimit-Remaining | The requests remaining in the current minute | | Retry-After | How many seconds you need to wait until you are allowed to make requests | * * * * * # Libraries and SDKs ## Postman Collection We have created a [Postman Collection](https://www.postman.com/pdfgeneratorapi/workspace/pdf-generator-api-public-workspace/overview) so you can easily test all the API endpoints without developing and code. ## Client Libraries All our Client Libraries are auto-generated using [OpenAPI Generator](https://openapi-generator.tech/) which uses the OpenAPI v3 specification to automatically generate a client library in specific programming language. * [PHP Client](https://github.com/pdfgeneratorapi/php-client) * [Java Client](https://github.com/pdfgeneratorapi/java-client) * [Ruby Client](https://github.com/pdfgeneratorapi/ruby-client) * [Python Client](https://github.com/pdfgeneratorapi/python-client) * [Javascript Client](https://github.com/pdfgeneratorapi/javascript-client) We have validated the generated libraries, but let us know if you find any anomalies in the client code. ## Model Context Protocol (MCP) Server Integrate document generation directly into your AI agents and LLM applications using our official Model Context Protocol (MCP) Server. The MCP server provides a standardized interface that allows AI assistants (like Claude Desktop and other MCP-compatible clients) to securely interact with the PDF Generator API. With it, your AI applications can automatically fetch workspaces, retrieve templates, merge data, and generate PDF documents on the fly. [Get PDF Generator API MCP Server](https://github.com/pdfgeneratorapi/mcp-server) * * * * * # Authentication The PDF Generator API uses __JSON Web Tokens (JWT)__ to authenticate all API requests. These tokens offer a method to establish secure server-to-server authentication by transferring a compact JSON object with a signed payload of your account’s API Key and Secret. When authenticating to the PDF Generator API, a JWT should be generated uniquely by a __server-side application__ and included as a __Bearer Token__ in the header of each request. <SecurityDefinitions /> ## Accessing your API Key and Secret You can find your __API Key__ and __API Secret__ from the __Account Settings__ page after you login to PDF Generator API [here](https://pdfgeneratorapi.com/login). ## Creating a JWT JSON Web Tokens are composed of three sections: a header, a payload (containing a claim set), and a signature. The header and payload are JSON objects, which are serialized to UTF-8 bytes, then encoded using base64url encoding. The JWT's header, payload, and signature are concatenated with periods (.). As a result, a JWT typically takes the following form: ``` {Base64url encoded header}.{Base64url encoded payload}.{Base64url encoded signature} ``` We recommend and support libraries provided on [jwt.io](https://jwt.io/). While other libraries can create JWT, these recommended libraries are the most robust. ### Header Property `alg` defines which signing algorithm is being used. PDF Generator API users HS256. Property `typ` defines the type of token and it is always JWT. ``` { \"alg\": \"HS256\", \"typ\": \"JWT\" } ``` ### Payload The second part of the token is the payload, which contains the claims or the pieces of information being passed about the user and any metadata required. It is mandatory to specify the following claims: * issuer (`iss`): Your API key * subject (`sub`): Workspace identifier * expiration time (`exp`): Timestamp (unix epoch time) until the token is valid. It is highly recommended to set the exp timestamp for a short period, i.e. a matter of seconds. This way, if a token is intercepted or shared, the token will only be valid for a short period of time. ``` { \"iss\": \"ad54aaff89ffdfeff178bb8a8f359b29fcb20edb56250b9f584aa2cb0162ed4a\", \"sub\": \"demo.example@actualreports.com\", \"exp\": 1586112639 } ``` ### Payload for Partners Our partners can send their unique identifier (provided by us) in JWT's partner_id claim. If the `partner_id` value is specified in the JWT, the organization making the request is automatically connected to the partner account. * Partner ID (`partner_id`): Unique identifier provide by PDF Generator API team ``` { \"iss\": \"ad54aaff89ffdfeff178bb8a8f359b29fcb20edb56250b9f584aa2cb0162ed4a\", \"sub\": \"demo.example@actualreports.com\", \"partner_id\": \"my-partner-identifier\", \"exp\": 1586112639 } ``` ### Signature To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. The signature is used to verify the message wasn't changed along the way, and, in the case of tokens signed with a private key, it can also verify that the sender of the JWT is who it says it is. ``` HMACSHA256( base64UrlEncode(header) + \".\" + base64UrlEncode(payload), API_SECRET) ``` ### Putting all together The output is three Base64-URL strings separated by dots. The following shows a JWT that has the previous header and payload encoded, and it is signed with a secret. ``` eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhZDU0YWFmZjg5ZmZkZmVmZjE3OGJiOGE4ZjM1OWIyOWZjYjIwZWRiNTYyNTBiOWY1ODRhYTJjYjAxNjJlZDRhIiwic3ViIjoiZGVtby5leGFtcGxlQGFjdHVhbHJlcG9ydHMuY29tIn0.SxO-H7UYYYsclS8RGWO1qf0z1cB1m73wF9FLl9RCc1Q // Base64 encoded header: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 // Base64 encoded payload: eyJpc3MiOiJhZDU0YWFmZjg5ZmZkZmVmZjE3OGJiOGE4ZjM1OWIyOWZjYjIwZWRiNTYyNTBiOWY1ODRhYTJjYjAxNjJlZDRhIiwic3ViIjoiZGVtby5leGFtcGxlQGFjdHVhbHJlcG9ydHMuY29tIn0 // Signature: SxO-H7UYYYsclS8RGWO1qf0z1cB1m73wF9FLl9RCc1Q ``` ## Temporary JWTs You can create a temporary token in [Account Settings](https://pdfgeneratorapi.com/account/organization) page after you login to PDF Generator API. The generated token uses your email address as the subject (`sub`) value and is valid for __15 minutes__. You can also use [jwt.io](https://jwt.io/) to generate test tokens for your API calls. These test tokens should never be used in production applications. * * * * * # Error codes | Code | Description | |--------|--------------------------------| | 401 | Unauthorized | | 402 | Payment Required | | 403 | Forbidden | | 404 | Not Found | | 422 | Unprocessable Entity | | 429 | Too Many Requests | | 500 | Internal Server Error | ## 401 Unauthorized | Description | |-------------------------------------------------------------------------| | Authentication failed: request expired | | Authentication failed: workspace missing | | Authentication failed: key missing | | Authentication failed: property 'iss' (issuer) missing in JWT | | Authentication failed: property 'sub' (subject) missing in JWT | | Authentication failed: property 'exp' (expiration time) missing in JWT | | Authentication failed: incorrect signature | ## 402 Payment Required | Description | |-------------------------------------------------------------------------| | Your account is suspended, please upgrade your account | ## 403 Forbidden | Description | |-------------------------------------------------------------------------| | Your account has exceeded the monthly document generation limit. | | Access not granted: You cannot delete master workspace via API | | Access not granted: Template is not accessible by this organization | | Your session has expired, please close and reopen the editor. | ## 404 Entity not found | Description | |-------------------------------------------------------------------------| | Entity not found | | Resource not found | | None of the templates is available for the workspace. | ## 422 Unprocessable Entity | Description | |-------------------------------------------------------------------------| | Unable to parse JSON, please check formatting | | Required parameter missing | | Required parameter missing: template definition not defined | | Required parameter missing: template not defined | ## 429 Too Many Requests | Description | |-------------------------------------------------------------------------| | You can make up to 2 requests per second and 60 requests per minute. | * * * * *
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 4.0.25
|
|
7
|
+
Contact: support@pdfgeneratorapi.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.14.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module PDFGeneratorAPI
|
|
14
|
+
class ApiError < StandardError
|
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
|
16
|
+
|
|
17
|
+
# Usage examples:
|
|
18
|
+
# ApiError.new
|
|
19
|
+
# ApiError.new("message")
|
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
|
22
|
+
def initialize(arg = nil)
|
|
23
|
+
if arg.is_a? Hash
|
|
24
|
+
if arg.key?(:message) || arg.key?('message')
|
|
25
|
+
super(arg[:message] || arg['message'])
|
|
26
|
+
else
|
|
27
|
+
super arg
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
arg.each do |k, v|
|
|
31
|
+
instance_variable_set "@#{k}", v
|
|
32
|
+
end
|
|
33
|
+
else
|
|
34
|
+
super arg
|
|
35
|
+
@message = arg
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Override to_s to display a friendly error message
|
|
40
|
+
def to_s
|
|
41
|
+
message
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def message
|
|
45
|
+
if @message.nil?
|
|
46
|
+
msg = "Error message: the server returns an error"
|
|
47
|
+
else
|
|
48
|
+
msg = @message
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
msg += "\nHTTP status code: #{code}" if code
|
|
52
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
|
53
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
|
54
|
+
|
|
55
|
+
msg
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|